Re: [PATCH] printf: add %#s alias to %b

2023-09-08 Thread Rob Landley
On 9/7/23 13:59, Eric Blake wrote: > now that Issue 8 has taken efforts to make it clear that sometimes the > shell deals with characters, and sometimes with bytes; in particular, > environment variables can hold bytes that need not always form > characters in the current locale). If they didn't

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Robert Elz
Date:Thu, 7 Sep 2023 13:46:08 -0500 From:Eric Blake Message-ID: | Right now, both bash and coreutils' 'printf %hhd 257' outputs "257", ok, not unexpected. I'm not sure its useful either. | but printf("%hhd", 257) in C outputs 1. Yes. | I would LOVE to

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Pádraig Brady
On 07/09/2023 19:46, Eric Blake wrote: On Thu, Sep 07, 2023 at 11:53:54PM +0700, Robert Elz wrote: And for those who have been following this issue, the new text for the forthcoming POSIX version has removed any mention of obsoleting %b from printf(1) - instead it will simply note that there is

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Zachary Santer
On Thu, Sep 7, 2023 at 12:55 PM Robert Elz wrote: > There are none, printf(3) belongs to the C committee, and they can make > use of anything they like, at any time they like. > > The best we can do is use formats that make no sense for printf(1) to > support > That's still assuming the goal of

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Eric Blake
On Thu, Sep 07, 2023 at 02:42:16PM +0700, Robert Elz wrote: > Date:Wed, 6 Sep 2023 11:32:32 -0500 > From:Eric Blake > Message-ID: > > > | You (anyone reading this, not just kre) are welcome to join tomorrow's > | Austin Group meeting > > Thanks, but I don't

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Eric Blake
On Thu, Sep 07, 2023 at 11:53:54PM +0700, Robert Elz wrote: > And for those who have been following this issue, the new text for > the forthcoming POSIX version has removed any mention of obsoleting > %b from printf(1) - instead it will simply note that there is will be > a difference between

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Robert Elz
And for those who have been following this issue, the new text for the forthcoming POSIX version has removed any mention of obsoleting %b from printf(1) - instead it will simply note that there is will be a difference between printf(1) and printf(3) once the latter gets its version of %b specified

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Zachary Santer
The trouble with using an option flag to printf(1) to toggle the meaning of %b is that you can't then mix format specifiers for binary literals and backslash escape expansion within the same format string. You'd just have to call printf(1) multiple times, which largely defeats the purpose of a

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Robert Elz
Date:Wed, 6 Sep 2023 11:03:25 -0500 From:Eric Blake Message-ID: | If we do nothing now for Issue 8, then Issue 9 WILL have a conflict | between printf(1) and printf(3). Yes. | If we reach out to all developers now, we can start the discussion, That would

Re: [PATCH] printf: add %#s alias to %b

2023-09-07 Thread Robert Elz
Date:Wed, 6 Sep 2023 11:32:32 -0500 From:Eric Blake Message-ID: | You (anyone reading this, not just kre) are welcome to join tomorrow's | Austin Group meeting Thanks, but I don't expect its time of day will coincide with mine this week, at best I would be a

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Dragan Simic
On 2023-09-07 03:03, Rob Landley wrote: On 9/6/23 05:28, Dragan Simic wrote: Thank you for this detailed clarification. It's good to know that the 2013, 2016 and 2018 versions/revisions of POSIX actually don't count. You didn't change the URL. You didn't update the SUSvX number. It's still

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Rob Landley
On 9/6/23 05:28, Dragan Simic wrote: > Thank you for this detailed clarification. It's good to know that the > 2013, 2016 and 2018 versions/revisions of POSIX actually don't count. You didn't change the URL. You didn't update the SUSvX number. It's still says "issue 7" at the top. That's YOU

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Chet Ramey
On 9/6/23 12:03 PM, Eric Blake wrote: The austin group has decided what they'd like to do, and what they'd like implementors to do. The question is whether or not people go along with it. The Austin Group decided merely: If we do nothing now for Issue 8, then Issue 9 WILL have a conflict

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Eric Blake
On Wed, Sep 06, 2023 at 10:45:09AM +0700, Robert Elz wrote: > > However, my "read of the room" at the minute is that this simply won't > happen, and printf(1) %b will remain as it is, and not be removed any > time soon (or probably, ever). If printf(1) ever really needs a method > to output in

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Eric Blake
On Wed, Sep 06, 2023 at 09:03:29AM -0400, Chet Ramey wrote: > On 9/5/23 10:13 PM, William Bader wrote: > > Has bash ever had a change before that would break valid scripts? > > Yes, but I try to keep those to a minimum. > > > Could the printf format change be settable by a variable or by an

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Dragan Simic
On 2023-09-06 17:10, Robert Elz wrote: Date:Wed, 06 Sep 2023 12:28:34 +0200 From:Dragan Simic Message-ID: <03abecb9d905252bd63867d1c8b2a...@manjaro.org> | It's good to know that the | 2013, 2016 and 2018 versions/revisions of POSIX actually don't count. As Chet

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Dragan Simic
On 2023-09-06 15:07, Chet Ramey wrote: On 9/6/23 6:28 AM, Dragan Simic wrote: No invalidation would be happening now, merely a note in the coming standard that the %b in printf(1) would (might) be removed in a later version of the standard - so implementations have time to implement

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Robert Elz
Date:Wed, 06 Sep 2023 12:28:34 +0200 From:Dragan Simic Message-ID: <03abecb9d905252bd63867d1c8b2a...@manjaro.org> | It's good to know that the | 2013, 2016 and 2018 versions/revisions of POSIX actually don't count. As Chet said, that is not what I meant. The

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Greg Wooledge
On Wed, Sep 06, 2023 at 02:13:44AM +, William Bader wrote: > Has bash ever had a change before that would break valid scripts? Yes. Many times, sadly. Most recently, bash 5.2 introduced some changes to how associative array indexes are handled, which will break backward compatibility in

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread William Bader
=hotmail@gnu.org on behalf of Chet Ramey Sent: Tuesday, September 5, 2023 4:44 PM To: Dragan Simic Cc: chet.ra...@case.edu ; enh ; Eric Blake ; Rob Landley ; coreut...@gnu.org ; bug-bash@gnu.org Subject: Re: [PATCH] printf: add %#s alias to %b On 9/5/23 4:32 PM, Dragan Simic wrote: > On 2

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Chet Ramey
On 9/6/23 4:02 AM, Oğuz wrote: I don't think bash should deprecate %b. I don't have any plans to change %b. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.edu

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Chet Ramey
On 9/6/23 6:28 AM, Dragan Simic wrote: No invalidation would be happening now, merely a note in the coming standard that the %b in printf(1) would (might) be removed in a later version of the standard - so implementations have time to implement something to replace it, and applications to stop

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Chet Ramey
On 9/5/23 10:13 PM, William Bader wrote: Has bash ever had a change before that would break valid scripts? Yes, but I try to keep those to a minimum. Could the printf format change be settable by a variable or by an option like the -e/-E in echo? It could, sure. Anything is possible. Is

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Chet Ramey
On 9/5/23 7:34 PM, Rob Landley wrote: C23 is going to use %b to print binary literals. Upper case %B was taken? I asked the same question. The short answer is that no one trusts the C committee. https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00121.html -- ``The lyf so short, the

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Dragan Simic
On 2023-09-06 05:45, Robert Elz wrote: Date:Tue, 05 Sep 2023 22:32:39 +0200 From:Dragan Simic Message-ID: <7cfed11b50d35cbfaaa647c1fcd39...@manjaro.org> | Are there any official explanations why is the invalidation actually | happening now? It was proposed

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Oğuz
On Wed, Sep 6, 2023 at 9:38 AM Robert Elz wrote: > Adding a different %b to printf(1) wasn't currently even proposed, just > deprecating the current one so it wouldn't conflict with the usage of > %b in printf(3) (which is being defined in C23, and is apparently already > firmly entrenched, even

Re: [PATCH] printf: add %#s alias to %b

2023-09-06 Thread Robert Elz
Date:Wed, 6 Sep 2023 08:13:23 +0300 From:=?UTF-8?B?T8SfdXo=?= Message-ID: | What's the point? Does anyone need this feature in their shell scripts (and | can't afford to use bc for it)? Adding a different %b to printf(1) wasn't currently even proposed, just

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Robert Elz
Date:Tue, 05 Sep 2023 22:32:39 +0200 From:Dragan Simic Message-ID: <7cfed11b50d35cbfaaa647c1fcd39...@manjaro.org> | Are there any official explanations why is the invalidation actually | happening now? It was proposed because of a desire to keep the formats for

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Oğuz
On Tuesday, September 5, 2023, Chet Ramey wrote: > to print binary literals > What's the point? Does anyone need this feature in their shell scripts (and can't afford to use bc for it)? -- Oğuz

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Rob Landley
On 9/5/23 15:44, Chet Ramey wrote: > On 9/5/23 4:32 PM, Dragan Simic wrote: >> On 2023-09-05 22:25, Chet Ramey wrote: >>> On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: >>> > I think you'll find that, regardless of its origins, there are more >

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread enh
On Tue, Sep 5, 2023 at 4:31 PM Rob Landley wrote: > > On 9/5/23 15:44, Chet Ramey wrote: > > On 9/5/23 4:32 PM, Dragan Simic wrote: > >> On 2023-09-05 22:25, Chet Ramey wrote: > >>> On 9/5/23 3:58 PM, enh wrote: > On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: > >>> > > I think you'll

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Dragan Simic
On 2023-09-05 22:25, Chet Ramey wrote: On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally never heard of printf(1) %b before this

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Chet Ramey
On 9/5/23 4:32 PM, Dragan Simic wrote: On 2023-09-05 22:25, Chet Ramey wrote: On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread Chet Ramey
On 9/5/23 3:58 PM, enh wrote: On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: I think you'll find that, regardless of its origins, there are more scripts using the %b specifier than you think. i'd personally never heard of printf(1) %b before this thread, but debian code search agrees

Re: [PATCH] printf: add %#s alias to %b

2023-09-05 Thread enh
On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey wrote: > > On 8/31/23 5:15 PM, Eric Blake wrote: > > > > It's not hard to see why POSIX is choosing to have Issue 8 obsoleting > > (not removing) %b's old semantics; in the short term, nothing about %b > > changes, so your dusty-deck shell scripts will

Re: [PATCH] printf: add %#s alias to %b

2023-09-01 Thread Chet Ramey
On 8/31/23 5:15 PM, Eric Blake wrote: It's not hard to see why POSIX is choosing to have Issue 8 obsoleting (not removing) %b's old semantics; in the short term, nothing about %b changes, so your dusty-deck shell scripts will continue to work as they have before; but you now have enough time

Re: [PATCH] printf: add %#s alias to %b

2023-08-31 Thread Eric Blake
On Thu, Aug 31, 2023 at 04:01:17PM -0500, Rob Landley wrote: > On 8/31/23 13:31, Eric Blake wrote: > > POSIX Issue 8 will be obsoleting %b (escape sequence interpolation) so > > that future Issue 9 can change to having %b (binary literal output) > > that aligns with C2x. > > I.E. you sent an RFC