"sed" gets confused by empty "-f" files
Guy Harris
guy at auspex.auspex.com
Thu Jul 6 05:53:50 AEST 1989
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;
More information about the Comp.bugs.sys5
mailing list