Skip to content

Fails to read a bz2 file #373

@frodrigo

Description

@frodrigo

Test with the master branch of this repo, on Linux (Archlinux).

I got an error reading an osc.xml.bz2. The osc.xml.bz2 was produced by Osmosis. The bz2 file looks good. I have no issue to uncompress it with libbz2.so.1.0.
Uncompress test with binary bzcat/bzip2 command and libosmium linked to the same libbz2.so.1.0 binary from system.
It is not the first time I got this issue. But it is exceptional, most of the time it is OK with bz2 from Osmosis.

$ ./examples/osmium_count /tmp/diff.osc.xml.bz2
bzip2 error: read failed: -7
echo $?
1
$ bzcat /tmp/diff.osc.xml.bz2
<?xml version='1.0' encoding='UTF-8'?>
<osmChange version="0.6" generator="Osmosis 0.48.3">
  <delete>
...
  </delete>
</osmChange>
$ echo $?
0

If I recompress the bz2 it is ok.

I try to debug and found here feof(m_file.file()) is 0, but 1 recompressed file.

https://github.com/osmcode/libosmium/blob/master/include/osmium/io/bzip2_compression.hpp#L299

Attached original file into a zip (Github does not allow bz2 file).

diff.osc.xml.bz2.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions