<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox.git/shell, branch 1_37_stable</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/'/>
<entry>
<title>ash: move hashvar() calls into findvar()</title>
<updated>2024-07-13T23:12:54+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-04-06T08:50:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=371fe9f71d445d18be28c82a2a6d82115c8af19d'/>
<id>371fe9f71d445d18be28c82a2a6d82115c8af19d</id>
<content type='text'>
dash has accepted a patch to remove the first argument of findvar().
It's commit e85e972 (var: move hashvar() calls into findvar()).

Apply the same change to BusyBox ash.

function                                             old     new   delta
findvar                                               35      40      +5
mklocal                                              268     261      -7
exportcmd                                            164     157      -7
setvareq                                             319     310      -9
lookupvar                                            150     141      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 5/-32)             Total: -27 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
dash has accepted a patch to remove the first argument of findvar().
It's commit e85e972 (var: move hashvar() calls into findvar()).

Apply the same change to BusyBox ash.

function                                             old     new   delta
findvar                                               35      40      +5
mklocal                                              268     261      -7
exportcmd                                            164     157      -7
setvareq                                             319     310      -9
lookupvar                                            150     141      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 5/-32)             Total: -27 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: do not exit interactive shell on some redirection errors</title>
<updated>2024-07-13T00:13:28+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-07-12T23:47:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=23da5c4b716b92524240c6f81c2e2474c1825cfc'/>
<id>23da5c4b716b92524240c6f81c2e2474c1825cfc</id>
<content type='text'>
$ echo &gt;&amp;99
hush: dup2(99,1): Bad file descriptor
$ echo &gt;&amp;9999
hush: fcntl(1,F_DUPFD,10000): Invalid argument
$ echo 2&gt;/dev/tty 10&gt;&amp;9999
hush: fcntl(10,F_DUPFD,10000): Invalid argument
$ still alive!_

function                                             old     new   delta
static.setup_redirects                               334     394     +60
.rodata                                           105661  105712     +51
dup_CLOEXEC                                           49      79     +30
save_fd_on_redirect                                  263     277     +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 155/0)             Total: 155 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
$ echo &gt;&amp;99
hush: dup2(99,1): Bad file descriptor
$ echo &gt;&amp;9999
hush: fcntl(1,F_DUPFD,10000): Invalid argument
$ echo 2&gt;/dev/tty 10&gt;&amp;9999
hush: fcntl(10,F_DUPFD,10000): Invalid argument
$ still alive!_

function                                             old     new   delta
static.setup_redirects                               334     394     +60
.rodata                                           105661  105712     +51
dup_CLOEXEC                                           49      79     +30
save_fd_on_redirect                                  263     277     +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 155/0)             Total: 155 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: fix "exec 3&gt;FILE" aborting if 3 is exactly the next free fd</title>
<updated>2024-07-12T22:59:02+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-07-12T22:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=14e28c18ca1a0fb87b6c73d5cb7487e80bc6713a'/>
<id>14e28c18ca1a0fb87b6c73d5cb7487e80bc6713a</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: avoid duplicate fcntl(F_SETFD, FD_CLOEXEC) during init</title>
<updated>2024-07-12T22:14:41+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-07-12T22:14:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=6c38d0e9da2d4a3defd2bff9f3e00f6229e9824b'/>
<id>6c38d0e9da2d4a3defd2bff9f3e00f6229e9824b</id>
<content type='text'>
function                                             old     new   delta
hush_main                                           1149    1150      +1

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
function                                             old     new   delta
hush_main                                           1149    1150      +1

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ash: remove limitation on fd# length</title>
<updated>2024-07-12T20:28:25+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-07-12T20:28:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=08fb86726b508eb99502a6681da94395c4e4580c'/>
<id>08fb86726b508eb99502a6681da94395c4e4580c</id>
<content type='text'>
"echo text &gt;&amp;0000000000002" works as you would expect,
"echo text &gt;&amp;9999999999" properly fails instead of creating a file
named "9999999999".

function                                             old     new   delta
expredir                                             219     232     +13
readtoken1                                          3045    3053      +8
parsefname                                           204     201      -3
isdigit_str9                                          45       -     -45
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/1 up/down: 21/-48)            Total: -27 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
"echo text &gt;&amp;0000000000002" works as you would expect,
"echo text &gt;&amp;9999999999" properly fails instead of creating a file
named "9999999999".

function                                             old     new   delta
expredir                                             219     232     +13
readtoken1                                          3045    3053      +8
parsefname                                           204     201      -3
isdigit_str9                                          45       -     -45
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/1 up/down: 21/-48)            Total: -27 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ash: do not abort interactive mode on &gt;&amp;9999 redirect</title>
<updated>2024-07-12T20:10:50+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-07-12T19:58:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=0829fce079dae45737330114c27886cb8af85043'/>
<id>0829fce079dae45737330114c27886cb8af85043</id>
<content type='text'>
With very large fd#, the error code path is different
from one for closed but small fd#.

Make it not abort if we are interactive:

$ echo text &gt;&amp;99    # this wasn't buggy
ash: dup2(9,1): Bad file descriptor
$ echo text &gt;&amp;9999  # this was
ash: fcntl(1,F_DUPFD,10000): Invalid argument

function                                             old     new   delta
.rodata                                           105637  105661     +24
dup2_or_raise                                         35      38      +3
redirect                                            1084    1044     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 27/-40)            Total: -13 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With very large fd#, the error code path is different
from one for closed but small fd#.

Make it not abort if we are interactive:

$ echo text &gt;&amp;99    # this wasn't buggy
ash: dup2(9,1): Bad file descriptor
$ echo text &gt;&amp;9999  # this was
ash: fcntl(1,F_DUPFD,10000): Invalid argument

function                                             old     new   delta
.rodata                                           105637  105661     +24
dup2_or_raise                                         35      38      +3
redirect                                            1084    1044     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 27/-40)            Total: -13 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ash: remove defunct control character to save a few bytes</title>
<updated>2024-07-10T05:35:26+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-07-10T05:35:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=0af28b84e58307422f807ddbdafc67a68f71eb64'/>
<id>0af28b84e58307422f807ddbdafc67a68f71eb64</id>
<content type='text'>
Commit 549deab5a (ash: move parse-time quote flag detection to
run-time) did away with the need to distinguish between backquotes
inside and outside quotes.  This left a gap among the control
characters used in argument strings.  Removing this gap saves a
few bytes.

function                                             old     new   delta
.rodata                                           167346  167338      -8
cmdputs                                              399     388     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19)             Total: -19 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 549deab5a (ash: move parse-time quote flag detection to
run-time) did away with the need to distinguish between backquotes
inside and outside quotes.  This left a gap among the control
characters used in argument strings.  Removing this gap saves a
few bytes.

function                                             old     new   delta
.rodata                                           167346  167338      -8
cmdputs                                              399     388     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19)             Total: -19 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ash: fix parsing of alias expansion + bash features</title>
<updated>2024-07-10T05:11:23+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2024-05-02T12:08:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=ba0f94458bf992bb1f34c75e36960811d77b5f55'/>
<id>ba0f94458bf992bb1f34c75e36960811d77b5f55</id>
<content type='text'>
An alias expansion immediately followed by '&lt;' and a newline is
parsed incorrectly:

   ~ $ alias x='echo yo'
   ~ $ x&lt;
   yo
   ~ $
   sh: syntax error: unexpected newline

The echo is executed and an error is printed on the next command
submission.  In dash the echo isn't executed and the error is
reported immediately:

   $ alias x='echo yo'
   $ x&lt;
   dash: 3: Syntax error: newline unexpected
   $

The difference between BusyBox and dash is that BusyBox supports
bash-style process substitution and output redirection.  These
require checking for '&lt;(', '&gt;(' and '&amp;&gt;' in readtoken1().

In the case above, when the end of the alias is found, the '&lt;' and
the following newline are both read to check for '&lt;('.  Since
there's no match both characters are pushed back.

The next input is obtained by reading the expansion of the alias.
Once this string is exhausted the next call to __pgetc() calls
preadbuffer() which pops the string, reverts to the previous input
and recursively calls __pgetc().  This request is satisified from
the pungetc buffer.  But the first __pgetc() doesn't know this:
it sees the character has come from preadbuffer() so it (incorrectly)
updates the pungetc buffer.

Resolve the issue by moving the code to pop the string and fetch
the next character up from preadbuffer() into __pgetc().

function                                             old     new   delta
pgetc                                                 28     589    +561
__pgetc                                              607       -    -607
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 561/-607)          Total: -46 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An alias expansion immediately followed by '&lt;' and a newline is
parsed incorrectly:

   ~ $ alias x='echo yo'
   ~ $ x&lt;
   yo
   ~ $
   sh: syntax error: unexpected newline

The echo is executed and an error is printed on the next command
submission.  In dash the echo isn't executed and the error is
reported immediately:

   $ alias x='echo yo'
   $ x&lt;
   dash: 3: Syntax error: newline unexpected
   $

The difference between BusyBox and dash is that BusyBox supports
bash-style process substitution and output redirection.  These
require checking for '&lt;(', '&gt;(' and '&amp;&gt;' in readtoken1().

In the case above, when the end of the alias is found, the '&lt;' and
the following newline are both read to check for '&lt;('.  Since
there's no match both characters are pushed back.

The next input is obtained by reading the expansion of the alias.
Once this string is exhausted the next call to __pgetc() calls
preadbuffer() which pops the string, reverts to the previous input
and recursively calls __pgetc().  This request is satisified from
the pungetc buffer.  But the first __pgetc() doesn't know this:
it sees the character has come from preadbuffer() so it (incorrectly)
updates the pungetc buffer.

Resolve the issue by moving the code to pop the string and fetch
the next character up from preadbuffer() into __pgetc().

function                                             old     new   delta
pgetc                                                 28     589    +561
__pgetc                                              607       -    -607
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 561/-607)          Total: -46 bytes

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ash: fix handling of single-quoted strings in pattern substitution</title>
<updated>2024-02-26T15:27:53+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-02-26T15:26:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=c5a1be25ba6dd705382ce6c25d96a32f79974c04'/>
<id>c5a1be25ba6dd705382ce6c25d96a32f79974c04</id>
<content type='text'>
function                                             old     new   delta
subevalvar                                          1576    1588     +12

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
function                                             old     new   delta
subevalvar                                          1576    1588     +12

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hush: detect when terminating "done"/"fi" is missing</title>
<updated>2024-02-25T16:53:25+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2024-02-25T16:50:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=758b21402abc7015cfc54eb21a2e7eead1ecf6ba'/>
<id>758b21402abc7015cfc54eb21a2e7eead1ecf6ba</id>
<content type='text'>
function                                             old     new   delta
parse_stream                                        2271    2292     +21
.rodata                                           105408  105427     +19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0)               Total: 40 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
function                                             old     new   delta
parse_stream                                        2271    2292     +21
.rodata                                           105408  105427     +19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0)               Total: 40 bytes

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