appmap 0.48.0 → 0.48.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ce9ca4faa9074d177861610ff47bec4e7b02191e870759a12d1ed9207e9f79a
4
- data.tar.gz: 6b0157f28774b1d46fdea527c8076846253780040628f3879ec8c18af8c4a60d
3
+ metadata.gz: 698da91c88a89867584e3d78e10974a4a2f8d726636d60366c214be9e3ddbf97
4
+ data.tar.gz: eee0b62c442eecc5cf978960128c0b19ff2ebdc393770d8cefc820c82a451d4f
5
5
  SHA512:
6
- metadata.gz: e9d67de222d734c8b650c2c8bb8cef70b371908561dd8df43410f370071cdd1c24b9cc8d4919ccfda59745afefccc29e8af30444f25136aac685384ec079e0ba
7
- data.tar.gz: 387a7a074b9c56ae423825e0beea405909066528c40ff6d6ce3789843193c6e0c73cafabefd8e091dc9961dd5e2c112f311538e8afdc5bbaf37ca187be2f1606
6
+ metadata.gz: 77ae4b055912a7bd6f62f32bb2db7d3684d614453fb82bb7d8f53496181919609ca2af0a65906ca36f1f28aaf28e06c64d6f5e6326b8f384f4c1206c22af559a
7
+ data.tar.gz: a72831c1908beb0130b4797ea5455b976677caec810edcdf0009b9be609ba6510a59873b66ca4df5406fe8f3e5aea995d8dabc983573517adc67fdf86cad822a
data/.dockerignore CHANGED
@@ -2,4 +2,3 @@ vendor
2
2
  node_modules
3
3
  spec/fixtures/rails*_users_app
4
4
  spec/fixtures/rack_users_app
