Date: Thu, 30 Aug 2018 12:46:39 +0000 From: Austin Group Bug Tracker <nore...@msnkbrown.net> Message-ID: <759af69537ce9ade10f26777c4a01...@www.austingroupbugs.net>
| A NOTE has been added to this issue. I am going to reply via e-mail, rather than add more notes to the issue, as nothing here is particularly relevant to the actual resolution... | Some shells convert the %b argument to expand the escape sequences and | later let the resulting string be processed by printf(3). This does not work, Actually, it does, that's what the NetBSD printf does, and null bytes are output just fine. True, the simple no-thought approach to using printf(3) won't work, but it just makes sense to use it to do the heavy lifting. | as a side effect, the \c ending is seen while doing the conversion. Yes, I know why it works the way it works. | If you like to permit coded nul bytes to be inside the string parameter, To %b, and only encoded (as \0 or similar) of course. And as there is nothing in the spec which says those are special in any way, I think it is mandatory that they be handled. | you need to process things completely without help from printf(). No, you don't. But this is just implementation detail, and not important as long as the results are correct. | If you at the same time like to honor %.#b, I think that is mandatory too, despite ksh93's odd special case weird bug | the natural behavior is the behavior from bosh I agree that is reasonable behaviour, I think it might even be the most logical (ie: expected) behaviour, but it is not required by the spec (I'd even consider changing the NetBSD printf so that also does not process the \c unless that byte position is actually output, though I'd do it a completely different way than bosh apparently does, again, just implementation detail.) The issue, which is why I filed the defect report, is that there are theset two wildly different (in behaviour) interpretations of the spec, which contains no hint at all of this variation (neither to specify one way is the correct way, nor to make it unspecified which one will happen if a user does this (which isn't really very likely, as %b is intended to allow printf to emulate SysV echo, and it has no precision args...) That needs to be fixed. kre