<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox.git/shell/shell_common.c, branch master</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>shell: fix race between signal handlers setting bb_got_signal and poll()</title>
<updated>2025-07-02T20:42:47+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2025-07-02T20:42:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=36ac283682bb176987c0c09e5f8c7e7e96fb1651'/>
<id>36ac283682bb176987c0c09e5f8c7e7e96fb1651</id>
<content type='text'>
function                                             old     new   delta
__ppoll_time64                                         -     211    +211
check_got_signal_and_poll                              -     164    +164
read_key                                             607     601      -6
shell_builtin_read                                  1328    1318     -10
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/2 up/down: 375/-16)           Total: 359 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
__ppoll_time64                                         -     211    +211
check_got_signal_and_poll                              -     164    +164
read_key                                             607     601      -6
shell_builtin_read                                  1328    1318     -10
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/2 up/down: 375/-16)           Total: 359 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>use pollfd[1] array for poll() argument</title>
<updated>2025-07-02T19:55:42+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2025-07-02T19:55:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=bbaa56f7378240fca3db9165dfd02a4504d95ff1'/>
<id>bbaa56f7378240fca3db9165dfd02a4504d95ff1</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>shell: improve bash compatibility of read built-in</title>
<updated>2025-07-01T18:21:37+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2025-07-01T08:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=dcd8df258a402658ad1fdc018a245b06a610ca8d'/>
<id>dcd8df258a402658ad1fdc018a245b06a610ca8d</id>
<content type='text'>
Make the read built-in more compatible with bash:

- Return an exit code of 142 on timeout.

- When the timeout expires before a newline is detected in the
  input bash captures the partial input.  This behaviour is new
  since bash version 4.4.  BusyBox shells had the pre-4.4 behaviour
  where the input was lost.

Update the tests to suit and fix a couple of compiler errors in
the testsuite.

function                                             old     new   delta
builtin_read                                         154     174     +20
readcmd                                              213     228     +15
shell_builtin_read                                  1364    1370      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 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>
Make the read built-in more compatible with bash:

- Return an exit code of 142 on timeout.

- When the timeout expires before a newline is detected in the
  input bash captures the partial input.  This behaviour is new
  since bash version 4.4.  BusyBox shells had the pre-4.4 behaviour
  where the input was lost.

Update the tests to suit and fix a couple of compiler errors in
the testsuite.

