GNU bug report logs -
#55748
df: wrong column is checked in condition in total-verify.sh
Previous Next
Reported by: Daniel Hofstetter <dhofstet <at> gmail.com>
Date: Wed, 1 Jun 2022 08:46:02 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55748 in the body.
You can then email your comments to 55748 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#55748
; Package
coreutils
.
(Wed, 01 Jun 2022 08:46:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Hofstetter <dhofstet <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 01 Jun 2022 08:46:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
While looking at
https://github.com/coreutils/coreutils/blob/master/tests/df/total-verify.sh
I noticed the following lines and I think "$5" in the last line (line
38 in the source code) should be "$6" because there are six columns in
the df output and '-' is in the sixth column of the row starting with
"total".
# Recognize df output lines like these:
# /dev/sdc1 0 0 0 - /c
# tmpfs 1536000 12965 1523035 1% /tmp
# total 5285932 787409 4498523 15% -
/^(.*?) +(-?\d+|-) +(-?\d+|-) +(-?\d+|-) +(?:-|[0-9]+%) (.*)$/
or die "$0: invalid input line\n: $_";
if ($1 eq 'total' && $5 eq '-')
Regards,
Daniel
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#55748
; Package
coreutils
.
(Wed, 01 Jun 2022 10:04:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 55748 <at> debbugs.gnu.org (full text, mbox):
tag 55748 notabug
close 55748
stop
On 01/06/2022 09:01, Daniel Hofstetter wrote:
> Hi,
>
> While looking at
> https://github.com/coreutils/coreutils/blob/master/tests/df/total-verify.sh
> I noticed the following lines and I think "$5" in the last line (line
> 38 in the source code) should be "$6" because there are six columns in
> the df output and '-' is in the sixth column of the row starting with
> "total".
>
> # Recognize df output lines like these:
> # /dev/sdc1 0 0 0 - /c
> # tmpfs 1536000 12965 1523035 1% /tmp
> # total 5285932 787409 4498523 15% -
> /^(.*?) +(-?\d+|-) +(-?\d+|-) +(-?\d+|-) +(?:-|[0-9]+%) (.*)$/
> or die "$0: invalid input line\n: $_";
> if ($1 eq 'total' && $5 eq '-')
Notice the non capturing group, i.e. (?:)
This is because the percentage column is not needed
in the subsequent processing.
I.e. the following would work, but isn't needed.
cheers,
Pádraig
diff --git a/tests/df/total-verify.sh b/tests/df/total-verify.sh
index 87589d23d..d3f109d97 100755
--- a/tests/df/total-verify.sh
+++ b/tests/df/total-verify.sh
@@ -33,9 +33,9 @@ while (<>)
# /dev/sdc1 0 0 0 - /c
# tmpfs 1536000 12965 1523035 1% /tmp
# total 5285932 787409 4498523 15% -
- /^(.*?) +(-?\d+|-) +(-?\d+|-) +(-?\d+|-) +(?:-|[0-9]+%) (.*)$/
+ /^(.*?) +(-?\d+|-) +(-?\d+|-) +(-?\d+|-) +(-|[0-9]+%) (.*)$/
or die "$0: invalid input line\n: $_";
- if ($1 eq 'total' && $5 eq '-')
+ if ($1 eq 'total' && $6 eq '-')
{
$total == $2 or die "$total != $2";
$used == $3 or die "$used != $3";
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Wed, 01 Jun 2022 10:04:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
55748 <at> debbugs.gnu.org and Daniel Hofstetter <dhofstet <at> gmail.com>
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Wed, 01 Jun 2022 10:04: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
.
(Wed, 29 Jun 2022 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 47 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.