GNU bug report logs - #65659
RFC: changing printf(1) behavior on %b

Previous Next

Package: coreutils;

Reported by: Eric Blake <eblake <at> redhat.com>

Date: Thu, 31 Aug 2023 15:37:02 UTC

Severity: normal

Full log


Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephane Chazelas <stephane <at> chazelas.org>
To: Oğuz <oguzismailuysal <at> gmail.com>
Cc: chet.ramey <at> case.edu, bug-coreutils <at> gnu.org, austin-group-l <at> opengroup.org,
 Phi Debian <phi.debian <at> gmail.com>, bug-bash <at> gnu.org,
 Eric Blake <eblake <at> redhat.com>
Subject: Re: RFC: changing printf(1) behavior on %b
Date: Fri, 1 Sep 2023 08:12:33 +0100
2023-09-01 09:44:08 +0300, Oğuz via austin-group-l at The Open Group:
> On Fri, Sep 1, 2023 at 7:41 AM Phi Debian <phi.debian <at> gmail.com> wrote:
> > My vote is for posix_printf %B mapping to libc_printf %b
> 
> In the shell we already have bc for base conversion. Does POSIX really
> have to support C2x %b in the first place?

Yes, though note:

- that implies forking a process and loading an external
  executable and its libraries
- bc is not always available. It's not installed by default on
  Debian for instance.
- for bases over 16, it uses some unusual representation that
  can't be used anywhere.

A summary of some options for some common POSIX-like shells at
https://unix.stackexchange.com/questions/191205/bash-base-conversion-from-decimal-to-hex/191209#191209

-- 
Stephane




This bug report was last modified 1 year and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.