Re: printf portability

2025-03-18 Thread Philip Guenther
On Mon, Mar 17, 2025 at 3:43 AM Christian Schulte wrote: ... > No idea how many shells there are around doing things the way the do. > Running "grep printf configure" on the configure script generated by the > GNU toolchain shows a lot of "printf" without --. Hmm, if you wanted to see what was in

Re: printf portability

2025-03-16 Thread Christian Schulte
On 3/15/25 09:11, Otto Moerbeek wrote: > On Sat, Mar 15, 2025 at 08:55:18AM +0100, Christian Schulte wrote: > >> On 3/15/25 07:37, Otto Moerbeek wrote: >>> On Sat, Mar 15, 2025 at 07:29:39AM +0100, Christian Schulte wrote: >>> Hi @misc, I recently stumbled upon an issue with GNU pri

Re: printf portability

2025-03-15 Thread Christian Schulte
On 3/15/25 08:58, Philip Guenther wrote: > No, it's not. Per POSIX XCU 1.4, utilities that do not explicitly > state otherwise are allowed to recognize options whether any are > defined by the standard. printf(1) follows that default, so for the > first positional argument to (portably) start wit

Re: printf portability

2025-03-15 Thread Otto Moerbeek
On Sat, Mar 15, 2025 at 08:55:18AM +0100, Christian Schulte wrote: > On 3/15/25 07:37, Otto Moerbeek wrote: > > On Sat, Mar 15, 2025 at 07:29:39AM +0100, Christian Schulte wrote: > > > >> Hi @misc, > >> > >> I recently stumbled upon an issue with GNU printf(1). I was using > >> echo(1) in a tests

Re: printf portability

2025-03-15 Thread Philip Guenther
No, it's not. Per POSIX XCU 1.4, utilities that do not explicitly state otherwise are allowed to recognize options whether any are defined by the standard. printf(1) follows that default, so for the first positional argument to (portably) start with a minus-sign, a -- option must precede it, ala

Re: printf portability

2025-03-15 Thread Janne Johansson
> which is the expected output. On linux I get > schulte@vps:~$ printf -0 > -bash: printf: -0: invalid option > Would you rate this a bug in GNU printf(1)? The gnu printf manpage does mention "Your shell may have its own version of printf, which usually supersedes the version described

Re: printf portability

2025-03-15 Thread Christian Schulte
On 3/15/25 07:37, Otto Moerbeek wrote: > On Sat, Mar 15, 2025 at 07:29:39AM +0100, Christian Schulte wrote: > >> Hi @misc, >> >> I recently stumbled upon an issue with GNU printf(1). I was using >> echo(1) in a testsuite.at on OpenBSD successfully, but that failed on >> linux badly. The OpenBSD ma

Re: printf portability

2025-03-15 Thread Otto Moerbeek
On Sat, Mar 15, 2025 at 07:29:39AM +0100, Christian Schulte wrote: > Hi @misc, > > I recently stumbled upon an issue with GNU printf(1). I was using > echo(1) in a testsuite.at on OpenBSD successfully, but that failed on > linux badly. The OpenBSD man page of echo(1) contains this sentence: > >

printf portability

2025-03-14 Thread Christian Schulte
Hi @misc, I recently stumbled upon an issue with GNU printf(1). I was using echo(1) in a testsuite.at on OpenBSD successfully, but that failed on linux badly. The OpenBSD man page of echo(1) contains this sentence: Where portability is paramount, use printf(1). So I replaced echo(1) with printf(