#726540 zip: "zip - file >> out" creates broken archive

Package:
zip
Source:
zip
Description:
Archiver for .zip files
Submitter:
Aleksey Morarash
Date:
2013-10-16 16:30:08 UTC
Severity:
normal
#726540#5
Date:
2013-10-16 15:20:28 UTC
From:
To:
Dear Maintainer,

A have encountered that zip fails to write correct archive to
a pipe when its opened with O_APPEND option.

For example, this will create broken archive:

$ zip - file >> outfile

When this one works as planned:

$ zip - file | cat >> outfile

I found that zip makes lseeks while writing the archive file, but
it doesn't change its behavior while writing to the file opened with
the O_APPEND option.

#726540#10
Date:
2013-10-16 15:37:30 UTC
From:
To:
El 16/10/13 17:20, Aleksey Morarash escribió:

Are you trying to create a self extracting executable with unzipsfx?

#726540#15
Date:
2013-10-16 15:47:37 UTC
From:
To:
No, just packaging Erlang applications into zipped Erlang script
executable.

Its format can be described in next shell-script:

( echo '#!/usr/bin/env escript'
  echo '%%!-smp'
  zip -j - ebin/*; ) > target
chmod 755 target

But it works only when I add "| cat" after zip invocation:

( echo '#!/usr/bin/env escript'
  echo '%%!-smp'
  zip -j - ebin/* | cat; ) > target
chmod 755 target

#726540#20
Date:
2013-10-16 16:24:23 UTC
From:
To:
El 16/10/13 17:47, Aleksey Morarash escribió:

Ok, not a self-extracting executable, but something very similar,
something that anybody would think that it should work.

Fine, I've forwarded this upstream:

http://www.info-zip.org/phpBB3/viewtopic.php?f=6&t=422