Skip to contentSkip to conversation

copy-firmware.sh bug in has_gnu_parallel()

DISCUSSION Genes Lists 2 participants 8 messages Jan 6, 2025 – Jan 7, 2025

lore
Share & tools
lore
#0 lore raw

The has_gnu_parallel() function in copy-firmware.sh checks for gnu parallel using:

    parallel --version | grep -Fq 'GNU Parallel'

But this fails since the string is 'GNU parallel' (lower case p).

Should probably be 'grep -Fq 'GNU parallel'

Output of "parallel --version":

GNU parallel 20241222
Copyright (C) 2007-2024 Ole Tange, http://ole.tange.dk and Free
Software
Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. GNU parallel comes with no warranty.

--
Gene

#1 lore raw
Quoted 13 lines · Genes Lists

The has_gnu_parallel() function in copy-firmware.sh checks for gnu parallel using:

    parallel --version | grep -Fq 'GNU Parallel'

But this fails since the string is 'GNU parallel' (lower case p).

Should probably be 'grep -Fq 'GNU parallel'

Output of "parallel --version":

Quoted 8 lines

GNU parallel 20241222
Copyright (C) 2007-2024 Ole Tange, http://ole.tange.dk and Free
Software
Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. GNU parallel comes with no warranty.

You trimmed the output. The full output is:

[jwboyer@vader ~]$ parallel --version
GNU parallel 20241222
Copyright (C) 2007-2024 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. GNU parallel comes with no warranty.

Web site: https://www.gnu.org/software/parallel

When using programs that use GNU Parallel to process data for publication please cite as described in 'parallel --citation'.

which has GNU Parallel at the bottom.

The grep finds this.

[jwboyer@vader ~]$ parallel --version | grep -Fq 'GNU Parallel' [jwboyer@vader ~]$ echo $?
0
[jwboyer@vader ~]$

Did you actually see a failure somewhere, or were you just looking at the output and making an assumption?

It's arguable either case is correct and we might be able to improve it, but there shouldn't actually be a failure that I can see.

josh

#2 lore raw
Quoted 32 lines · Josh Boyer

On Mon, Jan 6, 2025 at 6:37 AM Genes Lists <[email protected]> wrote:

...

You trimmed the output.  The full output is:

[jwboyer@vader ~]$ parallel --version
GNU parallel 20241222
Copyright (C) 2007-2024 Ole Tange, http://ole.tange.dk and Free Software
Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. GNU parallel comes with no warranty.

Web site: https://www.gnu.org/software/parallel

When using programs that use GNU Parallel to process data for publication
please cite as described in 'parallel --citation'.

which has GNU Parallel at the bottom.

The grep finds this.

[jwboyer@vader ~]$ parallel --version | grep -Fq 'GNU Parallel' [jwboyer@vader ~]$ echo $?
0
[jwboyer@vader ~]$

Quoted 7 lines

Did you actually see a failure somewhere, or were you just looking at the output and making an assumption?

It's arguable either case is correct and we might be able to improve it, but there shouldn't actually be a failure that I can see.

josh

Actually nope I didn't trim the output.
This is the full output I get on Arch Linux:

gene git]$ parallel --version
GNU parallel 20241222
Copyright (C) 2007-2024 Ole Tange, http://ole.tange.dk and Free Software
Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. GNU parallel comes with no warranty.
gene git]$

And indeed I do get a build failure (which is how I came across the problem):

gene git $ make -j4 DESTDIR=../tmp FIRMWAREDIR=/usr/lib/firmware install-zst
install -d ../tmp/usr/lib/firmware
./copy-firmware.sh -j4 --zstd ../tmp/usr/lib/firmware
ERROR: the GNU parallel command is required to use -j
make: *** [Makefile:48: install-zst] Error 1

Signature · 1 line
Gene
#4 lore raw
Quoted 7 lines · Genes Lists
Quoted 1 line · Josh Boyer

When using programs that use GNU Parallel

I checked the Arch build [1] and it has a patch to remove some "citations" including the text you shared.
That explains why its absent in my case.

OK, I suspected that might be the case. I'll look at adjusting the grep soon. Accounting for per distro changes to the same package is always fun.

Thanks for the report.

josh

#5 lore raw
Quoted 9 lines · Josh Boyer
Quoted 1 line

That explains why its absent in my case.

OK, I suspected that might be the case.  I'll look at adjusting the grep soon.  Accounting for per distro changes to the same package is always fun.

Thanks for the report.

josh

Terrific thanks.

One alternative could be to look instead for support of  -j, which is what the script seems to want.

Maybe something like:

   parallel --help | grep -Fq -- '-j n'

gene

Signature · 1 line
Gene
#6 lore raw
Quoted 12 lines · Genes Lists
Quoted 9 lines · Josh Boyer
Quoted 1 line

That explains why its absent in my case.

OK, I suspected that might be the case. I'll look at adjusting the grep soon. Accounting for per distro changes to the same package is always fun.

Thanks for the report.

josh

Quoted 8 lines

Terrific thanks.

One alternative could be to look instead for support of -j, which is what the script seems to want.

Maybe something like:

   parallel --help | grep -Fq -- '-j n'

Initially went with something like that, but decided to keep it simple after review by just looking for 'gnu parallel' case insensitive.

https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/400

Will be in the next release.

josh

#7 lore raw
Quoted 9 lines · Josh Boyer
Quoted 4 lines

...
Maybe something like:

   parallel --help | grep -Fq -- '-j n'

Initially went with something like that, but decided to keep it simple
after review by just looking for 'gnu parallel' case insensitive.

Quoted 5 lines

https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/400

Will be in the next release.

josh

Sounds good.

thank you.

Signature · 1 line
Gene