Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!pyramid!prls!mips!roger From: roger@mips.UUCP Newsgroups: net.sources.bugs Subject: One more SHAR, one more time ... Message-ID: <190@obiwan.mips.UUCP> Date: Fri, 27-Feb-87 17:32:28 EST Article-I.D.: obiwan.190 Posted: Fri Feb 27 17:32:28 1987 Date-Received: Sun, 1-Mar-87 15:37:34 EST Lines: 83 Keywords: Bugs, bugs, bugs ... [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