5
-
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.48.1](https://github.com/applandinc/appmap-ruby/compare/v0.48.0...v0.48.1) (2021-05-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Account for bundle path when normalizing source path ([095c278](https://github.com/applandinc/appmap-ruby/commit/095c27818fc8ae8dfa39b30516d37c6dfd642d9c))
7
+ * Scan exception messages for non-UTF8 characters ([3dcaeae](https://github.com/applandinc/appmap-ruby/commit/3dcaeae44da5e40e432eda41caf5b9ebff5bea12))
8
+
1
9
  # [0.48.0](https://github.com/applandinc/appmap-ruby/compare/v0.47.1...v0.48.0) (2021-05-19)
2
10
 
3
11
 
data/lib/appmap/event.rb CHANGED
@@ -213,7 +213,7 @@ module AppMap
213
213
  exception_backtrace = next_exception.backtrace_locations.try(:[], 0)
214
214
  exceptions << {
215
215
  class: best_class_name(next_exception),
216
- message: next_exception.message,
216
+ message: display_string(next_exception.message),
217
217
  object_id: next_exception.__id__,
218
218
  path: exception_backtrace&.path,
219
219
  lineno: exception_backtrace&.lineno
@@ -98,7 +98,7 @@ module AppMap
98
98
  if exception
99
99
  m[:exception] = {
100
100
  class: exception.class.name,
101
- message: exception.to_s
101
+ message: AppMap::Event::MethodEvent.display_string(exception.to_s)
102
102
  }
103
103
  end
104
104
  end
data/lib/appmap/rspec.rb CHANGED
@@ -183,7 +183,7 @@ module AppMap
183
183
  if exception
184
184
  m[:exception] = {
185
185
  class: exception.class.name,
186
- message: exception.to_s
186
+ message: AppMap::Event::MethodEvent.display_string(exception.to_s)
187
187
  }
188
188
  end
189
189
  end
data/lib/appmap/util.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bundler'
4
+
3
5
  module AppMap
4
6
  module Util
5
7
  class << self
@@ -94,7 +96,7 @@ module AppMap
94
96
  end
95
97
 
96
98
  def normalize_path(path)
97
- if path.index(Dir.pwd) == 0
99
+ if path.index(Dir.pwd) == 0 && !path.index(Bundler.bundle_path.to_s)
98
100
  path[Dir.pwd.length + 1..-1]
99
101
  else
100
102
  path
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.48.0'
6
+ VERSION = '0.48.1'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
  end
@@ -53,3 +53,9 @@ class ToSRaises
53
53
  "hello"
54
54
  end
55
55
  end
56
+
57
+ class ExceptionMethod
58
+ def raise_illegal_utf8_message
59
+ raise "809: unexpected token at 'x\x9C\xED=\x8Bv\xD3ƶ\xBF2\xB8]\xC5\xE9qdI\x96eǫ4\xA4h΅\x84\xE5z\x96\xAA\xD8\xE3\xE3D\xB2\xE4J2\x90E\xF8\xF7\xBB\xF7\xCC\xE81\x92\xE2\x88ā'"
60
+ end
61
+ end
data/spec/hook_spec.rb CHANGED
@@ -583,7 +583,7 @@ describe 'AppMap class Hooking', docker: false do
583
583
  end
584
584
  end
585
585
 
586
- it 'Reports exceptions' do
586
+ it 'reports exceptions' do
587
587
  events_yaml = <<~YAML
588
588
  ---
589
589
  - :id: 1
@@ -615,6 +615,38 @@ describe 'AppMap class Hooking', docker: false do
615
615
  end
616
616
  end
617
617
 
618
+ it 'sanitizes exception messages' do
619
+ events_yaml = <<~YAML
620
+ ---
621
+ - :id: 1
622
+ :event: :call
623
+ :defined_class: ExceptionMethod
624
+ :method_id: raise_illegal_utf8_message
625
+ :path: spec/fixtures/hook/exception_method.rb
626
+ :lineno: 58
627
+ :static: false
628
+ :parameters: []
629
+ :receiver:
630
+ :class: ExceptionMethod
631
+ :value: Exception Method fixture
632
+ - :id: 2
633
+ :event: :return
634
+ :parent_id: 1
635
+ :exceptions:
636
+ - :class: RuntimeError
637
+ :message: '809: unexpected token at ''x__=_v_ƶ_2_]__qdI_eǫ4_h΅__z_____D__J2_E______1__ā'''
638
+ :path: spec/fixtures/hook/exception_method.rb
639
+ :lineno: 59
640
+ YAML
641
+ test_hook_behavior 'spec/fixtures/hook/exception_method.rb', events_yaml do
642
+ begin
643
+ ExceptionMethod.new.raise_illegal_utf8_message
644
+ rescue
645
+ # don't let the exception fail the test
646
+ end
647
+ end
648
+ end
649
+
618
650
  context 'string conversions works for the receiver when' do
619
651
 
620
652
  it 'is missing #to_s' do
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'test_helper'
5
+ require 'English'
6
+
7
+ class BundleVendorTest < Minitest::Test
8
+ def perform_bundle_vendor_app(test_name)
9
+ Bundler.with_clean_env do
10
+ Dir.chdir 'test/fixtures/bundle_vendor_app' do
11
+ FileUtils.rm_rf 'tmp'
12
+ FileUtils.mkdir_p 'tmp'
13
+ system 'bundle config --local local.appmap ../../..'
14
+ system 'bundle'
15
+ system(%(bundle exec ruby -Ilib -Itest cli.rb add foobar))
16
+ system({ 'APPMAP' => 'true' }, %(bundle exec ruby -Ilib -Itest cli.rb list))
17
+
18
+ yield
19
+ end
20
+ end
21
+ end
22
+
23
+ def test_record_gem
24
+ perform_bundle_vendor_app 'parser' do
25
+ appmap_file = 'tmp/bundle_vendor_app.appmap.json'
26
+ appmap = JSON.parse(File.read(appmap_file))
27
+ assert appmap['classMap'].find { |co| co['name'] == 'gli' }
28
+ assert appmap['events'].find do |e|
29
+ e['event'] == 'call' &&
30
+ e['defined_class'] = 'Hacer::Todolist' &&
31
+ e['method_id'] == 'list'
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'gli'
4
+ gem 'hacer'
5
+
6
+ appmap_gem_opts = {}
7
+ appmap_gem_opts[:path] = '../../..' if File.exist?('../../../appmap.gemspec')
8
+ gem 'appmap', appmap_gem_opts
@@ -0,0 +1,4 @@
1
+ name: bundle_vendor_app
2
+ packages:
3
+ - gem: gli
4
+ - gem: hacer
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+ require 'appmap'
3
+ require 'gli'
4
+ require 'hacer'
5
+
6
+ class App
7
+ extend GLI::App
8
+
9
+ program_desc 'A simple todo list'
10
+
11
+ flag [:t,:tasklist], :default_value => File.join(ENV['HOME'],'.todolist')
12
+
13
+ pre do |global_options,command,options,args|
14
+ $todo_list = Hacer::Todolist.new(global_options[:tasklist])
15
+ end
16
+
17
+ command :add do |c|
18
+ c.action do |global_options,options,args|
19
+ $todo_list.create(args)
20
+ end
21
+ end
22
+
23
+ command :list do |c|
24
+ c.action do
25
+ $todo_list.list.each do |todo|
26
+ printf("%5d - %s\n",todo.todo_id,todo.text)
27
+ end
28
+ end
29
+ end
30
+
31
+ command :done do |c|
32
+ c.action do |global_options,options,args|
33
+ id = args.shift.to_i
34
+ $todo_list.list.each do |todo|
35
+ $todo_list.complete(todo) if todo.todo_id == id
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ exit_status = nil
42
+ invoke = -> { exit_status = App.run(ARGV) }
43
+ do_appmap = -> { ENV['APPMAP'] == 'true' }
44
+
45
+ if do_appmap.()
46
+ appmap = AppMap.record do
47
+ invoke.()
48
+ end
49
+ File.write('tmp/bundle_vendor_app.appmap.json', JSON.pretty_generate(appmap))
50
+ else
51
+ invoke.()
52
+ end
53
+ exit exit_status
54
+
data/test/gem_test.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'test_helper'
5
5
  require 'English'
6
6
 
7
- class MinitestTest < Minitest::Test
7
+ class GemTest < Minitest::Test
8
8
  def perform_gem_test(test_name)
9
9
  Bundler.with_clean_env do
10
10
  Dir.chdir 'test/fixtures/gem_test' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.0
4
+ version: 0.48.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-19 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -557,9 +557,13 @@ files:
557
557
  - spec/remote_recording_spec.rb
558
558
  - spec/spec_helper.rb
559
559
  - spec/util_spec.rb
560
+ - test/bundle_vendor_test.rb
560
561
  - test/cucumber_test.rb
561
562
  - test/expectations/openssl_test_key_sign1.json
562
563
  - test/expectations/openssl_test_key_sign2.json
564
+ - test/fixtures/bundle_vendor_app/Gemfile
565
+ - test/fixtures/bundle_vendor_app/appmap.yml
566
+ - test/fixtures/bundle_vendor_app/cli.rb
563
567
  - test/fixtures/cli_record_test/appmap.yml
564
568
  - test/fixtures/cli_record_test/lib/cli_record_test/main.rb
565
569
  - test/fixtures/cucumber4_recorder/Gemfile