From: Tom Rini <trini@ti.com>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Simon Glass <sjg@chromium.org>,
Russell King <linux@arm.linux.org.uk>,
barebox@lists.infradead.org
Subject: Re: [U-Boot] [PATCH V2] hush: fix some quoted variable expansion issues
Date: Mon, 3 Mar 2014 09:28:20 -0500 [thread overview]
Message-ID: <20140303142820.GS16805@bill-the-cat> (raw)
In-Reply-To: <5312B2F2.1070000@wwwdotorg.org>
[-- Attachment #1.1: Type: text/plain, Size: 2493 bytes --]
On Sat, Mar 01, 2014 at 09:26:26PM -0700, Stephen Warren wrote:
> On 03/01/2014 05:10 PM, Simon Glass wrote:
> > Hi Stephen,
> >
> > On 27 February 2014 22:00, Stephen Warren <swarren@wwwdotorg.org
> > <mailto:swarren@wwwdotorg.org>> wrote:
> >
> > The following shell command fails:
> >
> > if test -z "$x"; then echo "zero"; else echo "non-zero"; fi
> >
> > (assuming $x does not exist, it prints "non-zero" rather than "zero").
> >
> > ... since "$x" expands to nothing, and the argument is completely
> > dropped, causing too few to be passed to -z, causing cmd_test() to
> > error out early.
> >
> > This is because when variable expansions are processed by make_string(),
> > the expanded results are concatenated back into a new string. However,
> > no quoting is applied when doing so, so any empty variables simply don't
> > generate any parameter when the combined string is parsed again.
> >
> > Fix this by explicitly replacing quoting any argument that was
> > originally
> > quoted when re-generating a string from the already-parsed argument
> > list.
> >
> > This also fixes loss of whitespace in commands such as:
> >
> > setenv space " "
> > setenv var " 1${space}${space} 2 "
> > echo ">>${var}<<"
> >
> >
> > Is there an upstream still for hush, or are we so far away that it
> > doesn't matter? If there is, was this bug fixed there?
>
> Well, the comments at the head of the file say it came from Busybox, but
> it's obviously diverged massively since it was imported:
>
> $ wc -l busybox/shell/hush.c u-boot/common/hush.c
> 9156 busybox/shell/hush.c
> 3682 u-boot/common/hush.c
> $ diff -u busybox/shell/hush.c u-boot/common/hush.c|wc -l
> 12264
>
> Also, the function this patch touches doesn't seem to exist under that
> name any more. From a quick look at the source, I couldn't tell what the
> equivalent is.
>
> Perhaps replaying patches to that file in Busybox since the fork might
> be more useful.
>
> A quick Google search for "hush" or "hush shell" doesn't seem to yield
> any other alternative upstreams.
For reference the patch is at http://patchwork.ozlabs.org/patch/325023/
Since U-Boot and Barebox are the only users of this particular hush
fork, and from G+ they also have this problem, maybe we can use this as
a starting point of a little more friendly coordination between the
projects?
--
Tom
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
parent reply other threads:[~2014-03-03 14:29 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <5312B2F2.1070000@wwwdotorg.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140303142820.GS16805@bill-the-cat \
--to=trini@ti.com \
--cc=barebox@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=sjg@chromium.org \
--cc=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox