tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: /usr/bin/printf(1) not POSIX.2 compliant
On Sun, Jul 21, 2019 at 09:08:03PM +0700, Robert Elz wrote:
> Date: Sun, 21 Jul 2019 10:53:35 +0200
> From: tlaronde%polynum.com@localhost
> Message-ID: <20190721085335.GA677%polynum.com@localhost>
>
> | Am I correct? Is it worth a PR?
>
> I believe you are correct, though this is a common problem
> (one shared by dash and bash which makes it very common out
> there in the vastness of the net and so inadvisable to ever
> start a printf format with a '-' ... bash's printf even
> has an option (-v var) to place the output into a variable).
>
> I shall fix it (have fixed it in my sources) but it will take
> a while to get committed as the ATF tests actually test for --
> working as it does in other programs (and that "invalid options"
> cause a usage), and they needs to get cleaned up first.
>
Thank you. For safety, in my scripts, I simply circumvent by a
leading "%c" or "\055"---for the record, I was just rewriting a Perl
script (Samba) as a Bourne shell one and I wanted to keep the output
with this kind of dashes separating lines; that's when I stumbled upon
that.
Best regards,
--
Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Home |
Main Index |
Thread Index |
Old Index