One more SHAR, one more time ...

roger at mips.UUCP roger at mips.UUCP
Sat Feb 28 08:32:28 AEST 1987


[feed a line eater today]

	  So sad, my wonderous SHAR wasn't so case hardened as I imagined.
	There is a very nasty bug that occurs when it tries to incorporate
	a file which it doesn't have read access to. The SHAR produced
	script would hang when it attempted to unbundle. So ... below is
	a diff which should correct the problem. It should be patchable
	to the original "shar.c" file sent out. The new output will not
	hang, and prints a message when unbundling that a read error had
	occured at SHAR time.

							Rogue Monster

-------- cut -------- cut -------- cut -------- cut -------- cut --------
*** shar.c	Fri Feb 27 14:04:19 1987
--- org/shar.c	Fri Feb 27 13:52:31 1987
***************
*** 413,433 ****
     */
    CheckTree(stm,ref->Leaf->Parent);
    /*
!    *	Put out the existance check header if required.
     */
    MakePathName(ref->Leaf);
    if (!OverWrite)
      fprintf(stm,"if `test ! -s %s`\nthen\n",PathName);
    /*
!    *	Open the input file. Echo file name written.
     */
    if (!(inp = fopen(PathName,"r"))){
      fprintf(stderr,"Unable to read \"%s\"\n",PathName);
-     fprintf(stm,"  echo \"read error when SHAR-ed: %s\"\nfi\n",PathName);
      return;
    }
-   if (!Quiet)
-     fprintf(stm,"echo \"writting %s\"\n",PathName);
    fprintf(stm,"cat > %s << '%s'\n",PathName,Terminal);
    /*
     *	Move the file data into the archive.
--- 413,433 ----
     */
    CheckTree(stm,ref->Leaf->Parent);
    /*
!    *	Put out the existance check header if required. Also do the
!    *	file name echoing.
     */
    MakePathName(ref->Leaf);
    if (!OverWrite)
      fprintf(stm,"if `test ! -s %s`\nthen\n",PathName);
+   if (!Quiet)
+     fprintf(stm,"echo \"writting %s\"\n",PathName);
    /*
!    *	Open the input file.
     */
    if (!(inp = fopen(PathName,"r"))){
      fprintf(stderr,"Unable to read \"%s\"\n",PathName);
      return;
    }
    fprintf(stm,"cat > %s << '%s'\n",PathName,Terminal);
    /*
     *	Move the file data into the archive.
***************
*** 478,484 ****
    /*
     *	Open the output file, failure here causes a return.
     */
!   sprintf(CharBuf,"%s.shr%d",RootName,fil->Number);
    if (!(stm = fopen(CharBuf,"w"))){
      fprintf(stderr,"Unable to open archive: %s\n",CharBuf);
      return;
--- 478,484 ----
    /*
     *	Open the output file, failure here causes a return.
     */
!   sprintf(CharBuf,"%s.%d",RootName,fil->Number);
    if (!(stm = fopen(CharBuf,"w"))){
      fprintf(stderr,"Unable to open archive: %s\n",CharBuf);
      return;
-------- cut -------- cut -------- cut -------- cut -------- cut --------
-- 
-Rogue Monster                                   (also known as Roger March)
UUCP: {decvax,ucbvax,ihnp4,hplabs}!decwrl!mips!roger
USPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086, (408) 991-0220



More information about the Comp.sources.bugs mailing list