bin/118782: shar(1) sometimes creates broken archives

Jaakko Heinonen jh at saunalahti.fi
Mon Mar 31 08:20:02 PDT 2008


The following reply was made to PR bin/118782; it has been noted by GNATS.

From: Jaakko Heinonen <jh at saunalahti.fi>
To: bkoenig at alpha-tierchen.de
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/118782: shar(1) sometimes creates broken archives
Date: Mon, 31 Mar 2008 18:10:24 +0300

 --zYM0uCDKw75PZbzx
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 Hi,
 
 Although removing the limit from sh(1) is probably not a bad idea It
 doesn't help people using older releases or other operating systems.
 (At least NetBSD has the same 79 character limitation.)
 
 Here's a patch for shar(1) which limits the EOF marker length to maximum
 of 79 characters. If the marker would be longer then we use simply
 "END-of-file" as marker.
 
 I don't think that this code would be too complex to add.
 
 -- 
 Jaakko
 
 --zYM0uCDKw75PZbzx
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="shar-limit-eofmarker.diff"
 
 PR: bin/118782
 
 Index: shar.sh
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/shar/shar.sh,v
 retrieving revision 1.3
 diff -u -r1.3 shar.sh
 --- shar.sh	29 Aug 1997 00:44:34 -0000	1.3
 +++ shar.sh	26 Mar 2008 17:51:26 -0000
 @@ -70,10 +70,14 @@
  		echo "echo c - $i"
  		echo "mkdir -p $i > /dev/null 2>&1"
  	else
 +		eofmarker="END-of-$i"
 +		if [ ${#eofmarker} -gt 79 ]; then
 +			eofmarker="END-of-file"
 +		fi
  		echo "echo x - $i"
 -		echo "sed 's/^X//' >$i << 'END-of-$i'"
 +		echo "sed 's/^X//' >$i << '$eofmarker'"
  		sed 's/^/X/' $i || exit
 -		echo "END-of-$i"
 +		echo "$eofmarker"
  	fi
  done
  echo exit
 
 --zYM0uCDKw75PZbzx--


More information about the freebsd-bugs mailing list