Date: Wed, 9 Oct 2002 14:10:04 -0700 (PDT) From: Ian Dowse <iedowse@maths.tcd.ie> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/43865: unterminated string in rc.conf leaves system unuseable / disk readonly Message-ID: <200210092110.g99LA4TR004578@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/43865; it has been noted by GNATS. From: Ian Dowse <iedowse@maths.tcd.ie> To: Giorgos Keramidas <keramida@freebsd.org> Cc: Ceri Davies <ceri@freebsd.org>, walterk1@earthlink.net, bug-followup@freebsd.org Subject: Re: bin/43865: unterminated string in rc.conf leaves system unuseable / disk readonly Date: Wed, 09 Oct 2002 22:00:03 +0100 In message <20021009193608.GF15316@hades.hell.gr>, Giorgos Keramidas writes: >One of the ideas I had and never actually got around to implementing >was a shell wrapper around $EDITOR that allows root to edit rc.conf >and then checks to see that sh(1) can still parse the resulting file. Yes, that sounds like it would help a lot. I was thinking more of a modification to the code that sources rc.conf to instead do something like: file=/etc/rc.conf lineno=0 while read line; do lineno=$(expr ${lineno} + 1) if (eval "${line}" > /dev/null 2>&-); then eval "${line}" else echo "${file}:${lineno}:" `eval "${line}" 2>&1` 1>&2 fi done < "${file}" This causes each line in rc.conf to be treated completely separately, and gives almost-sensible, non-fatal errors for failures. /etc/rc.conf:5: eval: 1: Syntax error: Unterminated quoted string /etc/rc.conf:45: eval: 1: Syntax error: Unterminated quoted string It does end up forking a lot of sub-shells and evaluates each line multiple times though, so could do with some improvement... Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210092110.g99LA4TR004578>