NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/52302: sh segfault



The following reply was made to PR bin/52302; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: coypu%sdf.org@localhost
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: bin/52302: sh segfault
Date: Fri, 16 Jun 2017 05:27:39 +0700

     Date:        Thu, 15 Jun 2017 21:16:03 +0000
     From:        coypu%sdf.org@localhost
     Message-ID:  <20170615211602.GA20904%SDF.ORG@localhost>
 
   | script.sh does not need to exist for this segfault
 
 OK, in that case, it is fixed (will be fixed...)   It is (was) an ancient
 cleanup after error bug (probably been there for as long as the shell has
 supported here documents) - it could only happen in an interactive shell, as
 a non-interactive shell would have simply exited after reporting the first
 error.
 
 What I see now is ...
 
 ./sh
 [andromeda]$ <<su root -c "sh script.sh">>
 sh: 2: Syntax error: newline unexpected
 [andromeda]$ ls
 C-MSG               eval.d              main.h              output.o
 CVS                 eval.h              main.o              parser.c
 
 (I will spare you the other 30-something lines of output ...)  And after
 that any sequence of commands is possible, there's no PS2 prompt issued,
 and nothing attempts to collect the <<su here doc...
 
 I guess I should fix the "2" in the error message sometime, the newline
 which was unexpected was unexpected on line 1, not line 2, but the shell
 has read that \n (and hence advanced to line 2) before it detects that the
 \n was not supposed to occur there...   This is a very special case in
 error reporting, and might not be worth the effort...
 
 kre
 


Home | Main Index | Thread Index | Old Index