Article View: comp.bugs.sys5
Article #15"sed" gets confused by empty "-f" files
From: Guy Harris
Date: Wed, 05 Jul 1989 19:53
Date: Wed, 05 Jul 1989 19:53
50 lines
1535 bytes
1535 bytes
If you hand "sed" an empty file with the "-f" flag, the S5 "sed" gets
confused and acts as if no "-f" flag were given, and tries to parse the
argument after the filename as a "sed" script. As somebody who noted
this bug elsewhere said:
This bug affects, e.g., shell programs that build up temporary sed
scripts, which may possibly be null, for use as filters.
The fix appears to have been in V7, so I guess S5 never got around to
picking it up. The fix is:
*** sed.h.orig Thu Jun 29 11:38:43 1989
--- sed.h Thu Jun 29 11:39:01 1989
***************
*** 129,131 ****
--- 129,132 ----
struct label *search();
char *gline();
char *place();
+ char compfl;
*** sed0.c.orig Thu Jun 29 11:37:25 1989
--- sed0.c Thu Jun 29 11:38:23 1989
***************
*** 119,125 ****
}
! if(rep == ptrspace) {
eargv--;
eargc++;
eflag++;
--- 119,125 ----
}
! if(compfl == 0) {
eargv--;
eargc++;
eflag++;
***************
*** 155,160 ****
--- 155,161 ----
int i, ii;
struct label *lpt;
+ compfl = 1;
op = lastre;
if(rline(linebuf) < 0) return;
Technical Details
Message-ID:
<1877@auspex.auspex.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!auspex!guyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.bugs.sys5 Subject: "sed" gets confused by empty "-f" files Message-ID: <1877@auspex.auspex.com> Date: 5 Jul 89 19:53:50 GMT Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 50