pts / sam2p

raster (bitmap) image converter with smart PDF and PostScript (EPS) output
http://pts.50.hu/sam2p/
GNU General Public License v2.0
42 stars 15 forks source link

Some versions of tar cannot extract sam2p-0.49.4.tar.gz #47

Closed dag-erling closed 5 years ago

dag-erling commented 5 years ago

The source tarball for 0.49.4 contains conflicting entries and self-referential links:

% tar xf /usr/ports/distfiles/sam2p-0.49.4.tar.gz      
sam2p-0.49.4/vcsam2p.ico: Can't create 'sam2p-0.49.4/vcsam2p.ico'
sam2p-0.49.4/in_pnm.cpp: Can't create 'sam2p-0.49.4/in_pnm.cpp'
sam2p-0.49.4/in_xpm.cpp: Can't create 'sam2p-0.49.4/in_xpm.cpp'
sam2p-0.49.4/in_tga.cpp: Can't create 'sam2p-0.49.4/in_tga.cpp'
sam2p-0.49.4/sam2p_main.cpp: Can't create 'sam2p-0.49.4/sam2p_main.cpp'
sam2p-0.49.4/pts_defl.c: Can't create 'sam2p-0.49.4/pts_defl.c'
sam2p-0.49.4/pts_defl.h: Can't create 'sam2p-0.49.4/pts_defl.h'
sam2p-0.49.4/in_jai.cpp: Can't create 'sam2p-0.49.4/in_jai.cpp'
sam2p-0.49.4/out_gif.cpp: Can't create 'sam2p-0.49.4/out_gif.cpp'
tar: Error exit delayed from previous errors.
% tar tvf /usr/ports/distfiles/sam2p-0.49.4.tar.gz | grep vcsam2p.ico 
-rw-r-----  0 pts    eng      1078 11 Dec  2013 sam2p-0.49.4/vcsam2p.ico
hrw-r-----  0 pts    eng         0 11 Dec  2013 sam2p-0.49.4/vcsam2p.ico link to sam2p-0.49.4/vcsam2p.ico
% tar tf /usr/ports/distfiles/sam2p-0.49.4.tar.gz | sort | uniq -d         
sam2p-0.49.4/in_jai.cpp
sam2p-0.49.4/in_pnm.cpp
sam2p-0.49.4/in_tga.cpp
sam2p-0.49.4/in_xpm.cpp
sam2p-0.49.4/out_gif.cpp
sam2p-0.49.4/pts_defl.c
sam2p-0.49.4/pts_defl.h
sam2p-0.49.4/sam2p_main.cpp
sam2p-0.49.4/vcsam2p.ico

The tarball for 0.49.3 also contains multiple entries for some files, but with the same type, so they are silently overwritten:

% tar tvf /usr/ports/distfiles/sam2p-0.49.3.tar.gz | grep vcsam2p.ico
-rw-r--r--  0 pts    pts      1078  3 Sep  2013 sam2p-0.49.3/vcsam2p.ico
-rw-r--r--  0 pts    pts      1078  3 Sep  2013 sam2p-0.49.3/vcsam2p.ico

Could you please re-roll it?

pts commented 5 years ago

Thank you for reporting this!

I'm not able to reproduce the errors you are experiencing. The .tar.gz files were created with GNU tar (tar czvf ....tar.gz ...), please use GNU tar to extract them to avoid errors.

$ wget -qO sam2p-0.49.4.tar.gz https://github.com/pts/sam2p/releases/download/v0.49.4/sam2p-0.49.4.tar.gz
$ sha256sum sam2p-0.49.4.tar.gz
d23707b2405ca94e2a237cb81f62fb5916f5e4360cf9a705061479c8fa1dff5c  sam2p-0.49.4.tar.gz
$ tar tzf sam2p-0.49.4.tar.gz
(empty output)
$ tar xzf sam2p-0.49.4.tar.gz
(empty output)
$ tar tzvf sam2p-0.49.4.tar.gz | grep vcsam2p.ico 
-rw-r----- pts/eng        1078 2013-12-11 17:52 sam2p-0.49.4/vcsam2p.ico
hrw-r----- pts/eng           0 2013-12-11 17:52 sam2p-0.49.4/vcsam2p.ico link to sam2p-0.49.4/vcsam2p.ico
$ tar --version
tar (GNU tar) 1.30
(...)

Extraction also works for me with earlier versions of GNU tar (1.29 and earlier) and also with busybox tar, BusyBox v1.21.1.

What else should sam2p change to make it easier to extract archives?

dag-erling commented 5 years ago

I'm not able to reproduce the errors you are experiencing.

And yet your tar tzvf output confirms the presence of a link which shouldn't be there. You should only get a single line for each file. The fact that GNU tar doesn't complain when extracting it doesn't mean it's correct.

I tried to run make dist myself in an attempt to figure out why this happens, but ran into other issues, such as trying to create a tarball without specifying a filename. If you want to output the tarball to standard output, use -cf-. The normal behavior of tar when no filename is specified is to attempt to write to a tape drive (either $TAPE or a hardcoded default, probably /dev/sr0 on Linux). This is clearly stated in the documentation.

What else should sam2p change to make it easier to extract archives?

Ideally, switch to 100% autotools and use make dist to generate tarballs, instead of a highly idiosyncratic process of your own design.

pts commented 5 years ago

Thank you for the feedback and the insights!

I've filed separate issue https://github.com/pts/sam2p/issues/48 about the vcsam2p.ico symlink.

switch to 100% autotools and use make dist to generate tarballs

Thank you for the recommendation! This is not going to happen soon, because I don't want sam2p to depend on autotools (except for autoconf). For me software maintenance and compilation has been harder, more confusing and slower with autotools than without it.

I'm closing this issue now. I'll reopen it as soon as I get more input and I'm able to reproduce the extraction errors either with GNU tar or busybox tar.

dag-erling commented 5 years ago

I found the bug. Each of these files is listed twice in files:

% sort files | uniq -cd  
      2 in_jai.cpp
      2 in_pnm.cpp
      2 in_tga.cpp
      2 in_xpm.cpp
      2 out_gif.cpp
      2 pts_defl.c
      2 pts_defl.h
      2 sam2p_main.cpp
      2 vcsam2p.ico