[PATCH 0/7] ash: various fixes from dash

Denys Vlasenko vda.linux at googlemail.com
Mon May 18 08:15:35 UTC 2015


On Fri, May 15, 2015 at 12:30 PM, Ron Yorston <rmy at frippery.org> wrote:
> The following patch series is an attempt to fix a report that this
> doesn't work in BusyBox ash:
>
>    test='/dir/file.ext'
>    echo "${test##*[/|\\]}"
>    test='\dir\file.ext'
>    echo "${test##*[/|\\]}"
>
> In both cases the result should be 'file.ext' but in fact the test
> strings are returned unchanged.  Both bash and dash get it right.
>
> Examining the code for dash showed that the issue had been fixed by
> the commit:
>
>    [EXPAND] Move parse-time quote flag detection to run-time
>
> That patch was part of a series of changes made on 24th/25th September
> 2007.  The patches here apply all of these changes to ash in BusyBox.
> To make them easier to apply I've also included an earlier commit.
> Some later fix-up commits are also included.
>
> The first six patches are based on the work of the dash maintainer
> Herbert Xu.  The final patch is my work:  it fixes support for pattern
> replacement in parameter expansion.  This is included in BusyBox for
> bash compatibility but not in dash.
>
> In addition to the bug mentioned above a further four differences from
> bash/dash are also removed.  Test cases illustrating these are provided
> in the commit messages.
>
> Pattern substitution in parameter expansion is slightly improved.
> For example, this now works where it didn't before:
>
>    v='xy/z'
>    echo ${v/y\//a}
>
> The patch series as a whole has the following effect on the size of
> BusyBox:
>
> function                                             old     new   delta
> memtodest                                            129     182     +53
> rmescapes                                            285     315     +30
> redirect                                            1169    1172      +3
> expandstr                                            117     120      +3
> dolatstr                                               5       7      +2
> static.spclchars                                      10       9      -1
> evalvar                                              733     729      -4
> subevalvar                                          1509    1468     -41
> cmdputs                                              455     398     -57
> varvalue                                             853     770     -83
> readtoken1                                          3325    3240     -85
> ------------------------------------------------------------------------------
> (add/remove: 0/0 grow/shrink: 5/6 up/down: 91/-271)          Total: -180 bytes


Applied all 8 patches. Thanks!

(ash tests are in a separate testsuite in shell/ash_test/*)


More information about the busybox mailing list