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

From: Jim Meyering <[email-masked]>
Date: Sun, 11 Jun 2023 10:29:01 -0700

On Sat, Jun 10, 2023 at 6:50 AM Pádraig Brady <[email-masked]> wrote:
> On 10/06/2023 02:45, Marc Lehmann wrote:
> > Package: coreutils
> > Version: 9.1-1
> > Severity: normal
> >
> > 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
>
> Yes this was a regression in coreutils 9.1
> The patch attached is the proposed upstream fix.

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.