<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/shell/ash_test, branch 1_31_1</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=1_31_1</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=1_31_1'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2019-05-19T14:35:56+00:00</updated>
<entry>
<title>hush: remove test for "echo ${-}" errorring out - now it works</title>
<updated>2019-05-19T14:35:56+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2019-05-19T14:35:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=30a4c32a4d21728a7e25025f70fcc1d7cd722fe0'/>
<id>urn:sha1:30a4c32a4d21728a7e25025f70fcc1d7cd722fe0</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>hush: fix quoted "${notexist-}" expansion to not disappear</title>
<updated>2019-05-15T11:39:19+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2019-05-15T11:39:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=9e0adb9b09ec14afe2e5a222dda1c447f336ea06'/>
<id>urn:sha1:9e0adb9b09ec14afe2e5a222dda1c447f336ea06</id>
<content type='text'>
function                                             old     new   delta
expand_one_var                                      2296    2311     +15

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>shells: add tests for backslashes in export VAR=VAL</title>
<updated>2019-05-14T17:15:20+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2019-05-14T17:15:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=63d765e666a8b23e3923acecdc41be71d5679439'/>
<id>urn:sha1:63d765e666a8b23e3923acecdc41be71d5679439</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>ash: expand: Do not quote backslashes in unquoted parameter expansion</title>
<updated>2018-08-07T16:58:02+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-08-07T16:54:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=eb54ca8be0b45a101f9bdcf6efa26645c6b94a08'/>
<id>urn:sha1:eb54ca8be0b45a101f9bdcf6efa26645c6b94a08</id>
<content type='text'>
Upstream commit:

    Date: Wed, 28 Mar 2018 18:37:51 +0800
    expand: Do not quote backslashes in unquoted parameter expansion

    Here is a better example:

        a="/*/\nullx" b="/*/\null"; printf "%s\n" $a $b

    dash currently prints

        /*/\nullx
        /*/\null

    bash prints

        /*/\nullx
        /dev/null

    You may argue the bash behaviour is inconsistent but it actually
    makes sense.  What happens is that quote removal only applies to
    the original token as seen by the shell.  It is never applied to
    the result of parameter expansion.

    Now you may ask why on earth does the second line say "/dev/null"
    instead of "/dev/\null".  Well that's because it is not the quote
    removal step that removed the backslash, but the pathname expansion.

    The fact that the /de\v does not become /dev even though it exists
    is just the result of the optimisation to avoid unnecessarily
        calling stat(2).  I have checked POSIX and I don't see anything
    that forbids this behaviour.

    So going back to dash yes I think we should adopt the bash behaviour
    for pathname expansion and keep the existing case semantics.

    This patch does exactly that.  Note that this patch does not work
    unless you have already applied

        https://patchwork.kernel.org/patch/10306507/

    because otherwise the optimisation mentioned above does not get
    detected correctly and we will end up doing quote removal twice.

    This patch also updates expmeta to handle naked backslashes at
    the end of the pattern which is now possible.

    Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;

function                                             old     new   delta
expmeta                                              618     653     +35
memtodest                                            146     147      +1

Tested to work with both ASH_INTERNAL_GLOB on and off.

hush does not handle this correctly.

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>ash: expand: Fix ghost fields with unquoted $@/$*</title>
<updated>2018-08-05T12:29:58+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-08-05T12:29:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=440da97ed79841b55f0b61e4108a336b61642bff'/>
<id>urn:sha1:440da97ed79841b55f0b61e4108a336b61642bff</id>
<content type='text'>
Upstream commit:

    Date: Fri, 23 Mar 2018 18:58:47 +0800
    expand: Fix ghost fields with unquoted $@/$*

    You're right.  The proper fix to this is to ensure that nulonly
    is not set in varvalue for $*.  It should only be set for $@ when
    it's inside double quotes.

    In fact there is another bug while we're playing with $@/$*.
    When IFS is set to a non-whitespace character such as :, $*
    outside quotes won't remove empty fields as it should.

    This patch fixes both problems.

    Reported-by: Martijn Dekker &lt;martijn@inlv.org&gt;
    Suggested-by: Harald van Dijk &lt;harald@gigawatt.nl&gt;
    Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;

function                                             old     new   delta
argstr                                              1111    1113      +2
evalvar                                              571     569      -2
varvalue                                             579     576      -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 2/-5)               Total: -3 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>ash: eval: Variable assignments on functions are no longer persistent</title>
<updated>2018-08-05T09:14:11+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-08-05T08:39:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=9abf53beb48b40e98d50fd35f445d6474af3a494'/>
<id>urn:sha1:9abf53beb48b40e98d50fd35f445d6474af3a494</id>
<content type='text'>
Upstream commit:

    Date: Wed, 4 Apr 2018 17:54:01 +0800
    eval: Variable assignments on functions are no longer persistent

    Dirk Fieldhouse &lt;fieldhouse@gmx.net&gt; wrote:
    &gt; In POSIX.1-2017 ("simultaneously IEEE Std 1003.1™-2017 and The Open
    &gt; Group Technical Standard Base Specifications, Issue 7")
    &gt; &lt;http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09&gt;,
    &gt; we read under '2.9.1 Simple Commands'
    &gt;
    &gt; "Variable assignments shall be performed as follows:
    &gt; ...
    &gt; -    If the command name is a standard utility implemented as a function
    &gt; (see XBD Utility), the effect of variable assignments shall be as if the
    &gt; utility was not implemented as a function.
    &gt; ...
    &gt; -    If the command name is a function that is not a standard utility
    &gt; implemented as a function, variable assignments shall affect the current
    &gt; execution environment during the execution of the function. It is
    &gt; unspecified:
    &gt;
    &gt;     *   Whether or not the variable assignments persist after the
    &gt; completion of the function
    &gt;
    &gt;     *   Whether or not the variables gain the export attribute during
    &gt; the execution of the function
    &gt;
    &gt;     *   Whether or not export attributes gained as a result of the
    &gt; variable assignments persist after the completion of the function (if
    &gt; variable assignments persist after the completion of the function)"

    POSIX used to require the current dash behaviour.  However, you're
    right that this is no longer the case.

    This patch will remove the persistence of the variable assignment.

    I have considered the exporting the variables during the function
    execution but have decided against it because:

    1) It makes the code bigger.
    2) dash has never done this in the past.
    3) You cannot use this portably anyway.

    Reported-by: Dirk Fieldhouse &lt;fieldhouse@gmx.net&gt;
    Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;

function                                             old     new   delta
evalcommand                                         1606    1635     +29
evalcase                                             313     317      +4
evalfun                                              280     268     -12
pushlocalvars                                         48       -     -48
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/1 up/down: 33/-60)            Total: -27 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>ash,hush: properly handle ${v//pattern/repl} if pattern starts with /</title>
<updated>2018-08-04T20:25:28+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-08-04T20:25:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c2aa218f23a4e952746ebef7bb86668c6255471c'/>
<id>urn:sha1:c2aa218f23a4e952746ebef7bb86668c6255471c</id>
<content type='text'>
Closes 2695

function                                             old     new   delta
parse_dollar                                         762     790     +28
subevalvar                                          1258    1267      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0)               Total: 37 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>hush: fix another case where empty "for" wasn't setting exitcode to 0</title>
<updated>2018-07-28T10:42:08+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-07-28T10:42:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=a5db1d7354977fe295882ff557e8f5fb23741b13'/>
<id>urn:sha1:a5db1d7354977fe295882ff557e8f5fb23741b13</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>hush: add "heredoc.tests" from ash, tweak ash "is a function" message</title>
<updated>2018-07-24T15:10:18+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-07-24T15:08:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=63c42afaa43d42def05dfbca1f4e10c7314b1f77'/>
<id>urn:sha1:63c42afaa43d42def05dfbca1f4e10c7314b1f77</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>hush: fix nested redirects colliding with script fds</title>
<updated>2018-07-24T14:54:41+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2018-07-24T14:54:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=41ef41b3e0a16c9f8524870a2dc4f768c237939e'/>
<id>urn:sha1:41ef41b3e0a16c9f8524870a2dc4f768c237939e</id>
<content type='text'>
This necessitates switch from libc FILE api to a simple
homegrown replacement.
The change which fixes the bug here is the deleting of

	restore_redirected_FILEs();

line. It was prematurely moving (restoring) script fd#3.
The fix is: we don't even _want_ to restore scrit fds,
we are perfectly fine with them being moved.
The only reason we tried to restore them is that FILE api
did not allow moving of FILE-&gt;fd.

function                                             old     new   delta
refill_HFILE_and_getc                                  -      93     +93
hfopen                                                 -      90     +90
hfclose                                                -      66     +66
pseudo_exec_argv                                     591     597      +6
hush_main                                           1089    1095      +6
builtin_source                                       209     214      +5
save_fd_on_redirect                                  197     200      +3
setup_redirects                                      320     321      +1
fgetc_interactive                                    235     236      +1
i_peek_and_eat_bkslash_nl                             99      97      -2
expand_vars_to_list                                 1103    1100      -3
restore_redirects                                     99      52     -47
fclose_and_forget                                     57       -     -57
remember_FILE                                         63       -     -63
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 6/3 up/down: 271/-172)           Total: 99 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
