GNU bug report logs -
#22803
bash printf and negative precision
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22803 in the body.
You can then email your comments to 22803 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#22803
; Package
coreutils
.
(Thu, 25 Feb 2016 09:47:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Billerbeck, Dirk" <dirk.billerbeck <at> dataport.de>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 25 Feb 2016 09:47:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
I don't know if it's really a bug, if I'm just mistaken or this is the right address but I just want to give it a try.
I'm using the following bash-builtin printf command:
FUELLLAENGE=8 ; report="REPIBZVAG" ; REPORTFUELLZEICHEN="0" ; printf '%.8s%*.*d\n' $report 0 $((FUELLLAENGE - ${#report} )) "$REPORTFUELLZEICHEN"
The maximum length of $report is 8 characters but I tested some possible error situations so in this example it is 9 characters log. I would expect printf to cut the $report from REPIBVZAG to REPIBZVA and to NOT print any additional trailing zeros because of the precision value of -1. But a trailing zero is printed (set -x output):
+ FUELLLAENGE=8
+ report=REPIBZVAG
+ REPORTFUELLZEICHEN=0
+ printf '%.8s%*.*d\n' REPIBZVAG 0 -1 0
REPIBZVA0
Is this really correct? Or shouldn't the negative precision be taken as zero and no character should be printed?
The bash version is "GNU bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)". I know it's an older version but I can't change it as there are corporate restrictions. The coreutil package is "coreutils-8.12-6.25.32.33.1".
Best regards
Dirk Billerbeck
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#22803
; Package
coreutils
.
(Thu, 25 Oct 2018 15:56:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 22803 <at> debbugs.gnu.org (full text, mbox):
tags 22803 notabug
close 22803
stop
(triaging old bugs)
On Thu, Feb 25, 2016 at 07:18:24AM +0000, Billerbeck, Dirk wrote:
> Hello,
>
> I don't know if it's really a bug, if I'm just mistaken or this is the right address but I just want to give it a try.
>
> I'm using the following bash-builtin printf command:
>
> [...]
>
> The bash version is "GNU bash, version 3.2.51(1)-release (x86_64-suse-linux-gnu)". I know it's an older version but I can't change it as there are corporate restrictions. The coreutil package is "coreutils-8.12-6.25.32.33.1".
>
It seems your message was lost and not replied to in 2 years. Sorry about that.
Your question is about bash's "printf", so it should be sent to help-bash <at> gnu.org
(or bug-bash <at> gnu.org if you suspect a bug).
This mailing list is for GNU coreutils (which also provides a 'printf' program,
but not bash's built-in one).
As such, I'm closing this bug.
-assaf
Added tag(s) notabug.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 25 Oct 2018 15:56:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
22803 <at> debbugs.gnu.org and "Billerbeck, Dirk" <dirk.billerbeck <at> dataport.de>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 25 Oct 2018 15:56:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 23 Nov 2018 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 289 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.