rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

Bear causes unxz to fail when unpacking a .tar.xz #444

Open moyix opened 2 years ago

moyix commented 2 years ago

Describe the bug

For reasons I can't quite figure out, bear causes tar (or more specifically, the unxz process it launches) to fail when unpacking the following .tar.xz file: https://moyix.net/~moyix/qemu_6.2+dfsg.orig.tar.xz

To Reproduce

With the latest bear from git:

moyix@isabella:/fastdata$ tar tf qemu_6.2+dfsg.orig.tar.xz > /dev/null # Succeeds
moyix@isabella:/fastdata$ bear -- tar tf qemu_6.2+dfsg.orig.tar.xz > /dev/null # Fails
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Expected behavior

The tar command should run successfully under bear.

Environment:

Additional context

Before you send...

moyix commented 2 years ago

Note that the (somewhat ancient) version of bear in Ubuntu 20.04 does work fine here:

moyix@isabella:/fastdata$ bear --version
bear 2.4.3
moyix@isabella:/fastdata$ bear tar tf qemu_6.2+dfsg.orig.tar.xz > /dev/null # Succeeds
moyix@isabella:/fastdata$
rizsotto commented 2 years ago

Thanks @moyix , this is a good catch!

The new version of Bear is spawning a supervisor process for each process execution. The old version was just record the execution attempt and executed the requested process. The new approach allow us to capture the exit codes, or emit other metrics about the execution... But it probably has a bug about the standard input/output redirection.

I've run a few tests now, with bzip2 it works just fine. Will need some time to find fix for this bug. :smile: