<feed xmlns='http://www.w3.org/2005/Atom'>
<title>busybox-w32/shell, branch waitfor</title>
<subtitle>A mirror of https://github.com/rmyorston/busybox-w32.git
</subtitle>
<id>https://git.lua4.win/busybox-w32/atom?h=waitfor</id>
<link rel='self' href='https://git.lua4.win/busybox-w32/atom?h=waitfor'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/'/>
<updated>2026-07-16T13:09:16+00:00</updated>
<entry>
<title>ash: allow wait to handle more than 64 processes</title>
<updated>2026-07-16T13:09:16+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-07-16T12:46:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=d49a90b998ca8d381fead3ac8060071bec46c393'/>
<id>urn:sha1:d49a90b998ca8d381fead3ac8060071bec46c393</id>
<content type='text'>
WaitForMultipleObjects() can only handle 64 processes (actually,
MAXIMUM_WAIT_OBJECTS) in a single call.  Using the 'wait' shell
built-in after a command like:

   for i in $(seq 1 70); do echo $i; sleep 10 &amp; done

resulted in an uninterruptible 'wait'.

Handle processes in batches of MAXIMUM_WAIT_OBJECTS.

The problem was noted by Morgan Bartlett, who also supplied a
fix which I claim to have 'improved'.

Adds 32-48 bytes.

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'busybox' into merge</title>
<updated>2026-07-08T13:32:00+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-07-08T13:32:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=4afa250a0b2d9a5f20176b3a47b0a34bb87b7790'/>
<id>urn:sha1:4afa250a0b2d9a5f20176b3a47b0a34bb87b7790</id>
<content type='text'>
Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: fix out-of-bounds read in ifsbreakup()</title>
<updated>2026-07-06T08:30:30+00:00</updated>
<author>
<name>Sanghyun Park</name>
<email>sanghyun.park.cnu@gmail.com</email>
</author>
<published>2026-06-18T08:04:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=a448b6d5b21e5b21249391389b6f0551d9bea136'/>
<id>urn:sha1:a448b6d5b21e5b21249391389b6f0551d9bea136</id>
<content type='text'>
ifsfree() does not only release allocated ifsregion nodes; it also clears
the global IFS region state used by ifsbreakup(). If argstr() raises an
error while expanding an argument, ash longjmps out of expandarg() before
that cleanup runs, leaving stale IFS split offsets behind.

A later expansion can reuse the stack for a shorter string. ifsbreakup()
then sees the stale IFS state, trusts the old offsets, and can walk past
the current stack block before dereferencing p.

Follow dash's root-cause fix: when an expansion-related handler catches
EXERROR and continues, restore the handler and call ifsfree(). Apply
the cleanup to redirectsafe(), expandstr(), and evaltree().

Upstream commit:

    Date:   Mon Dec 5 23:02:01 2022 +0800
    expand: Add ifsfree to expand to fix a logic error that causes a buffer over-read

    On Mon, Jun 20, 2022 at 02:27:10PM -0400, Alex Gorinson wrote:
    &gt; Due to a logic error in the ifsbreakup function in expand.c if a
    &gt; heredoc and normal command is run one after the other by means of a
    &gt; semi-colon, when the second command drops into ifsbreakup the command
    &gt; will be evaluated with the ifslastp/ifsfirst struct that was set when
    &gt; the here doc was evaluated. This results in a buffer over-read that
    &gt; can leak the program's heap, stack, and arena addresses which can be
    &gt; used to beat ASLR.
    &gt;
    &gt; Steps to Reproduce:
    &gt; First bug:
    &gt; cmd args: ~/exampleDir/example&gt; dash
    &gt; $ M='AAAAAAAAAAAAAAAAA'    &lt;note: 17 A's&gt;
    &gt; $ q00(){
    &gt; $ &lt;&lt;000;echo
    &gt; $ ${D?$M$M$M$M$M$M}        &lt;note: 6 $M's&gt;
    &gt; $ 000
    &gt; $ }
    &gt; $ q00                      &lt;note: After the q00 is typed in, the leak
    &gt; should be echo'd out; this works with ash, busybox ash, and dash and
    &gt; with all option args.&gt;
    &gt;
    &gt; Patch:
    &gt; Adding the following to expand.c will fix both bugs in one go.
    &gt; (Thank you to Harald van Dijk and Michael Greenberg for doing the
    &gt; heavy lifting for this patch!)
    &gt; ==========================
    &gt; --- a/src/expand.c
    &gt; +++ b/src/expand.c
    &gt; @@ -859,6 +859,7 @@
    &gt; if (discard)
    &gt; return -1;
    &gt;
    &gt; +ifsfree();
    &gt; sh_error("Bad substitution");
    &gt; }
    &gt;
    &gt; @@ -1739,6 +1740,7 @@
    &gt; } else
    &gt; msg = umsg;
    &gt; }
    &gt; +ifsfree();
    &gt; sh_error("%.*s: %s%s", end - var - 1, var, msg, tail);
    &gt;  }
    &gt; ==========================

    Thanks for the report!

    I think it's better to add the ifsfree() call to the exception
    handling path as other sh_error calls may trigger this too.

