On Thu, Feb 02, 2017 at 07:20:34PM +0100, willy wrote: > Hello everyone, > > While playing with sbase and musl, I encountered a strange bug: tar > fails to extract bzip2 compressed archives when bzip2 is compiled > against musl (I only tested static linking). Note that bzip2 uncompresses > the files correctly. The error only occurs when the data flows through > a pipe: >
If an error occurs only when a pipe is involved, then in principle only two things could go wrong: bzip2 could be failing to handle short writes correctly or tar could be failing to handle short reads correctly. If it was the latter then I'd expect to see weird behavior regarding blocks and the start thereof. Like, for instance: > chktar: invalid magic "ootfs, datadir, *argv); > if (action == ACTION_UPDATE) > r += update(rootfs, datadir, *argv); > if (action == ACTION_DELETE) > r += delete(rootfs, datadir, *argv); > argv++; > } > break; > case ACTION_INSPECT: > if (inspect(datadir, n) != 0) > retu" > musl/tar: malformed tar archive > If it was the former, then I'd expect similar behavior, however not exactly like this. If bzip was failing to notice that some decompressed data isn't written, tar would be seeing start blocks too late, not too early, as it does here. So, looks like a tar bug. Ciao, Markus