LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-06-2018, 03:56 PM   #1
NonNonBa
Member
 
Registered: Aug 2010
Distribution: Slackware
Posts: 104

Rep: Reputation: Disabled
[PATCH] tar issuing a SIGPIPE in installpkg


Hi,

Quote:
Thu Sep 6 06:15:46 UTC 2018
[]
a/pkgtools-15.0-noarch-22.txz: Rebuilt.
installpkg: prevent noise from the "stray cat" if tar hands it a broken
pipe. Thanks to ivandi.
Also (in the comments) provide a possibly better but untested solution.
Thanks to SeB.
I've investigated a bit further, and I think I've found the problem.

First I've built the tar from the -current source with and without the "nolonezero" patch, then I used the debug.sh script below to compare their respective behavior:

Code:
result=./RESULT
for i in patched unpatched; do
    # WARNING: the tar-patched and tar-unpatched binaries must be in
    #          the current working directory.
    find "$@" -name '*.txz' | while read pkg; do
        hi=32
        ( xz -dc "$pkg"; echo $? >$result ) | ./tar-$i tf - >/dev/null
        read r <$result
        [ $r -eq 0 ] || hi=31
        printf '\033[0;'$hi'm%s \033[0;0m [code=%s tar=%s]\n' ${pkg##*/} $r $i
    done
done
rm $result
Here is the result when applied to the a/ and ap/ -current series:

Code:
$ bash debug.sh /path/to/the/package/tree
lvm2-2.02.177-x86_64-1.txz  [code=0 tar=patched]
[]
mkinitrd-1.4.11-x86_64-8.txz  [code=141 tar=patched]
unarj-265-x86_64-2.txz  [code=0 tar=patched]
[]
kmod-25-x86_64-2.txz  [code=141 tar=patched]
elilo-3.16-x86_64-7.txz  [code=0 tar=patched]
[]
minicom-2.7.1-x86_64-2.txz  [code=141 tar=patched]
dbus-1.12.10-x86_64-1.txz  [code=0 tar=patched]
[]
quota-4.03-x86_64-2.txz  [code=141 tar=patched]
kernel-firmware-20180904_85c5d90-noarch-1.txz  [code=0 tar=patched]
[]
texinfo-6.5-x86_64-6.txz  [code=141 tar=patched]
linuxdoc-tools-0.9.72-x86_64-5.txz  [code=0 tar=patched]
[]
cups-filters-1.21.2-x86_64-1.txz  [code=141 tar=patched]
xorriso-1.4.8-x86_64-2.txz  [code=141 tar=patched]
acct-6.6.4-x86_64-2.txz  [code=0 tar=patched]
[]
cdparanoia-III_10.2-x86_64-2.txz  [code=141 tar=patched]
[]
diffutils-3.6-x86_64-2.txz  [code=0 tar=patched]
lvm2-2.02.177-x86_64-1.txz  [code=0 tar=unpatched]
devs-2.3.1-noarch-25.txz  [code=0 tar=unpatched]
sharutils-4.15.2-x86_64-2.txz  [code=0 tar=unpatched]
kernel-generic-4.14.68-x86_64-1.txz  [code=0 tar=unpatched]
[]
diffutils-3.6-x86_64-2.txz  [code=0 tar=unpatched]
Only the patched tar has issues (causes cat to get a SIGPIPE, "code=141") with some packages (but always the same).

I use -stable, that's why I bother you with all the testing process, in case someone wants to reproduce it on the complete package tree. Applied to my -stable local tree, I've no SIGPIPE issue but the unpatched tar complains about "lone zero blocks" in some packages.

This amended version of the mentioned patch seems to make everyone happy everywhere in every regard:

Code:
--- tar-1.30.orig/src/list.c	2017-12-16 22:23:12.000000000 +0100
+++ tar-1.30/src/list.c	2018-09-06 22:31:21.302045405 +0200
@@ -242,15 +242,22 @@
 
 	  if (!ignore_zeros_option)
 	    {
-	      char buf[UINTMAX_STRSIZE_BOUND];
+
+	      /* 
+	       * According to POSIX tar specs, this is wrong, but on the web
+	       * there are some tar specs that can trigger this, and some tar
+	       * implementations create tars according to that spec.  For now,
+	       * let's not be pedantic about issuing the warning.
+	       *
+	       * char buf[UINTMAX_STRSIZE_BOUND]; */
 
 	      status = read_header (&current_header, &current_stat_info,
 	                            read_header_auto);
-	      if (status == HEADER_ZERO_BLOCK)
-		break;
-	      WARNOPT (WARN_ALONE_ZERO_BLOCK,
-		       (0, 0, _("A lone zero block at %s"),
-			STRINGIFY_BIGINT (current_block_ordinal (), buf)));
+	   /* if (status == HEADER_ZERO_BLOCK)
+		*     break;
+	    * WARNOPT (WARN_ALONE_ZERO_BLOCK,
+		*      (0, 0, _("A lone zero block at %s"),
+		*        STRINGIFY_BIGINT (current_block_ordinal (), buf)));  */
 	      break;
 	    }
 	  status = prev_status;
 
Old 09-07-2018, 10:25 AM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,950

Rep: Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646
This is now fixed in -current. Great job!

Code:
Thu Sep 6 23:22:45 UTC 2018
a/pkgtools-15.0-noarch-23.txz: Rebuilt.
       Removed stray cat and loop kludges for lack of reported size, since this
       is fixed now in tar.
a/tar-1.30-x86_64-3.txz: Rebuilt.
       Fixed a bug in the nolonezero patch that was evidently causing all of the
       issues in installpkg that we'd been kludging around (e.g. the "stray cat").
       Thanks *very* much to NonNonBa for the patch, and to SeB for the initial
       analysis of the problem.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[PATCH 1/1] installpkg: make TERSE aware Xsane Slackware 2 06-30-2018 09:41 PM
gzip/tar Bug In installpkg lopid Slackware 12 10-04-2009 10:00 AM
Installpkg ignoring tar-1.13; throwing up warning while installing packages corbis_demon Slackware 2 09-07-2009 03:44 AM
installing Slackware 12.0 and installpkg incorrectly report corrupted tar archive randyepperson Slackware - Installation 6 10-14-2007 05:14 AM
Using Installpkg on a *.tar.gz file flowersrj Slackware - Installation 2 11-29-2006 07:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration