[Bug 1892338] Re: zip --symlink is incompatible with piped output
Launchpad Bug Tracker
1892338 at bugs.launchpad.net
Thu Aug 20 09:31:14 UTC 2020
Status changed to 'Confirmed' because the bug affects multiple users.
** Changed in: zip (Ubuntu)
Status: New => Confirmed
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zip in Ubuntu.
https://bugs.launchpad.net/bugs/1892338
Title:
zip --symlink is incompatible with piped output
Status in zip package in Ubuntu:
Confirmed
Bug description:
Hi folks,
As in the summary, if you use --symlink (-y) with the output piped to
a process, it stops building the zip on the first symlink it
encounters with an unhelpful error (as the user is not using -0
intentionally).
Here's the simplest test case I can build:
root at test123:~/test# mkdir asdf
root at test123:~/test# ln -s asdf test
root at test123:~/test# date > hello.txt
root at test123:~/test# ls -l
total 2
drwxr-xr-x 2 root root 4 Aug 20 09:10 asdf
-rw-r--r-- 1 root root 29 Aug 20 08:50 hello.txt
lrwxrwxrwx 1 root root 4 Aug 20 08:24 test -> asdf
root at test123:~/test# zip -1ryv - . | cat > ../test.zip
adding: test
zip error: Invalid command arguments (zip -0 not supported for I/O on pipes or devices)
66.0 B 0:00:00 [93.4KiB/s] [<=> ]
I believe the issue is around line 575 of zipup.c... my understanding
of the code is tenuous at best, but I think q is not reset when m is
set to STORE:
l = issymlnk(a);
if (l) {
ifile = fbad;
m = STORE;
}
else if (isdir) { /* directory */
ifile = fbad;
m = STORE;
q = 0;
}
If I build with q = 0; in the if (l) block too, it appears to work (it
complains that the file size changed while zipping, but zip does not
error out, the zip file is created correctly), but I don't know what
other problems this would introduce.
Not sure if anyone's maintaining this package so I don't want to put
too much effort into it, I'll have a go at attaching a patch which I
think fixes the issue, but again I'm not sure if it causes any new
issues (and one probably wants to fix the warning about the file size
changing at the very least).
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zip/+bug/1892338/+subscriptions
More information about the foundations-bugs
mailing list