Bug 1822280 - lvm2: set -o pipefail in tools/Makefile.in is a bashism
Summary: lvm2: set -o pipefail in tools/Makefile.in is a bashism
Status: POST
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: 2.02.185
Hardware: All
OS: All
Target Milestone: ---
: ---
Assignee: Zdenek Kabelac
QA Contact: cluster-qe@redhat.com
Depends On:
TreeView+ depends on / blocked
Reported: 2020-04-08 16:37 UTC by Michael Orlitzky
Modified: 2023-02-10 21:40 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:
pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?

Attachments (Terms of Use)
0001-tools-Makefile.in-only-set-o-pipefail-if-the-shell-i.patch (2.35 KB, patch)
2020-04-08 21:44 UTC, Michael Orlitzky
no flags Details | Diff
0002-tools-Makefile.in-use-printf-instead-of-non-portable.patch (1.68 KB, patch)
2020-04-08 21:45 UTC, Michael Orlitzky
no flags Details | Diff

Description Michael Orlitzky 2020-04-08 16:37:47 UTC
The subject more or less explains it: set -o pipefail in tools/Makefile.in causes the build to fail with (for example) the dash shell. Autotools uses /bin/sh which is presumed to be POSIX compatible, but not (much) more. I see workarounds for this in other places, like

  test/lib/aux.sh:test -n "$BASH" && set -euE -o pipefail

so presumably this one remaining instance is just an oversight.

Comment 1 Zdenek Kabelac 2020-04-08 20:45:50 UTC
lvm2 building basically depends on bash & gcc.

If there is anyone who wants to provide global patch fixing all the 'bashism' everywhere - it might be pushed upstream if the code will behave in the same way.

Comment 2 Michael Orlitzky 2020-04-08 20:48:25 UTC
(In reply to Zdenek Kabelac from comment #1)
> lvm2 building basically depends on bash & gcc.

That's a valid choice, but in that case, can you set SHELL=bash rather than using /bin/sh and just praying that it points to bash?

Comment 3 Zdenek Kabelac 2020-04-08 20:51:24 UTC
Please provide tested patch - so it can be considered for upstreaming.

Comment 4 Michael Orlitzky 2020-04-08 21:44:28 UTC
Created attachment 1677380 [details]

Comment 5 Michael Orlitzky 2020-04-08 21:45:29 UTC
Created attachment 1677381 [details]

I had to fix a few "echo" calls after guarding "set -o pipefail" behind a bash test, too. The resulting command-count.h and command-lines-input.h are unchanged for me.

Comment 7 Zdenek Kabelac 2023-02-10 21:40:51 UTC
Fixed with different solution to avoid using pipe - which is hard to catch when it fail without 'set -o pipefail'


Will likely go upstream with lvm2 2.03.19  with some more MuslC/dash fixes as well.

Note You need to log in before you can comment on or make changes to this bug.