#1037275 dd: regression - posix expression syntax no longer supported

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Marc Lehmann
Date:
2023-06-11 22:15:03 UTC
Severity:
normal
#1037275#5
Date:
2023-06-10 01:45:22 UTC
From:
To:
Dear Maintainer,

I have a script that was used for some decades on multiple
unices. Beginning with bookworm, it stopped working because dd no longer
understands POSIX expression syntax for bs=:

   $ dd if=... bs=1024x1024x32
   dd: invalid number: ‘1024x1024x32’

This should be valid syntax according to POSIX, and was understood on
older versions of Debian GNU/Linux:

   Two or more positive decimal numbers (with or without k or b) separated by x, specifying the product of the indicated values

#1037275#10
Date:
2023-06-10 13:49:29 UTC
From:
To:
Yes this was a regression in coreutils 9.1
The patch attached is the proposed upstream fix.

thanks,
Pádraig

#1037275#15
Date:
2023-06-11 17:29:01 UTC
From:
To:
Thanks. The patch looks fine.
My only suggestion would be a stylistic one, to change the ">"
comparison to be the equivalent "<" one, i.e., change this:

+      && *suffix == 'B' && (suffix > str && suffix[-1] != 'B'))

to this (also dropping the unnecessary parentheses):

+      && *suffix == 'B' && str < suffix && suffix[-1] != 'B')

Why? Because of the increasing-to-right number-line argument, where
smaller things are visually on the left of larger ones.

Currently, in src/, the uses of space-delimited < and <= outnumber
uses of > and >= by four to one, 1678 to 428.

#1037275#20
Date:
2023-06-11 22:13:22 UTC
From:
To:
Pushed with that adjustment.

thanks
Pádraig