Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPX import: wrong argument type Integer (expected String) #3008

Closed
richlv opened this issue Dec 16, 2020 · 9 comments
Closed

GPX import: wrong argument type Integer (expected String) #3008

richlv opened this issue Dec 16, 2020 · 9 comments

Comments

@richlv
Copy link

richlv commented Dec 16, 2020

Attempted to upload a tar.bz2 file, got this trace:

 It looks like your GPX file traces_2013_2016.tar.bz2 with the description Unsorted traces, 2013-2016 and no tags failed to import. Here is the error:

    wrong argument type Integer (expected String) /srv/www.openstreetmap.org/rails/lib/gpx.rb:48:in `string' /srv/www.openstreetmap.org/rails/lib/gpx.rb:48:in `block in points' /var/lib/gems/2.7.0/gems/ffi-libarchive-1.0.4/lib/ffi-libarchive/reader.rb:133:in `each_entry_with_data' /srv/www.openstreetmap.org/rails/lib/gpx.rb:47:in `points' /srv/www.openstreetmap.org/rails/app/models/trace.rb:253:in `each' /srv/www.openstreetmap.org/rails/app/models/trace.rb:253:in `each_slice' /srv/www.openstreetmap.org/rails/app/models/trace.rb:253:in `import' /srv/www.openstreetmap.org/rails/app/jobs/trace_importer_job.rb:5:in `perform' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/execution.rb:40:in `block in perform_now' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:112:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/i18n-1.8.5/lib/i18n.rb:313:in `with_locale' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `instance_exec' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/zones.rb:66:in `use_zone' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `instance_exec' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/logging.rb:25:in `block (4 levels) in <module:Logging>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `block in instrument' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in `instrument' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/logging.rb:24:in `block (3 levels) in <module:Logging>' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/logging.rb:45:in `block in tag_logger' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:80:in `block in tagged' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:28:in `tagged' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:80:in `tagged' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/logging.rb:45:in `tag_logger' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/logging.rb:21:in `block (2 levels) in <module:Logging>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `instance_exec' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:139:in `run_callbacks' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/execution.rb:39:in `perform_now' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/execution.rb:25:in `block in execute' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:112:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/railtie.rb:43:in `block (4 levels) in <class:Railtie>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/execution_wrapper.rb:88:in `wrap' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/reloader.rb:72:in `block in wrap' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/execution_wrapper.rb:88:in `wrap' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/reloader.rb:71:in `wrap' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/railtie.rb:42:in `block (3 levels) in <class:Railtie>' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `instance_exec' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks' /var/lib/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:139:in `run_callbacks' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/execution.rb:23:in `execute' /var/lib/gems/2.7.0/gems/activejob-6.0.3.4/lib/active_job/queue_adapters/delayed_job_adapter.rb:42:in `perform' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/backend/base.rb:81:in `block in invoke_job' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:61:in `block in initialize' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:66:in `execute' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:40:in `run_callbacks' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/backend/base.rb:78:in `invoke_job' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:230:in `block (2 levels) in run' /usr/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout' /usr/lib/ruby/2.7.0/timeout.rb:105:in `timeout' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:230:in `block in run' /usr/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:229:in `run' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:312:in `block in reserve_and_run_one_job' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:61:in `block in initialize' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:66:in `execute' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:40:in `run_callbacks' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:312:in `reserve_and_run_one_job' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:213:in `block in work_off' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:212:in `times' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:212:in `work_off' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:175:in `block (4 levels) in start' /usr/lib/ruby/2.7.0/benchmark.rb:308:in `realtime' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:174:in `block (3 levels) in start' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:61:in `block in initialize' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:66:in `execute' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:40:in `run_callbacks' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:173:in `block (2 levels) in start' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:172:in `loop' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:172:in `block in start' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:61:in `block in initialize' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:79:in `block in add' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:66:in `execute' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/lifecycle.rb:40:in `run_callbacks' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/worker.rb:171:in `start' /var/lib/gems/2.7.0/gems/delayed_job-4.1.9/lib/delayed/tasks.rb:9:in `block (2 levels) in <main>' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:281:in `each' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:116:in `each' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:83:in `block in run' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling' /usr/share/rubygems-integration/all/gems/rake-13.0.1/lib/rake/application.rb:80:in `run' /usr/share/rubygems-integration/all/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' /usr/bin/rake:23:in `load' /usr/bin/rake:23:in `<main>' 
@richlv
Copy link
Author

richlv commented Dec 16, 2020

This actually happens for a tar.gz as well.

@richlv
Copy link
Author

richlv commented Dec 16, 2020

File type was not the reason - this was caused by directories inside the archive. In this case, I had GPX files in directories per day.

@tomhughes
Copy link
Member

What are the names of the files in the archive?

@richlv
Copy link
Author

richlv commented Dec 16, 2020

Thanks, what will happen with directories in archives - will the GPX files be imported recurivsely?

@richlv
Copy link
Author

richlv commented Dec 16, 2020

...ah, the commit comment says "Ignore GPX archive entries that aren't regular files".

@tomhughes
Copy link
Member

Yes in an archive you tend to get an entry for the directory, which has no data, and then an entry for each file in the directory.

A slightly bizarre feature of the libarchive bindings we're using is that if there is no data for an entry they return the length instead (which is always zero obviously) which led to the error about an integer when a string is expected.

@richlv
Copy link
Author

richlv commented Dec 16, 2020

Oh, so it actually would go and import all GPX files recursively now?

@tomhughes
Copy link
Member

Yes, it just ignores the actual directory but still processes all the files. Hopefully at any rate.

@richlv
Copy link
Author

richlv commented Dec 16, 2020

That's wonderful, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants