*BSD News Article 12586


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!olivea!uunet!mcsun!sunic!isgate!krafla!adamd
From: adamd@rhi.hi.is (Adam David)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Has anyone ported C-News to 386bsd?
Message-ID: <6555@krafla.rhi.hi.is>
Date: 9 Mar 93 18:30:58 GMT
References: <1ndtjkINN49t@ftp.UU.NET> <6546@krafla.rhi.hi.is> <C3KzBp.K6u@world.std.com>
Sender: usenet@rhi.hi.is
Lines: 38
Nntp-Posting-Host: hengill.rhi.hi.is

geoff@world.std.com (Geoff Collyer) writes:

>No, the shell is broken; subst is correct as supplied.  I'm working with
>UCB now to try to get this fixed in 4.4BSD.

Yes, my mistake (I _did_ say I was tired :)

`...` works by piping the ... to a subshell whose output replaces the ...
in the current shell (unquoted). The subshell just sees it as stdin (unquoted)
so various metacharacters have to be escaped, even though the parent shell has
no trouble with them where they appear.

>This shell bug also breaks build and probably quite a few other scripts.

Yes, indeed. Here is an example:

"real" /bin/sh
--------------

$ set -x
$ echo `echo \\\\\\\\\\\\\\\\`
+ echo \\\\
+ echo \\
\

386bsd /bin/sh (ash)
--------------------

$ set -x
$ echo `echo \\\\\\\\\\\\\\\\`
+ echo \\\\\\\\
+ echo \\\\\\\\
\\\\\\\\

i.e. Ash is silently quoting both the input to and output from the subshell.

--
Adam David (adam@veda.is)