<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/bin, branch releng/14.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2026-02-01T14:33:50Z</updated>
<entry>
<title>sh: Fix job pointer invalidation with trapsasync</title>
<updated>2026-02-01T14:33:50Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2025-11-17T17:42:01Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=21d665d7dd9e50e3975b117a4f3c0f50ed7bd642'/>
<id>urn:sha1:21d665d7dd9e50e3975b117a4f3c0f50ed7bd642</id>
<content type='text'>
Calling dotrap() can do almost anything, including reallocating the
jobtab array. Convert the job pointer to an index before calling
dotrap() and then restore a proper job pointer afterwards.

PR:		290330
Reported by:	bdrewery
Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D53793

(cherry picked from commit f44ac8cc9c10d7305223a10b8dbd8e234388cc73)
</content>
</entry>
<entry>
<title>sh: Fix a double free in a rare scenario with pipes</title>
<updated>2026-02-01T14:33:50Z</updated>
<author>
<name>Jilles Tjoelker</name>
<email>jilles@FreeBSD.org</email>
</author>
<published>2025-11-15T16:43:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c0dcdc3decb413af6188da624b22aa6b45126317'/>
<id>urn:sha1:c0dcdc3decb413af6188da624b22aa6b45126317</id>
<content type='text'>
The command
  sh -c 'sleep 3 | sleep 2 &amp; sleep 3 &amp; kill %1; wait %1'
crashes (with appropriate sanitization such as putting
MALLOC_CONF=abort:true,junk:true in the environment or compiling with
-fsanitize=address).

What happens here is that waitcmdloop() calls dowait() with a NULL job
pointer, instructing dowait() to freejob() if it's a non-interactive
shell and $! was not and cannot be referenced for it. However,
waitcmdloop() then uses fields possibly freed by freejob() and calls
freejob() again.

This only occurs if the job being waited for is identified via % syntax
($! has never been referenced for it), it is a pipeline with two or more
elements and another background job has been started before the wait
command. That seems special enough for a bug to remain. Test scripts
written by Jilles would almost always use $! and not % syntax.

We can instead make waitcmdloop() pass its job pointer to dowait(),
fixing up things for that (waitcmdloop() will have to call deljob() if
it does not call freejob()).

The crash from
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290330#c2 appears to
be the same bug.

PR:		290330
Reported by:	bdrewery
Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D53773

(cherry picked from commit 75a6c38e4d5c651b7398bf2bea5baa41a0939e92)
</content>
</entry>
<entry>
<title>sh: Avoid referencing uninitialized memory in alias</title>
<updated>2026-01-28T01:03:36Z</updated>
<author>
<name>Joseph Mingrone</name>
<email>jrm@FreeBSD.org</email>
</author>
<published>2025-05-15T14:42:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1b3972ac0f75c659afcd05574878cadaab4d61da'/>
<id>urn:sha1:1b3972ac0f75c659afcd05574878cadaab4d61da</id>
<content type='text'>
If run as
	alias ''
uninitialized memory could be referenced.

This is based on a fix from NetBSD.  For more information, refer to
https://github.com/NetBSD/src/commit/10cfed82c28 .

Obtained from:	NetBSD (Robert Elz &lt;kre@netbsd.org&gt;, 10cfed82c28)
MFC after:	3 days

Reported by:	mckusick, Robert Elz &lt;kre@netbsd.org&gt;
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50364

(cherry picked from commit 9d29fc2e4bfba9fcd3b0944e683458a3f1fa0c47)
</content>
</entry>
<entry>
<title>sh: avoid warnings about too-long initializer strings</title>
<updated>2026-01-02T20:44:28Z</updated>
<author>
<name>Dimitry Andric</name>
<email>dim@FreeBSD.org</email>
</author>
<published>2025-12-25T20:13:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=3cd0026966d0174c7143ac1d8233ed81ffa68ddf'/>
<id>urn:sha1:3cd0026966d0174c7143ac1d8233ed81ffa68ddf</id>
<content type='text'>
Mark `optletter` and `t_op::op_text` as `__non_string`, to avoid
warnings from clang 21 similar to:

    bin/sh/options.h:77:36: error: initializer-string for character array is too long, array size is 19 but initializer has size 20 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
       77 | const char optletter[NSHORTOPTS] = "efIimnsxvVECabupTPh";
          |                                    ^~~~~~~~~~~~~~~~~~~~~
    bin/test/test.c:153:3: error: initializer-string for character array is too long, array size is 2 but initializer has size 3 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
      153 |         {"==",  STREQ},
          |          ^~~~

MFC after:	3 days
Reviewed by:	jilles
Differential Revision: https://reviews.freebsd.org/D54362

(cherry picked from commit e6546807f4c1a8a6a6fa53fceab7b8c80e3ed802)
</content>
</entry>
<entry>
<title>sh: Don't assume EINTR means SIGALRM</title>
<updated>2025-11-25T03:19:16Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-11-19T10:43:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=7f691e07efe63ea01273833e44fd03ee00106b2b'/>
<id>urn:sha1:7f691e07efe63ea01273833e44fd03ee00106b2b</id>
<content type='text'>
While waiting for input in the read builtin, if select() is interrupted
but there is no pending signal, we act like we timed out, and return the
same status as if we had been interrupted by SIGALRM, instead of looping
until we actually do time out.

* Replace the single select() call with a ppoll() loop.

* Improve validation of the timeout value.  We now accept things like
  "1h30m15s", which we used to silently truncate to "1h".  The flip side
  is that we no longer accept things like "1hour" or "5sec".

* Modify the existing `read -t 0` test case to verify that read returns
  immediately when there is input and fails immediately when there isn't.

* Add a second test case which performs the same tests with a non-zero
  timeout value.

PR:		290844
MFC after:	1 week
Fixes:          c4539460e3a4 ("sh: Improve error handling in read builtin:")
Reviewed by:	jilles, bdrewery
Differential Revision:	https://reviews.freebsd.org/D53761

(cherry picked from commit 3c2643a7dbac370b7232f4e5ac15fd77b9ff396d)
</content>
</entry>
<entry>
<title>sh tests: Fix racy test11.0</title>
<updated>2025-11-25T03:19:16Z</updated>
<author>
<name>Bryan Drewery</name>
<email>bdrewery@FreeBSD.org</email>
</author>
<published>2025-11-07T17:28:37Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e9019e777ca3bbb3217df7b54590dcb075430f4e'/>
<id>urn:sha1:e9019e777ca3bbb3217df7b54590dcb075430f4e</id>
<content type='text'>
This was sometimes exiting while the child fifo was created resulting in
[ENOTEMPTY] from rm.  The child fifo isn't needed, just sleep.

PR:	290837
Fixes:	e31fb97148f ("read builtin: Empty variables on timeout")
MFC after:	3 days

(cherry picked from commit 5d55553e160a93788372785300f5bd07c2451f93)
</content>
</entry>
<entry>
<title>date: Improve nanosecond support</title>
<updated>2025-11-19T10:57:39Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-11-11T14:58:23Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b0abbe05dfa144ff6ceabeb317e9493a13c0917d'/>
<id>urn:sha1:b0abbe05dfa144ff6ceabeb317e9493a13c0917d</id>
<content type='text'>
Add support for a field width, which defaults to 9 if unspecified or
zero.  If the width is not exactly 9, we have to either cut off digits
or append zeroes to make up the difference.  If the width is a dash,
we pick a width based on the clock's reported resolution.  This brings
us in line with GNU coreutils.

PR:		287080
MFC after:	1 week
Reviewed by:	0mp
Differential Revision:	https://reviews.freebsd.org/D53667

(cherry picked from commit 38839c872e7af6a1424009bf07d6b4450e9ca61d)
</content>
</entry>
<entry>
<title>date.1: Lint with mandoc</title>
<updated>2025-11-12T09:43:49Z</updated>
<author>
<name>Mateusz Piotrowski</name>
<email>0mp@FreeBSD.org</email>
</author>
<published>2025-11-05T12:34:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=6c185061a63b6db6676c6a24e6bf0802774a07fa'/>
<id>urn:sha1:6c185061a63b6db6676c6a24e6bf0802774a07fa</id>
<content type='text'>
Specifically, remove Tn macors, replace Li with Ql, and escape %N to
address date.1's rendering issues on man.freebsd.org.

PR:		290801
Reported by:	jinwookjeongg@gmail.com
MFC after:	1 week
Sponsored by:	Klara, Inc.

(cherry picked from commit e878ba8eea7206b3a435338c6eed0e4264e0ce14)
</content>
</entry>
<entry>
<title>pwait: Add an option to print remaining processes</title>
<updated>2025-10-30T10:38:18Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-10-28T11:56:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cacba7a15e35857da7adece3bc3cf1a3a2679b9c'/>
<id>urn:sha1:cacba7a15e35857da7adece3bc3cf1a3a2679b9c</id>
<content type='text'>
* On startup, insert all valid PIDs into a tree.
* In our main loop, whenever a process terminates, remove its PID
  from the tree.
* On exit, if the -p flag was specified, print the remaining PIDs.

MFC after:	3 days
Reviewed by:	bcr, markj
Differential Revision:	https://reviews.freebsd.org/D53293

(cherry picked from commit 3d73146baeb933fe955c7496572b483a9f92914c)
</content>
</entry>
<entry>
<title>pwait: Avoid calling getpid(2) for each proc.</title>
<updated>2025-10-30T10:38:18Z</updated>
<author>
<name>Bryan Drewery</name>
<email>bdrewery@FreeBSD.org</email>
</author>
<published>2025-10-10T18:00:35Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=4e06e622b1070b618ecb37afa5ba5876f913a682'/>
<id>urn:sha1:4e06e622b1070b618ecb37afa5ba5876f913a682</id>
<content type='text'>
(cherry picked from commit ab4abce6c2c2091a3b9ea1f38cbef94ee7a68090)
</content>
</entry>
</feed>
