Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • aports aports
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 720
    • Issues 720
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 326
    • Merge requests 326
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpine
  • aportsaports
  • Issues
  • #8602
Closed
Open
Created Mar 03, 2018 by algitbot@rootOwner

zipnote crashes when updating filename in a zip file

Trying to use zipnote to change a filename in a zip file results in a segfault, for e.g.

$ touch a.txt
$ zip files.zip a.txt
  adding: a.txt (stored 0%)
$ printf "@ a.txt\n@=b.txt\n" | zipnote -w files.zip
zipnote error: Bad file descriptor
zipnote error: Temporary file failure (ziPHFCbk)

zipnote error: Interrupted (aborting)
Segmentation fault (core dumped)

Apparently this is an old bug in zip 3.0 which was only fixed in an unreleased 3.1b version (according to https://www.linuxquestions.org/questions/slackware-14/request-slackware-info-zip-zipnote-be-patched-to-support-writing-back-comments-4175502665/). However, the fix has been applied on other Linux distros (e.g. https://bugs.archlinux.org/task/47713 and https://bugzilla.redhat.com/show\_bug.cgi?id=1179420)

I tried the same patch on alpine 3.7 and fixed the issue.


$ apk add build-base  
$ wget ftp://ftp.info-zip.org/pub/infozip/src/zip30.zip  
$ unzip zip30.zip  
$ cd zip30  
$ cat ../zipnote.patch  
a/zipnote.c b/zipnote.c  
index 5e02cb6..996f012 100644  
—- a/zipnote.c  
+ b/zipnote.c  
@@ –661,7 +661,7 @@ char \***argv; /** command line tokens \*/  
if ((r = zipcopy(z)) != ZE\_OK)  
ziperr(r, “was copying an entry”);  
}  
- fclose(x);  
+ fclose(in\_file);

/\* Write central directory and end of central directory with new
comments \*/  
if ((c = zftello(y)) == (zoff\_t)–1) /\* get start of central \*/

$ patch -p1 < ../zipnote.patch  
$ make -f unix/Makefile generic  
$ printf “@ a.txt\\n@=b.txt\\n” | zip30/zipnote -w files.zip  
$ unzip -l files.zip  
Archive: files.zip  
Length Date Time Name  
————- ————— ——- ——  
0 03-03-2018 04:17 b.txt  
———— ———-  
0 1 files


*(from redmine: issue id 8602, created on 2018-03-03)*
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking