<?xml version="1.0" encoding="utf-8"?>
<!--RSS generated by Flaimo.com RSS Builder [2026-04-05 11:57:26]-->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><docs>https://www.austingroupbugs.net/</docs><link>https://www.austingroupbugs.net/</link><description><![CDATA[Austin Group Issue Tracker - Issues]]></description><title>Austin Group Issue Tracker - Issues</title><image><title>Austin Group Issue Tracker - Issues</title><url>https://www.austingroupbugs.net/images/AG_HEADER.png</url><link>https://www.austingroupbugs.net/</link><description><![CDATA[Austin Group Issue Tracker - Issues]]></description></image><language>en</language><category>All Projects</category><ttl>10</ttl><dc:language>en</dc:language><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><item><title>0001979: conflicting specification for open("existing-directory", O_RDONLY | O_CREAT, 0644)</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1979</link><description><![CDATA[The description of open() explains O_CREAT with a paragraph that starts:&lt;br /&gt;
&lt;br /&gt;
O_CREAT   If the file exists, this flag has no effect except as noted under O_EXCL below.  &lt;...&gt;&lt;br /&gt;
&lt;br /&gt;
'file' is of course the XBD 'file' which includes directories, devices, etc.  So, open(O_RDONLY|O_CREAT) naming a directory that exists should behave the same as open(O_RDONLY) of that same path.&lt;br /&gt;
&lt;br /&gt;
Then later the ERRORS section contradicts that:&lt;br /&gt;
&lt;br /&gt;
[EISDIR]    The named file is a directory and oflag includes O_WRONLY or O_RDWR, or&lt;br /&gt;
                  includes O_CREAT without O_DIRECTORY, or &lt;...&gt;]]></description><category>System Interfaces</category><pubDate>Sun, 05 Apr 2026 05:13:40 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1979</guid><comments>https://www.austingroupbugs.net/view.php?id=1979#bugnotes</comments></item><item><title>0001966: Current/previous job definition scattered and ambiguous</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1966</link><description><![CDATA[POSIX defines the &quot;current job&quot; as:&lt;br /&gt;
&lt;br /&gt;
&gt; In the context of job control, the job that will be used as&lt;br /&gt;
&gt; the default for the fg or bg utilities.&lt;br /&gt;
&lt;br /&gt;
(&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap03.html#tag_03_93&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap03.html#tag_03_93&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
With the fg utility specification stating:&lt;br /&gt;
&lt;br /&gt;
&gt; no job_id operand is given, the job_id for the job that was&lt;br /&gt;
&gt; most recently suspended, placed in the background, or run as a&lt;br /&gt;
&gt; background job shall be used.&lt;br /&gt;
&lt;br /&gt;
(&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/fg.html&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/fg.html&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
Previous job is defined as:&lt;br /&gt;
&lt;br /&gt;
&gt; In the context of job control, the job that will be used as&lt;br /&gt;
&gt; the default for the fg or bg utilities if the current job&lt;br /&gt;
&gt; exits.&lt;br /&gt;
&lt;br /&gt;
(&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/V1_chap03.html#tag_03_286&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/V1_chap03.html#tag_03_286&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
We however need to refer to the &quot;jobs&quot; utility specification to&lt;br /&gt;
make some sense out of that:&lt;br /&gt;
&lt;br /&gt;
&gt; The character '+' identifies the job that would be used as a&lt;br /&gt;
&gt; default for the fg or bg utilities; this job can also be&lt;br /&gt;
&gt; specified using the job_id %+ or &quot;%%&quot;. The character '-'&lt;br /&gt;
&gt; identifies the job that would become the default if the&lt;br /&gt;
&gt; current default job were to exit; this job can also be&lt;br /&gt;
&gt; specified using the job_id %-. For other jobs, this field is a&lt;br /&gt;
&gt; &lt;space&gt;. At most one job can be identified with '+' and at&lt;br /&gt;
&gt; most one job can be identified with '-'. If there is any&lt;br /&gt;
&gt; suspended job, then the current job shall be a suspended job.&lt;br /&gt;
&gt; If there are at least two suspended jobs, then the previous&lt;br /&gt;
&gt; job also shall be a suspended job.&lt;br /&gt;
&lt;br /&gt;
(&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/jobs.html&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/jobs.html&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
That suggests &quot;the job_id for the job that was most recently&lt;br /&gt;
suspended, placed in the background, or run as a background job&lt;br /&gt;
shall be used&quot; from the &quot;current job&quot; definition is to be&lt;br /&gt;
interpreted as:&lt;br /&gt;
1. the most recently suspend job if there are suspended jobs&lt;br /&gt;
2. if not, the job most recently &quot;placed in the background&quot;&lt;br /&gt;
(whatever that means) if there are some.&lt;br /&gt;
3. if not the job most recently started in background.&lt;br /&gt;
&lt;br /&gt;
As far I know, the only ways to &quot;place&quot; a job in the background&lt;br /&gt;
are to suspend them whilst they are in foreground or start them&lt;br /&gt;
in background in the first place, so there are several ways to&lt;br /&gt;
interpret that &quot;2&quot; above:&lt;br /&gt;
&lt;br /&gt;
a) 3 is redundant but it's to emphasis that it's the time of&lt;br /&gt;
last suspend (whilst in foreground, or not, to be clarified)&lt;br /&gt;
that's important for those jobs that have been suspended.&lt;br /&gt;
b) it's to say that jobs that have ever been suspended (have&lt;br /&gt;
ever been in foreground before) take precedence over jobs that&lt;br /&gt;
were started in background in the first place and were never&lt;br /&gt;
suspended.&lt;br /&gt;
c) maybe &quot;resumed in background&quot; (by way of bg or any other way&lt;br /&gt;
SIGCONT is delivered) was intended instead of &quot;placed in&lt;br /&gt;
background&quot;.&lt;br /&gt;
&lt;br /&gt;
The Rationale there also has:&lt;br /&gt;
&lt;br /&gt;
&gt; The job control features provided by bg, fg, and jobs are&lt;br /&gt;
&gt; based on the KornShell. The standard developers examined the&lt;br /&gt;
&gt; characteristics of the C shell versions of these utilities and&lt;br /&gt;
&gt; found that differences exist. Despite widespread use of the C&lt;br /&gt;
&gt; shell, the KornShell versions were selected for this volume of&lt;br /&gt;
&gt; POSIX.1-2024 to maintain a degree of uniformity with the rest&lt;br /&gt;
&gt; of the KornShell features selected (such as the very popular&lt;br /&gt;
&gt; command line editing features).&lt;br /&gt;
&lt;br /&gt;
However, testing ksh88 from Solaris 11.4's /usr/xpg4/bin/sh and&lt;br /&gt;
ksh93u+m/1.0.8 2024-01-01, those are clearly not compliant, as&lt;br /&gt;
&lt;br /&gt;
$ sleep 1001&lt;br /&gt;
^Z[1] + Stopped                  sleep 1001&lt;br /&gt;
$ sleep 1002 &amp;&lt;br /&gt;
[2]     20308&lt;br /&gt;
$ jobs&lt;br /&gt;
[2] +  Running                 sleep 1002 &amp;&lt;br /&gt;
[1] - Stopped                  sleep 1001&lt;br /&gt;
&lt;br /&gt;
The suspended job is not made the current job, whilst that's the&lt;br /&gt;
part that is clearly unambiguous in the spec in the description&lt;br /&gt;
of the jobs utility.&lt;br /&gt;
&lt;br /&gt;
In practice, I see a lot of variation between implementations,&lt;br /&gt;
and I don't think I've come across one that fully implements any&lt;br /&gt;
of the interpretations listed above.]]></description><category>Shell and Utilities</category><pubDate>Thu, 02 Apr 2026 15:10:37 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1966</guid><comments>https://www.austingroupbugs.net/view.php?id=1966#bugnotes</comments></item><item><title>0001978: Standardize .shrc as the default interactive sh start-up file when ENV is unset</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1978</link><description><![CDATA[Many shells support rc files as a way for the user to provide an initialization script for their interactive shell (for example, Bash's .bashrc and the Korn family's .kshrc). However, there is no standard location that the user can rely on for a portable POSIX sh initialization script across compliant systems. The only standard user initialization mechanism in POSIX sh is the ENV environment variable, but that mechanism is only useful if ENV has first been set, typically by a login profile or by implementation-specific start-up processing, and in existing practice it is also used either directly as the interactive initialization file or to name a shell-specific rc file.&lt;br /&gt;
&lt;br /&gt;
The following is a proposal to introduce the .shrc file to be used by interactive sh when the ENV variable is not set. This preserves the precedence of the existing standard mechanism, which already commonly takes precedence over per-shell rc-file initialization, and provides a standard fallback location for portable POSIX sh use. This mechanism is essentially the analogue in POSIX sh of the POSIX ex/vi .exrc file (where EXINIT takes precedence over .exrc), and some of the wording has been borrowed from its definition.]]></description><category>Shell and Utilities</category><pubDate>Wed, 01 Apr 2026 00:29:09 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1978</guid><comments>https://www.austingroupbugs.net/view.php?id=1978#bugnotes</comments></item><item><title>0001970: exit status unclear for iconv -c on invalid input</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1970</link><description><![CDATA[The iconv utility specification has:&lt;br /&gt;
&lt;br /&gt;
&gt; The presence or absence of -c shall not affect the exit status of iconv.&lt;br /&gt;
&lt;br /&gt;
Which suggests that iconv should return the same exit status with -c that it should without.&lt;br /&gt;
&lt;br /&gt;
But the exit status section has:&lt;br /&gt;
&lt;br /&gt;
&gt; &gt;0&lt;br /&gt;
&gt;    An error occurred.&lt;br /&gt;
&lt;br /&gt;
Which seems to be in contradiction.&lt;br /&gt;
&lt;br /&gt;
AFAICT, both the iconv that comes with GNU libc and GNU libiconv exit with status 1 and no error message in:&lt;br /&gt;
&lt;br /&gt;
printf '\303\n' | iconv -c -f UTF-8&lt;br /&gt;
&lt;br /&gt;
For instance and the one from FreeBSD gives no error and exit with 0.&lt;br /&gt;
&lt;br /&gt;
I've not tested other implementations.&lt;br /&gt;
&lt;br /&gt;
BTW, all three implementations exit with 1 and report an error message when the decoding error is found at the end (like in printf '\303' | iconv -c -f UTF-8), which seems to be in breach of the POSIX specification. Not sure whether that's intentional or not.]]></description><category>Shell and Utilities</category><pubDate>Tue, 31 Mar 2026 11:11:40 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1970</guid><comments>https://www.austingroupbugs.net/view.php?id=1970#bugnotes</comments></item><item><title>0001971: Changing lex prefixes</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1971</link><description><![CDATA[The yacc utility has a -p option that allows the use of a prefix other than the default &quot;yy&quot; - which is useful when linking multiple parsers in the same program/library. Alas, lex does not have a similar option even though they are supposed to be used together. This is an interface mismatch.]]></description><category>Shell and Utilities</category><pubDate>Thu, 26 Mar 2026 16:24:10 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1971</guid><comments>https://www.austingroupbugs.net/view.php?id=1971#bugnotes</comments></item><item><title>0001977: posix_spawn_file_actions_addopen and posix_spawn_file_actions_adddup2 contridiction with respect to OPEN_MAX.</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1977</link><description><![CDATA[The ERRORS section for posix_spawn_file_actions_addopen states that it should fail with errno set to EBADF if &quot;The value specified by fildes is negative or greater than or equal to {OPEN_MAX}.&quot; It then goes on to state that &quot;It shall not be considered an error for the fildes argument passed to these functions to specify a file descriptor for which the specified operation could not be performed at the time of the call. Any such error shall be detected when the associated file actions object is later used during a posix_spawn() or posix_spawnp() operation.&quot; The same text is used for posix_spawn_file_actions_adddup2.&lt;br /&gt;
&lt;br /&gt;
On systems where the open file descriptor limit can be changed and OPEN_MAX returns the limit given by RLIMIT_NOFILE, this text is contradictory. The first quoted text suggests that increasing RLIMIT_NOFILE after posix_spawn_file_actions_addopen, but before posix_spawn, is not allowed. The second quoted text suggests that it is allowed.&lt;br /&gt;
&lt;br /&gt;
The description of &lt;a href=&quot;https://austingroupbugs.net/view.php?id=418&quot; rel=&quot;noopener&quot;&gt;https://austingroupbugs.net/view.php?id=418&lt;/a&gt; only mentions the second quoted text for posix_spawn_file_actions_addclose. However, at some point it seems to have changed to &quot;these functions&quot;. Therefore, I think it was probably the intention to make this change.]]></description><category>System Interfaces</category><pubDate>Thu, 26 Mar 2026 05:23:12 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1977</guid><comments>https://www.austingroupbugs.net/view.php?id=1977#bugnotes</comments></item><item><title>0001974: tabs: wrong description of semantics of arbitrary tab stops</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1974</link><description><![CDATA[To get tab stops with a standard interval of 8:&lt;br /&gt;
$ tabs -8&lt;br /&gt;
&lt;br /&gt;
Analogous to that when arbitrary tab stops are used:&lt;br /&gt;
$ tabs 1,9,17,25&lt;br /&gt;
&lt;br /&gt;
Tab stop value:&lt;br /&gt;
&lt;br /&gt;
* is &gt; 0&lt;br /&gt;
* represents a column (left-most being 1) where cursor moves and output occurs after preceding \t character&lt;br /&gt;
* as a special case, the 1st tab stop value is always 1 (whether explicitly specified or not) to demonstrate that without preceding \t character output occurs in the left-most column&lt;br /&gt;
&lt;br /&gt;
The above is true for most common implementation of tabs from ncurses.&lt;br /&gt;
&lt;br /&gt;
I believe that indicated sentence:&lt;br /&gt;
&lt;br /&gt;
&gt; The phrase &quot;tab-stop position N&quot; shall be taken to mean that, from the start&lt;br /&gt;
of a line of output, tabbing to position N shall cause the next character output&lt;br /&gt;
to be in the (N+1)th column position on that line.&lt;br /&gt;
&lt;br /&gt;
is wrong with regards to what actual semantics of operand(s) is.&lt;br /&gt;
&lt;br /&gt;
For additional context, this came up in following:&lt;br /&gt;
&lt;br /&gt;
* &lt;a href=&quot;https://github.com/gwsw/less/issues/737&quot; rel=&quot;noopener&quot;&gt;https://github.com/gwsw/less/issues/737&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I've tried to summarize in following comment:&lt;br /&gt;
&lt;br /&gt;
* &lt;a href=&quot;https://github.com/gwsw/less/issues/737#issuecomment-4033517061&quot; rel=&quot;noopener&quot;&gt;https://github.com/gwsw/less/issues/737#issuecomment-4033517061&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Further of note are comments by &lt;span class=&quot;mention&quot;&gt;&lt;a href=&quot;https://www.austingroupbugs.net/view_user_page.php?id=761&quot;&gt;@avih&lt;/a&gt;&lt;/span&gt; who were instrumental in tracking down&lt;br /&gt;
historical sources of tabs and its documentation.]]></description><category>Shell and Utilities</category><pubDate>Sun, 22 Mar 2026 00:13:58 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1974</guid><comments>https://www.austingroupbugs.net/view.php?id=1974#bugnotes</comments></item><item><title>0001976: specify array variables and syntax</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1976</link><description><![CDATA[POSIX sh specifies one array per function, the argument array&lt;br /&gt;
&lt;br /&gt;
many sh implementations support having array variables past the argument array&lt;br /&gt;
&lt;br /&gt;
due to posix shell specifying a syntax for the argument array, sh implementations&lt;br /&gt;
with array extensions naturally landed on similar and compatible syntax&lt;br /&gt;
&lt;br /&gt;
mksh, ksh93, bash, zsh, osh, yash, all support the following syntax:&lt;br /&gt;
	foo=(a b &quot;c d&quot; e)&lt;br /&gt;
	foo+=(f g)&lt;br /&gt;
	&quot;${foo[@]}&quot; # a b &quot;c d&quot; e f g&lt;br /&gt;
	&quot;${foo[*]}&quot; # &quot;a b c d e f g&quot;&lt;br /&gt;
	&quot;${foo[expr]}&quot; # indexed by expr, where expr is evaluated like $(( expr ))&lt;br /&gt;
	&quot;${#foo[@]}&quot; # 6, the lenght of foo&lt;br /&gt;
&lt;br /&gt;
additionally, mksh, ksh, and zsh, support declaring arrays as such:&lt;br /&gt;
	set -A name -- values&lt;br /&gt;
&lt;br /&gt;
notably ksh does not implement the name=(values) syntax, but has no other syntax&lt;br /&gt;
that would conflict with it either&lt;br /&gt;
&lt;br /&gt;
ash and dash do not currently implement any sort of arrays, but also have&lt;br /&gt;
no syntax that conflicts with the existing extensions]]></description><category>Shell and Utilities</category><pubDate>Fri, 13 Mar 2026 21:10:07 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1976</guid><comments>https://www.austingroupbugs.net/view.php?id=1976#bugnotes</comments></item><item><title>0001975: at_quick_exit Description in Search Results has Stray Characters</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1975</link><description><![CDATA[When searching for _exit at &lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9799919799/,&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9799919799/,&lt;/a&gt; the search results pane shows these results:&lt;br /&gt;
&lt;br /&gt;
_Exit, _exit — terminate a process&lt;br /&gt;
at_quick_exit — register a function to to be called from \f2quick_exit()&lt;br /&gt;
pthread_exit — thread termination&lt;br /&gt;
quick_exit — terminate a process&lt;br /&gt;
thrd_exit — thread termination&lt;br /&gt;
&lt;br /&gt;
Notice the &quot;\f2&quot; before quick_exit() on line 2. This error does not appear on the linked to page for quick_exit().]]></description><category>System Interfaces</category><pubDate>Thu, 12 Mar 2026 15:31:40 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1975</guid><comments>https://www.austingroupbugs.net/view.php?id=1975#bugnotes</comments></item><item><title>0001973: awk "numeric string " origins</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1973</link><description><![CDATA[The awk specification (&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html#tag_20_06_13_02&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html#tag_20_06_13_02&lt;/a&gt;) has:&lt;br /&gt;
&lt;br /&gt;
&lt;&lt;&lt;&lt;br /&gt;
 A string value shall be considered a numeric string if it comes from one of the following:&lt;br /&gt;
&lt;br /&gt;
     1. Field variables&lt;br /&gt;
     2. Input from the getline() function&lt;br /&gt;
     3. FILENAME&lt;br /&gt;
     4. ARGV array elements&lt;br /&gt;
     5. ENVIRON array elements&lt;br /&gt;
     6. Array elements created by the split() function&lt;br /&gt;
     7. A command line variable assignment&lt;br /&gt;
     8. Variable assignment from another numeric string variable&lt;br /&gt;
&gt;&gt;&gt;&lt;br /&gt;
&lt;br /&gt;
It can be interpreted as meaning that&lt;br /&gt;
&lt;br /&gt;
awk 'BEGIN{$1 = &quot;10&quot;; print ($1 &gt; 2)}'&lt;br /&gt;
&lt;br /&gt;
should return 1 for instance. But no implementation that I know does so. By assigning a string to $1, it loses that special property whereby when containing a string that looks like a number it shall be considered as a number.&lt;br /&gt;
&lt;br /&gt;
Same applies for ARGV, FILENAME...&lt;br /&gt;
&lt;br /&gt;
Typo in rationale section btw:&lt;br /&gt;
&lt;br /&gt;
&gt; also shall have the numeric value of the numeric string&quot; was removed&lt;br /&gt;
&gt;from several sections of the ISO POSIX-2:1993 standard because *is* &lt;br /&gt;
&gt; specifies an unnecessary implementation detail&lt;br /&gt;
&lt;br /&gt;
is -&gt; it]]></description><category>Shell and Utilities</category><pubDate>Sat, 07 Mar 2026 11:48:05 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1973</guid><comments>https://www.austingroupbugs.net/view.php?id=1973#bugnotes</comments></item><item><title>0001972: Determinism in POSIX Utilities</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1972</link><description><![CDATA[This ticket concerns determinism in POSIX utilities: the property that, for a given implementation, invoking a utility with the same declared inputs (options, operands, input files, and specified environment) yields the same observable results.&lt;br /&gt;
&lt;br /&gt;
This property is increasingly important in modern software development and distribution practices, including artifact signing, verification, auditing, and what is commonly referred to as reproducible builds. Many widely used systems and projects rely on deterministic tool behavior as an implicit assumption when building software and producing distributable artifacts, including: Arch Linux, Debian, Fedora, openSUSE, FreeBSD, NetBSD, GNU Guix, Tor, etc.&lt;br /&gt;
&lt;br /&gt;
The intent of this proposal is not to address interoperability between different systems or implementations. Rather, it concerns intra-implementation behavior. In particular, running the same utility with the same options, operands, input files, and relevant environment on the same system should not produce different results due to undeclared or arbitrary factors such as the current time or date, process identifiers, randomness, or unrelated filesystem state, except where such behavior is explicitly permitted by the specification.&lt;br /&gt;
&lt;br /&gt;
For example, invoking:&lt;br /&gt;
&lt;br /&gt;
    c17 foo.c&lt;br /&gt;
&lt;br /&gt;
is not expected to produce identical output across different systems or implementations. However, invoking the same command multiple times on the same system with the same inputs should not result in observably different output solely due to nondeterministic implementation choices. On the flip side,&lt;br /&gt;
&lt;br /&gt;
    c17 foo.c bar.c&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
    c17 bar.c foo.c&lt;br /&gt;
&lt;br /&gt;
should be allowed to produce different results if the implementation so chooses.&lt;br /&gt;
&lt;br /&gt;
This proposal is concerned with utilities whose output formats or behaviors are partially or fully unspecified by POSIX, yet for which deterministic behavior is reasonably expected. Examples include, but are not limited to, ar, c17, delta, lex, pax, and yacc.]]></description><category>Shell and Utilities</category><pubDate>Thu, 05 Mar 2026 16:55:48 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1972</guid><comments>https://www.austingroupbugs.net/view.php?id=1972#bugnotes</comments></item><item><title>0001969: strptime() %y with a 1 digit field</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1969</link><description><![CDATA[The strptime() %y description says it is the &quot;last 2 digits of the year&quot; but this is misleading, as later text makes it clear the field can have 1 digit.&lt;br /&gt;
&lt;br /&gt;
Specifically, the description of %y says &quot;leading zeros shall be permitted but shall not be required&quot;. Since leading zeros are not required, a single digit input field is explicitly permitted, e.g. &quot;1&quot; is allowed; it doesn't have to be &quot;01&quot;. Likewise, the statement &quot;A leading '+' or '-' character shall be permitted&quot; means that there is no requirement for there to be two digits because the only way for a 2-character field to have a leading '+' or '-' is if the second character is the only digit.]]></description><category>System Interfaces</category><pubDate>Thu, 05 Mar 2026 16:23:09 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1969</guid><comments>https://www.austingroupbugs.net/view.php?id=1969#bugnotes</comments></item><item><title>0001968: All "pure" functions (including unspecified ones) must be safe with regard to async signals, or no signal handler is.</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1968</link><description><![CDATA[It is common practice in compilers, to generate code using inline functions provided by the runtime that're internal to the implementation, most notably, libgcc_s emit 64-bit arithmetic codes for 32-bit targets. Setting aside the relevance of 32-bit system aside first, the capability of CPUs vary from one architecture to another, so there necessitates these kind of inline stubs on some architecture while not on others.&lt;br /&gt;
&lt;br /&gt;
However, the standard currently says:&lt;br /&gt;
&lt;br /&gt;
&gt; All other functions (including generic functions) and function-like macros may be unsafe with respect to signals&lt;br /&gt;
&lt;br /&gt;
making essentially any code that does anything other than calling async-signal safe functions unsafe.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
I propose that, we define &quot;pure&quot; functions and declare this class of functions safe in signal handlers - typical characteristic of these functions include:&lt;br /&gt;
1. their behavior is deterministic with regard to their inputs (and their state should we decide to allow them to keep state),&lt;br /&gt;
2. they do not modify the memory of its callers unless a non-const-qualified pointer is explicitly given,&lt;br /&gt;
3. any state they keep (should we decide to allow it) are have access semantic that're safe with regard to signals.&lt;br /&gt;
&lt;br /&gt;
C23 has introduced 'attributes', some of which are geared towards permitting compiler optimizing calls to &quot;pure&quot; functions, so we can consult their text during word smithing.]]></description><category>System Interfaces</category><pubDate>Thu, 26 Feb 2026 16:31:54 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1968</guid><comments>https://www.austingroupbugs.net/view.php?id=1968#bugnotes</comments></item><item><title>0001967: &lt;math.h&gt; still references old IEEE-754 standard issued in 1985.</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1967</link><description><![CDATA[Current spec says:&lt;br /&gt;
&lt;br /&gt;
&lt;dl&gt;&lt;br /&gt;
&lt;dd&gt;&lt;/dd&gt;&lt;br /&gt;
&lt;dt&gt;HUGE_VAL&lt;/dt&gt;&lt;br /&gt;
&lt;dd&gt;A positive &lt;b&gt;double&lt;/b&gt; constant expression, not necessarily representable as a &lt;b&gt;float&lt;/b&gt;. Used as an error value returned&lt;br /&gt;
by the mathematics library. HUGE_VAL evaluates to +infinity on systems supporting IEEE&nbsp;Std&nbsp;754-1985.&lt;/dd&gt;&lt;br /&gt;
&lt;dt&gt;HUGE_VALF&lt;/dt&gt;&lt;br /&gt;
&lt;dd&gt;A positive &lt;b&gt;float&lt;/b&gt; constant expression. Used as an error value returned by the mathematics library. HUGE_VALF evaluates to&lt;br /&gt;
+infinity on systems supporting IEEE&nbsp;Std&nbsp;754-1985.&lt;/dd&gt;&lt;br /&gt;
&lt;dt&gt;HUGE_VALL&lt;/dt&gt;&lt;br /&gt;
&lt;dd&gt;A positive &lt;b&gt;long double&lt;/b&gt; constant expression. Used as an error value returned by the mathematics library. HUGE_VALL&lt;br /&gt;
evaluates to +infinity on systems supporting IEEE&nbsp;Std&nbsp;754-1985.&lt;/dd&gt;&lt;br /&gt;
&lt;dt&gt;INFINITY&lt;/dt&gt;&lt;br /&gt;
&lt;dd&gt;A constant expression of type &lt;b&gt;float&lt;/b&gt; representing positive or unsigned infinity, if available; else a positive constant&lt;br /&gt;
of type &lt;b&gt;float&lt;/b&gt; that overflows at translation time.&lt;/dd&gt;&lt;br /&gt;
&lt;dt&gt;NAN&lt;/dt&gt;&lt;br /&gt;
&lt;dd&gt;A constant expression of type &lt;b&gt;float&lt;/b&gt; representing a quiet NaN. This macro is only defined if the implementation supports&lt;br /&gt;
quiet NaNs for the &lt;b&gt;float&lt;/b&gt; type.&lt;/dd&gt;&lt;br /&gt;
&lt;/dl&gt;&lt;br /&gt;
&lt;br /&gt;
which made reference to the older floating point standard published in 1985, when a revised IEEE-754-2019 is available.]]></description><category>Base Definitions and Headers</category><pubDate>Thu, 26 Feb 2026 16:13:57 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1967</guid><comments>https://www.austingroupbugs.net/view.php?id=1967#bugnotes</comments></item><item><title>0001965: Why isn't pthread_equal async-signal safe?</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1965</link><description><![CDATA[Currently there are 4 pthread_* functions that're async-signal-safe, including pthread_self.&lt;br /&gt;
&lt;br /&gt;
IMHO, there's no reason to not make pthread_equal safe, unless during some thread control operation, some function would modify the internal data structure if pthread_t is not a scalar.&lt;br /&gt;
&lt;br /&gt;
Additionally, unless some implementation _does_ alter pthread_t handle, I think it's perfectly fine to require that the arguments be const-qualified, or that pthread_t be a pointer to a const-qualified data structure.]]></description><category>System Interfaces</category><pubDate>Tue, 17 Feb 2026 10:58:46 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1965</guid><comments>https://www.austingroupbugs.net/view.php?id=1965#bugnotes</comments></item><item><title>0001963: sccs create should use get</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1963</link><description><![CDATA[The sccs frontend to the SCCS utilities performs a get operation after a successful create operation. The way POSIX currently defines create is actually how many implementations implement the enter operation, not defined by POSIX. While this behavior is not made explicit by man pages in several of the below flavors, they are all confirmed by either the source code or by non-man vendor documentation:&lt;br /&gt;
&lt;br /&gt;
1. Sun SCCS (&lt;a href=&quot;https://docs.oracle.com/cd/E19504-01/802-5880/6i9k05dhr/index.html&quot; rel=&quot;noopener&quot;&gt;https://docs.oracle.com/cd/E19504-01/802-5880/6i9k05dhr/index.html&lt;/a&gt;)&lt;br /&gt;
2. IBM AIX SCCS (&lt;a href=&quot;https://www.ibm.com/docs/en/rational-synergy/7.2.1?topic=terms-using-creating-adding-deleting-removing-objects&quot; rel=&quot;noopener&quot;&gt;https://www.ibm.com/docs/en/rational-synergy/7.2.1?topic=terms-using-creating-adding-deleting-removing-objects&lt;/a&gt;)&lt;br /&gt;
3. Heirloom SCCS (sccs.c: line 108)&lt;br /&gt;
4. schilytools SCCS (sccs.c: line 126)&lt;br /&gt;
5. GNU CSSC (sccs.c: line 206)]]></description><category>Shell and Utilities</category><pubDate>Tue, 17 Feb 2026 10:58:08 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1963</guid><comments>https://www.austingroupbugs.net/view.php?id=1963#bugnotes</comments></item><item><title>0001961: assert.h lacks static_assert macro</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1961</link><description><![CDATA[C11 introduced the &lt;i&gt;static_assert&lt;/i&gt;() macro, which C17 kept (and C23 transformed into a keyword).]]></description><category>Base Definitions and Headers</category><pubDate>Tue, 17 Feb 2026 10:57:37 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1961</guid><comments>https://www.austingroupbugs.net/view.php?id=1961#bugnotes</comments></item><item><title>0001959: dd conv=lcase and conv=ucase should only translate single byte locales</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1959</link><description><![CDATA[The `conv=lcase` and `conv=ucase` to `dd` require that conversion be done as specified by `LC_CTYPE`. Here is the description of `conv=lcase`, for reference:&lt;br /&gt;
&lt;br /&gt;
&gt; Map uppercase characters specified by the LC_CTYPE keyword tolower to the corresponding lowercase character. Characters for which no mapping is specified shall not be modified by this conversion.&lt;br /&gt;
&lt;br /&gt;
This requirement means that if `LC_CTYPE` is a multibyte locale, one may have to read across block boundaries to have a full character for case conversion.  For example using 512-byte blocks, a UTF-8 character like д, encoded as 0xd0 0xb4, might have 0xd0 at byte 512 of the first block and byte 0xb4 at byte 1 of the second block. This is not a problem if `dd` behaves on single bytes instead of characters.&lt;br /&gt;
&lt;br /&gt;
However, introducing case conversion means we we must read entire multibyte characters, even if they extend across a block. Also complicating factor is that case conversion may change the length of the character in Unicode. Take the following example:&lt;br /&gt;
&lt;br /&gt;
    $ python3 -c 'print(len(&quot;ß&quot;))'&lt;br /&gt;
    1&lt;br /&gt;
    $ python3 -c 'print(len(&quot;ß&quot;.upper()))'&lt;br /&gt;
    2&lt;br /&gt;
&lt;br /&gt;
If we have an input block containing all ASCII characters and `ß` as the last character, using `conv=ucase,sync bs=512` would result in a 512-byte output block followed a second block contains the second byte of uppercase `ß` and 511 NUL bytes. This is probably not what someone expects when using `dd`.]]></description><category>Shell and Utilities</category><pubDate>Fri, 23 Jan 2026 12:09:00 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1959</guid><comments>https://www.austingroupbugs.net/view.php?id=1959#bugnotes</comments></item><item><title>0001913: clarify/define the meaning of n&lt;&amp;n and m&gt;&amp;m redirections</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1913</link><description><![CDATA[Hey.&lt;br /&gt;
&lt;br /&gt;
This originated from a thread that started at&lt;br /&gt;
&lt;a href=&quot;https://collaboration.opengroup.org/operational/mailarch.php?soph=N&amp;action=show&amp;archive=austin-group-l&amp;num=38114&amp;limit=100&amp;offset=100&amp;sid=&quot; rel=&quot;noopener&quot;&gt;https://collaboration.opengroup.org/operational/mailarch.php?soph=N&amp;action=show&amp;archive=austin-group-l&amp;num=38114&amp;limit=100&amp;offset=100&amp;sid=&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In short:&lt;br /&gt;
The motivation was whether it's possible to portably differentiate whether a non-zero exit status originated from a utility or failed redirection on that.&lt;br /&gt;
The idea was that, with the clarifications from #1879 and assuming that there is at least on exit status which a utility is known not to use, a construct like the following:&lt;br /&gt;
   ( command exec &lt;some redirections&gt; || exit 125; utility )&lt;br /&gt;
where the subshell is merely to clean up any redirections, can be used to differentiate between a redirection error (which above would be indicated by 125) or a non-zero exit status from the utility.&lt;br /&gt;
&lt;br /&gt;
For file descriptors less than or equal to 2, this should already be guaranteed to work portably, as POSIX demands those to be passed on to the utility.&lt;br /&gt;
For FDs greater than two, this is no longer guaranteed, though.&lt;br /&gt;
&lt;br /&gt;
An idea was brought up by Harald van Dijk, that n&lt;&amp;n and m&gt;&amp;m could be used e.g.:&lt;br /&gt;
   ( command exec &lt;some redirections&gt; || exit 125; utility n&lt;&amp;n... m&gt;&amp;m... )&lt;br /&gt;
in order to &quot;manually&quot; pass on on any such FDs.&lt;br /&gt;
&lt;br /&gt;
Questions remained:&lt;br /&gt;
a) Does that behaviour even follow from POSIX (in an obvious way where it's really clear that shells should behave like this, not just some wobbly way)&lt;br /&gt;
b) Does it even solve the original problem, or could e.g. such a n&lt;&amp;n respectively m&gt;&amp;m fail itself (not e.g. because a file doesn't exist, but because of something like resource exhaustion, etc.)&lt;br /&gt;
&lt;br /&gt;
When the original thread was continued a bit later at:&lt;br /&gt;
&lt;a href=&quot;https://collaboration.opengroup.org/operational/mailarch.php?soph=N&amp;action=show&amp;archive=austin-group-l&amp;num=38279&amp;limit=100&amp;offset=0&amp;sid=&quot; rel=&quot;noopener&quot;&gt;https://collaboration.opengroup.org/operational/mailarch.php?soph=N&amp;action=show&amp;archive=austin-group-l&amp;num=38279&amp;limit=100&amp;offset=0&amp;sid=&lt;/a&gt;&lt;br /&gt;
it apparently turned out that n&lt;&amp;n and m&gt;&amp;m redirections are not defined because POSIX uses the wordings:&lt;br /&gt;
&quot;The redirection operator: [n]&lt;&amp;word shall duplicate one input file descriptor from another&quot;&lt;br /&gt;
respectively&lt;br /&gt;
&quot;The redirection operator: [n]&gt;&amp;word shall duplicate one output file descriptor from another&quot;&lt;br /&gt;
i.e. one from another, implying the two must not be the same, as Geoff Clare pointed out.]]></description><category>Shell and Utilities</category><pubDate>Tue, 13 Jan 2026 17:09:10 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1913</guid><comments>https://www.austingroupbugs.net/view.php?id=1913#bugnotes</comments></item><item><title>0001958: typo in if_indextoname(3)</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1958</link><description><![CDATA[In the CHANGE HISTORY section {IF_NAMESIZE} is misspelled as {IF_NAMESIZ}.]]></description><category>System Interfaces</category><pubDate>Tue, 13 Jan 2026 17:03:21 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1958</guid><comments>https://www.austingroupbugs.net/view.php?id=1958#bugnotes</comments></item><item><title>0001954: please allow shells to unignore signals</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1954</link><description><![CDATA[The specification of the trap utility has:&lt;br /&gt;
&lt;br /&gt;
&lt;&lt;&lt;&lt;br /&gt;
Signals that were ignored on entry to a non-interactive shell cannot be trapped or reset, although no error need be reported when attempting to do so. An interactive shell may reset or catch signals ignored on entry.&lt;br /&gt;
&gt;&gt;&gt;&lt;br /&gt;
&lt;br /&gt;
In this day and age, that requirement is unhelpful and annoying. That means one has to resort to things like perl or shells that ignore that requirement to work around it. For example, to make sure SIGPIPE is not ignored:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;#! /bin/sh -
if [ -n &quot;$RESTORED_SIGPIPE&quot; ]; then
  unset -v RESTORED_SIGPIPE
else
  RESTORED_SIGPIPE=1 exec perl -e '$SIG{PIPE} = &quot;DEFAULT&quot;; exec @ARGV' -- &quot;$0&quot; &quot;$@&quot;
fi&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I guess POSIX introduced that requirement because that's what the Bourne shell or ksh88 did back then, and they likely did it because they were written before BSD job control was invented in the 80s, so handling of &quot;background&quot; jobs was done by ignoring SIGINT/SIGQUIT, and restoring their disposition in those jobs would defeat that.&lt;br /&gt;
&lt;br /&gt;
Nowadays, we should no longer need that. In any case, even back then that requirement would not make sense in an interactive shell which likely explains why POSIX doesn't mandate it there.&lt;br /&gt;
&lt;br /&gt;
So unless there's another good reason that still holds today (but I doubt so, zsh has been ignoring that for 35 years and I don't think anyone ever complained), I'd suggest dropping it.&lt;br /&gt;
&lt;br /&gt;
That comes back regularly in usenet or stackexchange discussions, with one of the work arounds being to switch shell to zsh.]]></description><category>Shell and Utilities</category><pubDate>Tue, 13 Jan 2026 17:02:40 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1954</guid><comments>https://www.austingroupbugs.net/view.php?id=1954#bugnotes</comments></item><item><title>0001953: getdelim() behavior is ambiguous on empty file</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1953</link><description><![CDATA[When Issue 7 added getdelim() and getline() in 2008, the intent was that we would be standardizing the interface already implemented by glibc at the time.&lt;br /&gt;
&lt;br /&gt;
However, a recent glibc bug report complained that the wording in POSIX disagrees with the behavior of glibc when calling getdelim() on an empty file: &lt;a href=&quot;https://sourceware.org/bugzilla/show_bug.cgi?id=28038&quot; rel=&quot;noopener&quot;&gt;https://sourceware.org/bugzilla/show_bug.cgi?id=28038.&lt;/a&gt;  According to the bug report, if the file is empty, then getdelim() immediately encounters end-of-file and must return -1, but even though it is returning -1, it is NOT returning an error (errno is not set and the stream error indicator is clear), so the argument was that POSIX requires *lineptr to be an empty string (truncating any contents already in lineptr from an earlier invocation).  But the glibc behavior at the time POSIX added the interface was to leave the contents of *lineptr unchanged unless returning a non-negative value for success (although lineptr itself might be modified, as it could have been allocated prior to detecting end-of-file).&lt;br /&gt;
&lt;br /&gt;
So glibc recently patched its behavior to guarantee that on encountering EOF that a NUL terminator is added, but this has the observable side effect that where you could previously use a loop of getline() until returning -1 to grab the last line of a file (think, for example, of the summary line of a du invocation), now such a loop leaves lineptr on an empty string rather than the last line of the file.&lt;br /&gt;
&lt;br /&gt;
While POSIX is clear that encountering EOF on success must use a null terminator, it is less obvious whether returning -1 falls under the same rules, or whether POSIX should have allowed the traditional glibc behavior.  On the one hand, guaranteeing that a non-NULL lineptr always has a null terminator even when getdelim() fails makes it harder for a programmer mistake to escalate into a SEGFAULT for reading beyond the bounds of the array.  On the other hand, forcefully terminating lineptr to an empty string after the last non-empty line with a proper terminator takes away a convenient access to the contents of the last line of a file, although it is not quite obvious whether that was ever portable.&lt;br /&gt;
&lt;br /&gt;
The desired action lists two approaches: one to relax things to explicitly permit the older glibc behavior and warn the user that the contents of *lineptr are not necessarily usable on a return of -1 (although this still does not guarantee stable access to the last line of the file); the other to tighten the specification to mandate that any time *lineptr is returned non-NULL, it must be null terminated even if the overall function fails for any other reason.  I'm not sure which of the two options the group will prefer.]]></description><category>System Interfaces</category><pubDate>Tue, 13 Jan 2026 17:01:21 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1953</guid><comments>https://www.austingroupbugs.net/view.php?id=1953#bugnotes</comments></item><item><title>0001952: (n)gettext and NLSPATH</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1952</link><description><![CDATA[On XSI systems, gettext and ngettext require NLSPATH to take precedence over TEXTDOMAINDIR. This is undesirable because it means every one-off script using translations has to install its translation files in the system's global locale directory. Should such scripts instead choose to change NLSPATH to, say, a local subdirectory then all other utilities used by the script (including gettext/ngettext) would lose access to their own translations. Imagine a situation where in order to use an install script you have to first install its messages/catalogs.]]></description><category>Shell and Utilities</category><pubDate>Tue, 13 Jan 2026 16:59:52 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1952</guid><comments>https://www.austingroupbugs.net/view.php?id=1952#bugnotes</comments></item><item><title>0001951: getopts example oversight</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1951</link><description><![CDATA[The example snippet handles ? instead of \?. It still works but only by accident (the ? wildcard still matches the literal question mark returned by getopts) because no other options are handled after it.]]></description><category>Shell and Utilities</category><pubDate>Tue, 13 Jan 2026 16:58:04 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1951</guid><comments>https://www.austingroupbugs.net/view.php?id=1951#bugnotes</comments></item><item><title>0001949: Restore the traditional realloc(3) specification</title><author></author><link>https://www.austingroupbugs.net/view.php?id=1949</link><description><![CDATA[Name&lt;br /&gt;
	alx-p0001r0 - Restore the traditional realloc(3) specification&lt;br /&gt;
&lt;br /&gt;
Category&lt;br /&gt;
	Remove UB.&lt;br /&gt;
&lt;br /&gt;
[ADMINISTRATOR EDIT: removed personal email addresses from Description]&lt;br /&gt;
&lt;br /&gt;
History&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.alejandro-colomar.es/src/alx/alx/std/posix/alx-p0001.git/&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.alejandro-colomar.es/src/alx/alx/std/posix/alx-p0001.git/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
	alx-0029r0 (2025-06-17):&lt;br /&gt;
	-  Initial draft.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r1 (2025-06-20):&lt;br /&gt;
	-  Full rewrite after the recent glibc discussion.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r2 (2025-06-21):&lt;br /&gt;
	-  Remove CC.  Add CC.&lt;br /&gt;
	-  wfix.&lt;br /&gt;
	-  Drop quote.&lt;br /&gt;
	-  Add a few more principles&lt;br /&gt;
	-  Clarify why ENOMEM is used in this proposal, and make it&lt;br /&gt;
	   optional.&lt;br /&gt;
	-  Mention exceptional leak in code checking (size != 0).&lt;br /&gt;
	-  Clarify that part of the description of realloc can be&lt;br /&gt;
	   editorially removed after this change.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r3 (2025-06-23):&lt;br /&gt;
	-  Fix diff missing line.&lt;br /&gt;
	-  Remove ENOMEM from the proposal.&lt;br /&gt;
	-  Clarify that ENOMEM should be retained by platforms already&lt;br /&gt;
	   using it.&lt;br /&gt;
	-  Add mention that LLVM's address sanitizer will catch the leak&lt;br /&gt;
	   mentioned in r2.&lt;br /&gt;
	-  Add links to real bugs (including an RCE bug).&lt;br /&gt;
&lt;br /&gt;
	alx-0029r4 (2025-06-24):&lt;br /&gt;
	-  Use a better link for the Whatsapp RCE.&lt;br /&gt;
	-  s/Description/Rationale/&lt;br /&gt;
	-  wfix&lt;br /&gt;
	-  Mention that glibc &lt;2.1.1 had the BSD behavior.&lt;br /&gt;
	-  Add footnote that realloc(3) may fail while shrinking.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r5 (2025-06-26):&lt;br /&gt;
	-  It was glibc 2.1.1 that broke it, not glibc 2.2.&lt;br /&gt;
	-  wfix&lt;br /&gt;
	-  Mention in the footnote that the pointer may change.&lt;br /&gt;
	-  Document why not go the other way around.  It was explained&lt;br /&gt;
	   several times during discussion, but people keep suggesting&lt;br /&gt;
	   it.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r6 (2025-06-27; n3621):&lt;br /&gt;
	-  Clarify that the paragraph about what happens when the size&lt;br /&gt;
	   is zero refers to when the total size is zero (for calloc(3)&lt;br /&gt;
	   that is nmemb*size).&lt;br /&gt;
	-  s/Unix V7/V7 Unix/&lt;br /&gt;
	-  tfix.&lt;br /&gt;
	-  wfix.&lt;br /&gt;
&lt;br /&gt;
	Brno meeting (2025-08-27):&lt;br /&gt;
	-  9/13/6&lt;br /&gt;
	-  Along the lines: 21/1/5&lt;br /&gt;
	-  People recognized in the dinner after the meeting, and in the&lt;br /&gt;
	   reflector, and in corridor discussions, that they hadn't&lt;br /&gt;
	   understood the paper, and that it was more well thought than&lt;br /&gt;
	   they initially thought.  They would change their vote to be&lt;br /&gt;
	   in favour with this proposal.&lt;br /&gt;
&lt;br /&gt;
	alx-0029r7 (2025-09-21):&lt;br /&gt;
	-  Add link.&lt;br /&gt;
&lt;br /&gt;
	alx-p0001r0 (2025-09-21):&lt;br /&gt;
	-  Fork POSIX proposal from ISO C proposal.&lt;br /&gt;
&lt;br /&gt;
See also&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.alejandro-colomar.es/src/alx/alx/wg14/alx-0069.git/&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.alejandro-colomar.es/src/alx/alx/wg14/alx-0069.git/&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://nabijaczleweli.xyz/content/blogn_t/017-malloc0.html&gt;&quot; rel=&quot;noopener&quot;&gt;https://nabijaczleweli.xyz/content/blogn_t/017-malloc0.html&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://sourceware.org/pipermail/libc-alpha/1999-April/000956.html&gt;&quot; rel=&quot;noopener&quot;&gt;https://sourceware.org/pipermail/libc-alpha/1999-April/000956.html&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://inbox.sourceware.org/libc-alpha/nbyurzcgzgd5rdybbi4no2kw5grrc32k63svf7oq73nfcbus5r@77gry66kpqfr/&gt;&quot; rel=&quot;noopener&quot;&gt;https://inbox.sourceware.org/libc-alpha/nbyurzcgzgd5rdybbi4no2kw5grrc32k63svf7oq73nfcbus5r@77gry66kpqfr/&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://inbox.sourceware.org/libc-alpha/20241019014002.3684656-1-siddhesh@sourceware.org/T/#u&gt;&quot; rel=&quot;noopener&quot;&gt;https://inbox.sourceware.org/libc-alpha/20241019014002.3684656-1-siddhesh@sourceware.org/T/#u&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://inbox.sourceware.org/libc-alpha/qukfe5yxycbl5v7ooskvqdnm3au3orohbx4babfltegi47iyly@or6dgf7akeqv/T/#u&gt;&quot; rel=&quot;noopener&quot;&gt;https://inbox.sourceware.org/libc-alpha/qukfe5yxycbl5v7ooskvqdnm3au3orohbx4babfltegi47iyly@or6dgf7akeqv/T/#u&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://github.com/bminor/glibc/commit/7c2b945e1fd64e0a5a4dbd6ae6592a7314dcd4b5&gt;&quot; rel=&quot;noopener&quot;&gt;https://github.com/bminor/glibc/commit/7c2b945e1fd64e0a5a4dbd6ae6592a7314dcd4b5&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://github.com/llvm/llvm-project/issues/113065&gt;&quot; rel=&quot;noopener&quot;&gt;https://github.com/llvm/llvm-project/issues/113065&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.austingroupbugs.net/view.php?id=400&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.austingroupbugs.net/view.php?id=400&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.austingroupbugs.net/view.php?id=526&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.austingroupbugs.net/view.php?id=526&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.austingroupbugs.net/view.php?id=688&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.austingroupbugs.net/view.php?id=688&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://sourceware.org/bugzilla/show_bug.cgi?id=12547&gt;&quot; rel=&quot;noopener&quot;&gt;https://sourceware.org/bugzilla/show_bug.cgi?id=12547&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n868.htm&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n868.htm&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2438.htm&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2438.htm&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2464.pdf&gt;&quot; rel=&quot;noopener&quot;&gt;https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2464.pdf&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/realloc.html&gt;&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/realloc.html&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/realloc.html&gt;&quot; rel=&quot;noopener&quot;&gt;https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/realloc.html&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120744&gt;&quot; rel=&quot;noopener&quot;&gt;https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120744&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://lore.kernel.org/lkml/20220213182443.4037039-1-keescook@chromium.org/&gt;&quot; rel=&quot;noopener&quot;&gt;https://lore.kernel.org/lkml/20220213182443.4037039-1-keescook@chromium.org/&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/&gt;&quot; rel=&quot;noopener&quot;&gt;https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/&gt;&lt;/a&gt;&lt;br /&gt;
	&lt;&lt;a href=&quot;https://gbhackers.com/whatsapp-double-free-vulnerability/&gt;&quot; rel=&quot;noopener&quot;&gt;https://gbhackers.com/whatsapp-double-free-vulnerability/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Rationale&lt;br /&gt;
	The specification of realloc(3) has been problematic since the&lt;br /&gt;
	very first standards, even before ISO C.  The wording has&lt;br /&gt;
	changed significantly, trying to forcedly permit implementations&lt;br /&gt;
	to return a null pointer when the requested size is zero.  This&lt;br /&gt;
	originated from the intent of banning zero-sized objects from&lt;br /&gt;
	the language in C89, but that never worked well in&lt;br /&gt;
	retrospective, as we can see from the fallout.&lt;br /&gt;
&lt;br /&gt;
	None of the specifications have been good, and C23 finally gave&lt;br /&gt;
	up and made it undefined behavior.&lt;br /&gt;
&lt;br /&gt;
	The problem is not only theoretical.  Programmers don't know how&lt;br /&gt;
	to use realloc(3) correctly, and have written weird code in&lt;br /&gt;
	their attempts.  This has resulted in a lot of non-sensical code&lt;br /&gt;
	in configure scripts[1], and even bugs in actual programs[2].&lt;br /&gt;
&lt;br /&gt;
	[1] &lt;&lt;a href=&quot;https://codesearch.debian.net/search?q=%5Cbrealloc%5B+%5Ct%5D*%5B%28%5D%5B%5E%2C%5D*%2C%5B+%5Ct%5D0%5B%29%5D&amp;literal=0&gt;&quot; rel=&quot;noopener&quot;&gt;https://codesearch.debian.net/search?q=%5Cbrealloc%5B+%5Ct%5D*%5B%28%5D%5B%5E%2C%5D*%2C%5B+%5Ct%5D0%5B%29%5D&amp;literal=0&gt;&lt;/a&gt;&lt;br /&gt;
	[2] &lt;&lt;a href=&quot;https://lore.kernel.org/lkml/20220213182443.4037039-1-keescook@chromium.org/&gt;&quot; rel=&quot;noopener&quot;&gt;https://lore.kernel.org/lkml/20220213182443.4037039-1-keescook@chromium.org/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
	In some cases, this non-sensical code has resulted in RCEs[3].&lt;br /&gt;
&lt;br /&gt;
	[3] &lt;&lt;a href=&quot;https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/&gt;&quot; rel=&quot;noopener&quot;&gt;https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
	However, this doesn't need to be like that.  The traditional&lt;br /&gt;
	implementation of realloc(3), present in V7 Unix, inherited by&lt;br /&gt;
	the BSDs, and currently available in a range of systems,&lt;br /&gt;
	including musl libc, doesn't have any issues regarding zero-size&lt;br /&gt;
	allocations.  glibc --which uses an independent implementation&lt;br /&gt;
	rather than a Unix derivative-- also had this behavior&lt;br /&gt;
	originally; it changed to the current behavior in 1999&lt;br /&gt;
	(glibc 2.1.1), only for compatibility with C89, even though&lt;br /&gt;
	ironically C99 was released soon after and removed the text that&lt;br /&gt;
	glibc was trying to comply with, and introduced some new text&lt;br /&gt;
	that was very confusing, and one of its interpretations would&lt;br /&gt;
	make the new glibc behavior non-conforming.&lt;br /&gt;
&lt;br /&gt;
	Code written for platforms returning a null pointer can be&lt;br /&gt;
	migrated to platforms returning non-null, without significant&lt;br /&gt;
	issues.&lt;br /&gt;
&lt;br /&gt;
	There are two kinds of code that call realloc(p,0).  One&lt;br /&gt;
	hard-codes the 0, and is used as a replacement of free(p).  This&lt;br /&gt;
	code ignores the return value, since it's unimportant.  This&lt;br /&gt;
	code currently produces a leak of 0 bytes plus associated&lt;br /&gt;
	metadata on platforms such as musl libc, where it returns a&lt;br /&gt;
	non-null pointer.  However, assuming that there are programs&lt;br /&gt;
	written with the knowledge that they won't ever be run on such&lt;br /&gt;
	platforms, we should take care of that, and make sure they don't&lt;br /&gt;
	leak.  A way of accomplishing this would be to recommend&lt;br /&gt;
	implementations to issue a diagnostic when realloc(3) is called&lt;br /&gt;
	with a hardcoded zero.  This is only an informal recommendation&lt;br /&gt;
	made by this proposal, as this is a matter of QoI, and the&lt;br /&gt;
	standard shouldn't say anything about it.  This would prevent&lt;br /&gt;
	this class of minor leaks.&lt;br /&gt;
&lt;br /&gt;
	Moreover, in glibc, realloc(p,0) may return non-null, in the&lt;br /&gt;
	case where p is NULL, so code must already take that into&lt;br /&gt;
	account, and thus code that simply takes realloc(p,0) as a&lt;br /&gt;
	synonym of free(p) is already leaky, as free(NULL) is a no-op,&lt;br /&gt;
	but realloc(NULL,0) allocates 0 bytes.&lt;br /&gt;
&lt;br /&gt;
	The other kind of code is in algorithms that realloc(3) an&lt;br /&gt;
	arbitrary size, which might eventually be zero.  This gets more&lt;br /&gt;
	complex.&lt;br /&gt;
&lt;br /&gt;
	Here's the code that should be written for AIX or glibc:&lt;br /&gt;
&lt;br /&gt;
		errno = 0;&lt;br /&gt;
		new = realloc(old, size);&lt;br /&gt;
		if (new == NULL) {&lt;br /&gt;
			if (errno == ENOMEM)&lt;br /&gt;
				free(old);&lt;br /&gt;
			goto fail;&lt;br /&gt;
		}&lt;br /&gt;
		...&lt;br /&gt;
		free(new);&lt;br /&gt;
&lt;br /&gt;
	Failing to check for ENOMEM in these platforms before freeing&lt;br /&gt;
	the old pointer would result in a double-free.  If the program&lt;br /&gt;
	decides to continue using the old pointer instead of freeing it,&lt;br /&gt;
	it would result in a use-after-free.&lt;br /&gt;
&lt;br /&gt;
	In the platforms where realloc(p,0) returns non-null, such as&lt;br /&gt;
	the BSDs or musl libc, it is simpler to handle it:&lt;br /&gt;
&lt;br /&gt;
		new = realloc(old, size);&lt;br /&gt;
		if (new == NULL) {  // errno is ENOMEM&lt;br /&gt;
			free(old);&lt;br /&gt;
			goto fail;&lt;br /&gt;
		}&lt;br /&gt;
		...&lt;br /&gt;
		free(new);&lt;br /&gt;
&lt;br /&gt;
	Whenever the result is a null pointer, these platforms are&lt;br /&gt;
	reporting an ENOMEM error, and thus it is superfluous to check&lt;br /&gt;
	errno there.&lt;br /&gt;
&lt;br /&gt;
	Most code is written in this way, even if run on platforms&lt;br /&gt;
	returning a null pointer.  This is because most programmers are&lt;br /&gt;
	just unaware of this problem.  Part of the reason is also that&lt;br /&gt;
	returning a non-null pointer with zero bytes is the natural&lt;br /&gt;
	extension of the behavior, which is what programmers intuitively&lt;br /&gt;
	expect from libc; that is, if realloc(p,3) allocates 3 bytes,&lt;br /&gt;
	r(p,2) allocates two bytes, and r(p,1) allocates one byte, it is&lt;br /&gt;
	natural by induction to expect that r(p,0) will allocate zero&lt;br /&gt;
	bytes.  Most algorithms naturally extend to 0 just fine, and&lt;br /&gt;
	special casing 0 is artificial.&lt;br /&gt;
&lt;br /&gt;
	If the realloc(3) specification were changed to require that&lt;br /&gt;
	realloc(p,0) returns non-null on success, and that realloc(p,0)&lt;br /&gt;
	only fails when out-of-memory (and assuming the implementations&lt;br /&gt;
	will continue setting errno to ENOMEM), then code written for&lt;br /&gt;
	AIX or glibc would continue working just fine, since the errno&lt;br /&gt;
	check would be redundant with the null check.  Simply, the&lt;br /&gt;
	conditional (errno == ENOMEM) would always be true when&lt;br /&gt;
	(new == NULL).&lt;br /&gt;
&lt;br /&gt;
	Then, there are non-POSIX platforms that don't set ENOMEM.  In&lt;br /&gt;
	those platforms, code might do this:&lt;br /&gt;
&lt;br /&gt;
		new = realloc(old, size);&lt;br /&gt;
		if (new == NULL) {&lt;br /&gt;
			if (size != 0)&lt;br /&gt;
				free(old);&lt;br /&gt;
			goto fail;&lt;br /&gt;
		}&lt;br /&gt;
		...&lt;br /&gt;
		free(new);&lt;br /&gt;
&lt;br /&gt;
	That code would continue working with this proposal, except for&lt;br /&gt;
	a very rare corner case, in which it would leak.  In the normal&lt;br /&gt;
	case, (size != 0) would never be true under (new == NULL),&lt;br /&gt;
	because a reallocation of 0 bytes would almost always succeed,&lt;br /&gt;
	and thus not return a null pointer under this proposal.&lt;br /&gt;
	However, in some cases, the system might not find space even for&lt;br /&gt;
	the small metadata needed for a 0-byte allocation.  In such&lt;br /&gt;
	case, the (size != 0) conditional would prevent deallocating&lt;br /&gt;
	'old', and thus cause a memory leak.  This case is exceptional&lt;br /&gt;
	enough that it shouldn't stop us from fixing realloc(3).&lt;br /&gt;
	Anyway, on an out-of-memory case, the program is likely to&lt;br /&gt;
	terminate rather soon, so the issue is even less likely to have&lt;br /&gt;
	an impact on any existing programs.  Also, LLVM's address&lt;br /&gt;
	sanitizer will soon able to catch such a leak:&lt;br /&gt;
	&lt;&lt;a href=&quot;https://github.com/llvm/llvm-project/issues/113065&gt;&quot; rel=&quot;noopener&quot;&gt;https://github.com/llvm/llvm-project/issues/113065&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
	This proposal makes handling of realloc(3) as straightforward as&lt;br /&gt;
	one would expect, with only two states: success or error.  There&lt;br /&gt;
	are no in-between states.&lt;br /&gt;
&lt;br /&gt;
	The resulting wording in the standard is also much simpler, as&lt;br /&gt;
	it doesn't need to define so many special cases.&lt;br /&gt;
&lt;br /&gt;
	For consistency, all the other allocation functions are updated&lt;br /&gt;
	to both return a null pointer on error, and use consistent&lt;br /&gt;
	wording.&lt;br /&gt;
&lt;br /&gt;
    Why not go the other way around?&lt;br /&gt;
	Some people keep asking why not go the other way around: why not&lt;br /&gt;
	force the BSDs and musl to return a null pointer if size is 0.&lt;br /&gt;
	This would result in double-free and use-after-free bugs, which&lt;br /&gt;
	can result in RCE vulnerabilities (remote code execution), which&lt;br /&gt;
	is clearly unacceptable.&lt;br /&gt;
&lt;br /&gt;
	Consider this code, which is the usual code for calling&lt;br /&gt;
	realloc(3) in such systems:&lt;br /&gt;
&lt;br /&gt;
		new = realloc(old, size);&lt;br /&gt;
		if (new == NULL) {&lt;br /&gt;
			free(old);&lt;br /&gt;
			goto fail;&lt;br /&gt;
		}&lt;br /&gt;
		...&lt;br /&gt;
		free(new);&lt;br /&gt;
&lt;br /&gt;
	If realloc(p,0) would return a null pointer and free the old&lt;br /&gt;
	block, then the third line would be a double-free bug.&lt;br /&gt;
&lt;br /&gt;
Prior art&lt;br /&gt;
    gnulib&lt;br /&gt;
	gnulib provides the realloc-posix module, which aims to wrap the&lt;br /&gt;
	system realloc(3) and reallocarray(3) functions so that they&lt;br /&gt;
	behave in a POSIX-complying manner.&lt;br /&gt;
&lt;br /&gt;
	It previously behaved like glibc.  After I reported that it was&lt;br /&gt;
	non-conforming to POSIX, we discussed the best way forward,&lt;br /&gt;
	which we agreed was the same direction that this paper is&lt;br /&gt;
	proposing now for C2y.  The implementation was changed in&lt;br /&gt;
&lt;br /&gt;
		gnulib.git d884e6fc4a60 (2024-11-04; &quot;realloc-posix: realloc (..., 0) now returns nonnull&quot;)&lt;br /&gt;
&lt;br /&gt;
	There have been no regression reports since then, as we&lt;br /&gt;
	expected.&lt;br /&gt;
&lt;br /&gt;
    V7 Unix, BSD&lt;br /&gt;
	The proposed behavior is the one endorsed by Doug McIlroy, the&lt;br /&gt;
	author of the original implementation of realloc(3) in V7 Unix,&lt;br /&gt;
	and also present in the BSDs.&lt;br /&gt;
&lt;br /&gt;
    glibc &lt;= 2.1&lt;br /&gt;
	glibc was implemented originally to return non-null.  It was&lt;br /&gt;
	only in 1999, and purely to comply with the standards --with no&lt;br /&gt;
	requests by users to do so--, that the glibc maintainers decided&lt;br /&gt;
	to switch to the current behavior.&lt;br /&gt;
&lt;br /&gt;
Design decisions&lt;br /&gt;
	This change needs two changes, which can be applied all at once,&lt;br /&gt;
	or in separate steps.&lt;br /&gt;
&lt;br /&gt;
	The first step would make realloc(p,s) be consistent with&lt;br /&gt;
	free(p) and malloc(s), including when p is a null pointer, when&lt;br /&gt;
	s is zero, and also when both corner cases happen at the same&lt;br /&gt;
	time.  This change would already turn the implementations where&lt;br /&gt;
	malloc(0) returns non-null into the end goal we have.  This&lt;br /&gt;
	would require changes to (at least) the following&lt;br /&gt;
	implementations: glibc, Bionic, Windows.&lt;br /&gt;
&lt;br /&gt;
	The second step would be to require that malloc(0) returns a&lt;br /&gt;
	non-null pointer.  This would require changes to (at least) the&lt;br /&gt;
	following implementations: AIX.&lt;br /&gt;
&lt;br /&gt;
	This proposal has merged all steps into a single proposal.&lt;br /&gt;
&lt;br /&gt;
Caveats&lt;br /&gt;
    n?n:1&lt;br /&gt;
	Code written in the near future should be careful, in case it&lt;br /&gt;
	can run on older systems that are not fixed to comply with this&lt;br /&gt;
	stricter specification.  Thus, code written in the near future&lt;br /&gt;
	should call realloc(3) similar to this:&lt;br /&gt;
&lt;br /&gt;
		realloc(p, n?n:1);&lt;br /&gt;
&lt;br /&gt;
	When all existing implementations are fixed to comply with this&lt;br /&gt;
	stricter specification, that workaround can be removed.&lt;br /&gt;
&lt;br /&gt;
    ENOMEM&lt;br /&gt;
	Existing implementations that set errno to ENOMEM must continue&lt;br /&gt;
	doing so when the input pointer is not freed.  If they didn't,&lt;br /&gt;
	code that is currently portable to all POSIX systems&lt;br /&gt;
&lt;br /&gt;
		errno = 0;&lt;br /&gt;
		new = realloc(old, size);&lt;br /&gt;
		if (new == NULL) {&lt;br /&gt;
			if (errno == ENOMEM)&lt;br /&gt;
				free(old);&lt;br /&gt;
			goto fail;&lt;br /&gt;
		}&lt;br /&gt;
		...&lt;br /&gt;
		free(new);&lt;br /&gt;
&lt;br /&gt;
	would leak on error.&lt;br /&gt;
&lt;br /&gt;
	Since it is currently impossible to write code today that is&lt;br /&gt;
	portable to arbitrary C17 systems, this is not an issue in&lt;br /&gt;
	ISO C.&lt;br /&gt;
&lt;br /&gt;
		-  New code written for C2y will only need to check for&lt;br /&gt;
		   NULL to detect errors.&lt;br /&gt;
&lt;br /&gt;
		-  Code written for specific C17 and older platforms&lt;br /&gt;
		   that don't set errno will continue to work for those&lt;br /&gt;
		   specific platforms.&lt;br /&gt;
&lt;br /&gt;
		-  Code written for POSIX.1-2024 and older platforms&lt;br /&gt;
		   will continue working on POSIX C2y platforms,&lt;br /&gt;
		   assuming that POSIX will continue mandating ENOMEM.&lt;br /&gt;
&lt;br /&gt;
		-  Code written for POSIX.1-2024 and older will not be&lt;br /&gt;
		   able to be run on non-POSIX C2y platforms, but that&lt;br /&gt;
		   could be expected.&lt;br /&gt;
&lt;br /&gt;
	The only important thing is that platforms that did set ENOMEM&lt;br /&gt;
	should continue setting it, to avoid introducing leaks.]]></description><category>System Interfaces</category><pubDate>Fri, 09 Jan 2026 17:58:28 +0000</pubDate><guid>https://www.austingroupbugs.net/view.php?id=1949</guid><comments>https://www.austingroupbugs.net/view.php?id=1949#bugnotes</comments></item></channel></rss>
