Score:-1

Why is `man 3 printf` almost one year behind `glibc ver 2.35`?

vn flag

glibc ver 2.35 was released 0n Feb 3, 2022, and added the %b and %B binary conversion specifiers. This is a long wished-for feature to display values as a string of "ones and zeros". I'd like to use it.

I am running Ubuntu 22.04. My glibc version:

$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35

I checked the Linux Programmer's Manual for printf:

man 3 printf

Unfortunately, there's not a word about these new binary format specifiers. They are not even listed. They are in printf; I can use them, but get unexpected results.

I was under the mistaken impression that apt updated manuals to be consistent with applications & libraries. Is this not how it works in Ubuntu? What must be done to get the current version of Programmer's Manual for printf that includes the new binary conversion specifiers %b & %B ?

cc flag
Submit a documentation bug at https://bugs.launchpad.net/ubuntu
muru avatar
us flag
Those manpages aren't maintained by glibc, but by the folks at https://www.kernel.org/doc/man-pages/contributing.html. To see the documentation provided by glibc developers, run `info printf`
Seamus avatar
vn flag
@muru: `info printf` doesn't even describe `%b` the same way it's described in the [announcement](https://web.archive.org/web/20221016003354/https://sourceware.org/pipermail/libc-alpha/2022-February/136040.html).
muru avatar
us flag
@Seamus is the difference material? If so, I'd consider the `info` page authoritative since there's a good chance it was witten concurrent with the development of the feature.
Seamus avatar
vn flag
@muru: I'd say it's very material... it's as if they're talking about two completely different functions. Have you looked at the announcement I linked in my cmt above & `info printf`?
muru avatar
us flag
Yes. Here's what it says for me in the info page: "'%b', '%B' Print an integer as an unsigned binary number. '%b' uses lower-case 'b' with the '#' flag and '%B' uses upper-case. '%b' is an ISO C2X feature; '%B' is an extension recommende\d by ISO C2X." And in the announcement: "printf-family functions now support the %b format for output of integers in binary, as specified in draft ISO C2X, and the %B variant of that format recommended by draft ISO C2X." I fail to see how the announcement disagrees in any meaningful way with the info page.
hr flag
@Seamus I suspect you are looking at the `coreutils` info node, which describes the implementation of the printf command-line utility (equivalent to the `man 1 printf` page) rather than the printf system call. Try `info libc 'output conversions'` (you may need to install the `glibc-doc-reference` package).
Seamus avatar
vn flag
@steeldriver: Thanks for the clarification; installing the `glibc-doc-reference` package got the `info libc`document, but I still don't see any details wrt using `%b` or `%B` in a program.
hr flag
@Seamus strange... did you navigate to the node I mentioned (more precisely, `12.12.3 Table of Output Conversions`)
Seamus avatar
vn flag
@muru: Then I guess you're looking at a different document than I am. According to another comment, you may have given me the wrong document with `info printf`?? But that raises the question, what document are you actually quoting in your last coment? ... it isn't `info printf`.
Seamus avatar
vn flag
@steeldriver: Yes, I did see that, but I was expecting more detail - it doesn't seem to agree with the output I got when I tried it. Quoting my code is probably getting a bit deep for these comments, and it seems the answer to the question I posted here is simply, "`It hasn't been released yet, try 'info libc output conversions'`" - which I'll gladly accept as the correct answer if you want to post it. Wrt usage of `%b`, perhaps I should ask another question, but that may be more appropriate for S.O... whaddya' think?
muru avatar
us flag
@Seamus *I* didn't give you the wrong document, your system did. If I did `man printf` without specifying a section, the particular manpage I get depends on the manpages present in the system. The same is true for `info`. I had glibc docs installed but not coreutils, so for me, `info printf` shows the glibc one without having to qualify it. From there, I just searched instead of wading through multiple paragraphs looking for this. So, yes, I most definitely was quoting `info printf`. Maybe look at the first and last lines of your `info` output to identify what document and section.
Score:0
vn flag

Apparently the glibc manpage(s) are not maintained by the same team that maintains glibc itself - as explained here. As noted in the comments, a facsimile of man 3 printf is available as info printf, but (at least IMHO) it's not quite as well organized or informative as a developer's manual.

Nevertheless, the glibc website has a Documentation tab, which in turn has a link to the complete glibc manual which is the canonical source for API descriptions, and available in several formats. This isn't quite as convenient as man 3 printf, but perhaps we won't have to wait much longer for the new binary format specifiers (%b and %B) to reach the man page.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.