function                                             old     new   delta
builtin_read                                         154     174     +20
readcmd                                              213     228     +15
shell_builtin_read                                  1364    1370      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 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>shell: move varcmp() to shell_common.h and use it in hush</title>
<updated>2023-06-17T19:13:13+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2023-06-17T19:02:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=96769486e20fd5f1142cae0db2cbacef31dc75e9'/>
<id>96769486e20fd5f1142cae0db2cbacef31dc75e9</id>
<content type='text'>
function                                             old     new   delta
unset_local_var                                        -     112    +112
findvar                                               31      35      +4
set_vars_and_save_old                                144     141      -3
helper_export_local                                  235     230      -5
set_local_var                                        425     416      -9
handle_changed_special_names                          38      27     -11
builtin_unset                                        154     141     -13
builtin_getopts                                      404     391     -13
get_local_var_value                                  281     260     -21
get_ptr_to_local_var                                  71      45     -26
unset_local_var_len                                  139       -    -139
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 116/-240)         Total: -124 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
unset_local_var                                        -     112    +112
findvar                                               31      35      +4
set_vars_and_save_old                                144     141      -3
helper_export_local                                  235     230      -5
set_local_var                                        425     416      -9
handle_changed_special_names                          38      27     -11
builtin_unset                                        154     141     -13
builtin_getopts                                      404     391     -13
get_local_var_value                                  281     260     -21
get_ptr_to_local_var                                  71      45     -26
unset_local_var_len                                  139       -    -139
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/8 up/down: 116/-240)         Total: -124 bytes

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>shell/read: do not allow empty variable name</title>
<updated>2023-06-17T17:52:20+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2023-06-17T17:52:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=2ca9c45953cdb5a1bd6144c6eed5a8f14c551122'/>
<id>2ca9c45953cdb5a1bd6144c6eed5a8f14c551122</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>shell: add comments about SIGINT-related problems</title>
<updated>2022-01-16T22:54:46+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2022-01-16T22:54:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=a277506a64404e6c4472ff89c944c4f353db1c33'/>
<id>a277506a64404e6c4472ff89c944c4f353db1c33</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>shells: do not allow bare "read" in non-bash compat configs</title>
<updated>2021-06-06T10:08:43+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2021-06-06T10:07:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=457825f77a7c7286647ee888a1000a6bb12ca8fc'/>
<id>457825f77a7c7286647ee888a1000a6bb12ca8fc</id>
<content type='text'>
    On Sat, Feb 9, 2019 Cristian Ionescu-Idbohrn wrote:
    &gt; In my case (at work), I have to watch and prevent people from doing
    &gt; unportable things.  For me, that's a burden.

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
    On Sat, Feb 9, 2019 Cristian Ionescu-Idbohrn wrote:
    &gt; In my case (at work), I have to watch and prevent people from doing
    &gt; unportable things.  For me, that's a burden.

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>shell: also do word splitting when -d DELIM is used</title>
<updated>2021-06-05T16:06:47+00:00</updated>
<author>
<name>Eicke Herbertz</name>
<email>wolletd@posteo.de</email>
</author>
<published>2021-06-05T11:42:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=1b30c63dfdd4f31faa6deda69345bf07f23aa334'/>
<id>1b30c63dfdd4f31faa6deda69345bf07f23aa334</id>
<content type='text'>
The original commit 3bef5d89b0 introduced an additional check
for an unset `opt_d` before doing word splitting. I'm unsure
why it's there in the first place, but the commit message also
describes a different behaviour than what -d actually does in
bash, while the code mostly does the right thing.

`opt_d` sets the line delimiter for read to stop reading and
should not affect word splitting.

Testcase:
$ echo qwe rty | { read -d Z a b; echo a:$a b:$b; }
a:qwe b:rty

function                                             old     new   delta
shell_builtin_read                                  1314    1304     -10

Signed-off-by: Eicke Herbertz &lt;wolletd@posteo.de&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>
The original commit 3bef5d89b0 introduced an additional check
for an unset `opt_d` before doing word splitting. I'm unsure
why it's there in the first place, but the commit message also
describes a different behaviour than what -d actually does in
bash, while the code mostly does the right thing.

`opt_d` sets the line delimiter for read to stop reading and
should not affect word splitting.

Testcase:
$ echo qwe rty | { read -d Z a b; echo a:$a b:$b; }
a:qwe b:rty

function                                             old     new   delta
shell_builtin_read                                  1314    1304     -10

Signed-off-by: Eicke Herbertz &lt;wolletd@posteo.de&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>shells: a fix for systems without RLIMIT_NICE</title>
<updated>2020-12-17T11:07:54+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2020-12-17T11:07:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=91e330a53fc8052addec941a9e1e6fcd4b68702b'/>
<id>91e330a53fc8052addec941a9e1e6fcd4b68702b</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>decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly</title>
<updated>2020-11-30T12:03:03+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2020-11-30T12:03:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/busybox.git/commit/?id=965b795b87c59ed45cc7f16a62301dbae65b1627'/>
<id>965b795b87c59ed45cc7f16a62301dbae65b1627</id>
<content type='text'>
   text	   data	    bss	    dec	    hex	filename
1021988	    559	   5052	1027599	  fae0f	busybox_old
1021236	    559	   5052	1026847	  fab1f	busybox_unstripped

Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
   text	   data	    bss	    dec	    hex	filename
1021988	    559	   5052	1027599	  fae0f	busybox_old
1021236	    559	   5052	1026847	  fab1f	busybox_unstripped

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