From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Timur Tabi <ttabi@nvidia.com>
Cc: "superm1@gmail.com" <superm1@gmail.com>,
"jwboyer@kernel.org" <jwboyer@kernel.org>,
"linux-firmware@kernel.org" <linux-firmware@kernel.org>
Subject: Re: [PATCH 2/2] copy-firmware: fail gracefully if moreutils parallel is installed
Date: Tue, 18 Mar 2025 23:58:20 +0900 [thread overview]
Message-ID: <87frjatmgj.fsf@gmail.com> (raw)
In-Reply-To: <f5beca4503c46772ad65a8485757f0c700b0192b.camel@nvidia.com> (Timur Tabi's message of "Tue, 18 Mar 2025 07:08:43 +0000")
Hi Timur,
Timur Tabi <ttabi@nvidia.com> writes:
> On Tue, 2025-03-18 at 15:42 +0900, Maxim Cournoyer wrote:
>> I just rechecked; I don't think this currently work, it'd require
>> complicating the script to accommodate this less featureful parallel
>> variant, which is why I had opted to use GNU Parallel in the first place
>> :-).
>
> Like I said in my other reply, I think you misunderstood the point of my
> patch. moreutils' parallel is still not supported. I'm not trying to make it
> work. All my patch does is make the function run more cleanly. That's why I
> said "fail gracefully".
I see; I had indeed missed the point of your patch. I understand the
problem this attempts to solve now, thanks for the clarifications.
+ # The moreutils package comes with a simpler version of "parallel"
+ # that does not support the --version or -a options. Check for
+ # that first. In some distros, installing the "parallel" package
+ # will replace the moreutils version with the GNU version.
+ parallel --version >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
Instead of checking $?, it's better style to check the command directly
like:
--8<---------------cut here---------------start------------->8---
@@ -22,8 +22,11 @@ warn() {
has_gnu_parallel() {
if command -v parallel > /dev/null; then
- if parallel --version | grep -Fqi 'gnu parallel'; then
- return 0
+ # Moreutils's parallel doesn't support '--version'.
+ if ! parallel --version >/dev/null 2>&1; then
+ return 1
+ elif parallel --version | grep -Fqi 'gnu parallel'; then
+ return 0
fi
fi
return 1
--8<---------------cut here---------------end--------------->8---
--
Thanks,
Maxim
next prev parent reply other threads:[~2025-03-18 14:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 19:16 [PATCH 1/2] copy-firmware: make script smarter about parameters Timur Tabi
2025-03-17 19:16 ` [PATCH 2/2] copy-firmware: fail gracefully if moreutils parallel is installed Timur Tabi
2025-03-18 6:20 ` Maxim Cournoyer
2025-03-18 7:06 ` Timur Tabi
2025-03-18 6:42 ` Maxim Cournoyer
2025-03-18 7:08 ` Timur Tabi
2025-03-18 14:58 ` Maxim Cournoyer [this message]
2025-03-18 15:14 ` Timur Tabi
2025-03-17 20:27 ` [PATCH 1/2] copy-firmware: make script smarter about parameters Mario Limonciello
2025-03-17 21:14 ` Timur Tabi
2025-03-17 21:16 ` Mario Limonciello
2025-03-17 21:45 ` Timur Tabi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frjatmgj.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=jwboyer@kernel.org \
--cc=linux-firmware@kernel.org \
--cc=superm1@gmail.com \
--cc=ttabi@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.