Hi Krzysztof, Sorry for the long delay in responding.
Krzysztof A. Sobiecki wrote: [...] > +++ dash-0.5.6.1/src/input.c 2010-06-25 00:45:19.000000000 +0200 > @@ -400,15 +402,28 @@ popstring(void) > */ > > int > +isdir(const char *name) > +{ > + struct stat64 st; > + if (stat64(name, &st) < 0) > + return -1; > + if (S_ISDIR(st.st_mode)) { > + return -1; > + } > + return 0; > +} This function does not distinguish between failures where errno is set and where it is not... > + > +int > setinputfile(const char *fname, int flags) > { > int fd; > > INTOFF; > - if ((fd = open(fname, O_RDONLY)) < 0) { > + if ((isdir(fname) < 0) || ((fd = open(fname, O_RDONLY)) < 0)) { > if (flags & INPUT_NOFILE_OK) > goto out; > - sh_error("Can't open %s", fname); > + exitstatus = 127; > + exerror(EXIFILE, "Can't open %s", fname); ... so the caller unconditionally suppresses errno. The isdir() check happens before the open(), leading to unpleasant behavior if a file is replaced by a directory between them. The patch fixes two issues at once: changing the exit status to 127 and catching attempts to redirect from a directory. That said, do you think this could be made into two patches against upstream to be sent to <d...@vger.kernel.org>? -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org