bedrocklinux / bedrocklinux-userland

This tracks development for the things such as scripts and (defaults for) config files for Bedrock Linux
https://bedrocklinux.org
GNU General Public License v2.0
602 stars 65 forks source link

Build fails due to bashism in lvm2 Makefile #238

Closed flexibeast closed 2 years ago

flexibeast commented 2 years ago

Running make SKIPSIGN=true results in:

make -C tools
make[2]: Entering directory '/home/alexis/src/github/bedrocklinux-userland/build/x86_64/vendor/lvm2/tools'
    [GEN] command-lines-input.h
/bin/sh: 1: set: Illegal option -o pipefail

because on Void, by default, /bin/sh is a symlink to dash rather than bash, and the pipefail option is a bashism.

My kludge to work around this:

sed -i 's/@SHELL@/\/bin\/bash/' $(VENDOR)/lvm2/make.tmpl.in

before this line in the bedrock Makefile.

paradigm commented 2 years ago

I installed Void in a VM and did successfully reproduce the issue. Strange I've never run into this before, as I tend to build with Debian that also has /bin/sh setup to be a symlink to dash.

Presumably Void's developers run into this when building the same things. A quick skim of Void's device-mapper and lvm2 packages don't seem to do anything special to handle this, but I could be easily looking in the wrong place.

The ideal fix here would be to upstream changes to LVM to get their build system to be a bit more portable, but I won't have the bandwidth to pursue it in the foreseeable future.

The line you modified where $SHELL is set respects being overridden as a make argument, e.g.

make SKIPSIGN=true SHELL=/bin/bash

Given this, rather than editing one of LVM's files, we can work around this on Bedrock's end by having the Bedrock Makefile line which calls out to the LVM Makefile set SHELL=bash. I've pushed a commit to do this.

Do you mind building against Bedrock's master branch on Void again, this time without your patch, to confirm that the above mentioned change fixes things for you?

flexibeast commented 2 years ago

Strange I've never run into this before, as I tend to build with Debian that also has /bin/sh setup to be a symlink to dash.

Huh.

Presumably Void's developers run into this when building the same things. A quick skim of Void's device-mapper and lvm2 packages don't seem to do anything special to handle this, but I could be easily looking in the wrong place.

Package builds take place inside a chroot, which uses bash: https://github.com/void-linux/void-packages/blob/39fa2fca7926c7aec66941ab1077788ad29c66aa/common/xbps-src/shutils/chroot.sh#L89

The ideal fix here would be to upstream changes to LVM to get their build system to be a bit more portable, but I won't have the bandwidth to pursue it in the foreseeable future.

Yeah, i don't think i will either; i'm already juggling too many things as it is. :-)

Do you mind building against Bedrock's master branch on Void again, this time without your patch, to confirm that the above mentioned change fixes things for you?

Just built successfully from a fresh clone of master. :-) Thanks!

paradigm commented 2 years ago

Thanks for reporting this, digging into what's going on to make finding a good fix easy, and testing it!