function                                             old     new   delta
restore_handler_expandarg                              -      33     +33
evaltree                                             725     711     -14
static.redirectsafe                                  141     124     -17
expandstr                                            262     242     -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 36/-45)            Total: -18 bytes

Signed-off-by: Sanghyun Park &lt;sanghyun.park.cnu@gmail.com&gt;
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
<entry>
<title>ash: only report background jobs in root shell</title>
<updated>2026-06-30T16:50:30+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-06-30T16:50:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c2bf59a9ff757c0b1dc45dcf5a42dcc08a3c7d57'/>
<id>urn:sha1:c2bf59a9ff757c0b1dc45dcf5a42dcc08a3c7d57</id>
<content type='text'>
Background jobs were being reported in shells other than an
interactive, top-level shell.

Suppress this unnecessary report.

Adds 16 bytes.

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: only copy jobtab if needed for job hack</title>
<updated>2026-06-30T16:31:20+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-06-30T16:31:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=f16e9b40a381618573211b4e82162e819eec1587'/>
<id>urn:sha1:f16e9b40a381618573211b4e82162e819eec1587</id>
<content type='text'>
This script:

  #!/bin/bash

  (
    ( true ) &amp;
    ( true ) &amp;
    ( true ) &amp;
    ( true ) &amp;
    ( true ) &amp;
  )

resulted in a crash.  The problem was introduced by commit
7b692ddf0c (ash: improved support for jobs built-in).  This
commit copies the job table into child shells for use by the
'jobs' built-in.

The crash happens because when the job table is cleared in the
child it becomes available for reuse.  If only four jobs are
required this is OK but going over four causes the table to be
reallocated.  This doesn't work because in the child it's in
shared memory.

The fix is not to pass the job table to the child unless it's
required by the 'jobs' built-in.  This is also more efficient.

Adds 0-16 bytes.

(GitHub issue #604)

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: scan drives directly for 'pwd -a'</title>
<updated>2026-06-15T11:42:36+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-06-15T10:44:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c5ff19688135ff077190a46de17f6cd7c005d1fc'/>
<id>urn:sha1:c5ff19688135ff077190a46de17f6cd7c005d1fc</id>
<content type='text'>
The shell builtin 'pwd' takes a Windows-specific '-a' option to
display the current directory on each drive.

Use Windows APIs directly to scan for valid drives instead of
'getmntent()'.  Future changes will result in 'getmntent()'
returning mounted volumes as well as drives.

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: don't treat process substitutions as background jobs</title>
<updated>2026-05-31T14:10:05+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-05-31T14:10:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=c2c2944a9e93fe549d4c5c873bc93de4a486e3e1'/>
<id>urn:sha1:c2c2944a9e93fe549d4c5c873bc93de4a486e3e1</id>
<content type='text'>
Commit bda604a70 (ash: prevent leakage of process handles) added
job tracking for process substitutions.  This had the unwanted
side-effect that if the user tried to exit from the shell after
a command involving process substitution the shell reported that
background jobs were present and refused to exit.

Use the flag introduced in commit e6c716317 (ash: don't report
completion of process substitution) to avoid this.

Adds 16 bytes.

(GitHub issue #587)

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: read built-in should respect stty -echo</title>
<updated>2026-05-24T18:06:25+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-05-24T14:56:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0ab4bc6ce5f6480b03093866b04c17e5d13ef046'/>
<id>urn:sha1:0ab4bc6ce5f6480b03093866b04c17e5d13ef046</id>
<content type='text'>
If echo has been disabled by the command 'stty -echo' the shell
'read' built-in should match its behaviour on Linux and not echo
keyboard input.

Adds 32-48 bytes.

(GitHub issue #594)

Signed-off-by: Ron Yorston &lt;rmy@pobox.com&gt;
</content>
</entry>
<entry>
<title>ash: don't report completion of process substitution</title>
<updated>2026-05-17T10:18:32+00:00</updated>
<author>
<name>Ron Yorston</name>
<email>rmy@pobox.com</email>
</author>
<published>2026-05-17T10:11:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=e6c716317e760d2441d2cfeba3cf5a6b5ee0415d'/>
<id>urn:sha1:e6c716317e760d2441d2cfeba3cf5a6b5ee0415d</id>
<content type='text'>
Commit bda604a70 (ash: prevent leakage of process handles) added
job tracking for process substitutions.  This had the unwanted
side-effect that the completion of such processes was then
reported in interactive shells.

Set a flag in such jobs so their completion isn't reported.

Adds 32 bytes.

(GitHub issue #587)
</content>
</entry>
<entry>
<title>hush: placate warning: 'print_pfx_escaped_nl' defined but not used</title>
<updated>2026-05-14T14:22:40+00:00</updated>
<author>
<name>Denys Vlasenko</name>
<email>vda.linux@googlemail.com</email>
</author>
<published>2026-05-14T14:22:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/busybox-w32/commit/?id=0309c029800c9847df1c1514a4c0bfe34ad3066c'/>
<id>urn:sha1:0309c029800c9847df1c1514a4c0bfe34ad3066c</id>
<content type='text'>
Signed-off-by: Denys Vlasenko &lt;vda.linux@googlemail.com&gt;
</content>
</entry>
</feed>
