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

Diff command crashes if second input file has no timestamp #90

Closed
Nakaner opened this issue Mar 9, 2018 · 2 comments
Closed

Diff command crashes if second input file has no timestamp #90

Nakaner opened this issue Mar 9, 2018 · 2 comments

Comments

@Nakaner
Copy link
Contributor

Nakaner commented Mar 9, 2018

build/osmium diff --output-format opl test/diff/input1.osm test/diff/input2-only-version.osm crashes because an assertion fails:

osmium: /home/michael/git/libosmium/include/osmium/io/input_iterator.hpp:129: 
osmium::io::InputIterator<TSource, TItem>::value_type* 
osmium::io::InputIterator<TSource, TItem>::operator->() const 
[with TSource = osmium::io::ReaderWithProgressBar; TItem = osmium::OSMObject; 
osmium::io::InputIterator<TSource, TItem>::pointer = osmium::OSMObject*; 
osmium::io::InputIterator<TSource, TItem>::value_type = osmium::OSMObject]: 
Assertion `m_iter' failed.

The input file test/diff/input2-only-version.osm has following content:

<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="test">
  <node id="10" version="1" lat="1" lon="1"/>
  <node id="11" version="2" lat="2" lon="2"/>
  <node id="12" version="1" lat="3" lon="1"/>
  <node id="14" version="1" lat="5" lon="1"/>
  <node id="15" version="1" lat="5" lon="1"/>
  <node id="16" version="1" lat="5" lon="1"/>
  <way id="20" version="1">
    <nd ref="10"/>
    <nd ref="11"/>
    <nd ref="12"/>
    <tag k="foo" v="bar"/>
  </way>
  <way id="21" version="2">
    <nd ref="12"/>
    <nd ref="14"/>
    <tag k="xyz" v="new"/>
  </way>
  <relation id="30" version="1">
    <member type="node" ref="12" role="m1"/>
    <member type="way" ref="20" role="m2"/>
  </relation>
</osm>

Reason: The comparison *it2 < *it1 at line 274 is the problem because iterator it2 has already reached the end (i.e. it2 == end2 would return true).

Using a different comparator ignoring the timestamp as done in my attempt to make the derive-changes command work with missing timestamps does not help.

joto added a commit that referenced this issue Mar 10, 2018
@joto
Copy link
Member

joto commented Mar 10, 2018

I think I just fixed this. Can you verify?

@Nakaner
Copy link
Contributor Author

Nakaner commented Mar 14, 2018

It works. I will submit it as a unit test in a pull request.

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

No branches or pull requests

2 participants