linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] bashism in tools/Makefile.in
@ 2020-01-06  9:48 Christian Hesse
  2020-01-06 11:24 ` Zdenek Kabelac
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Hesse @ 2020-01-06  9:48 UTC (permalink / raw)
  To: LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]

Hello everybody,

building lvm2 with a shell other than bash fails:

% make -C tools/ command-count.h
make: Entering directory 'lvm2/tools'
    [GEN] cmds.h
/bin/dash: 1: set: Illegal option -o pipefail
    [GEN] command-lines-input.h
/bin/dash: 1: set: Illegal option -o pipefail
    [GEN] command-count.h
/bin/dash: 1: set: Illegal option -o pipefail
make: *** [Makefile:170: command-count.h] Error 2
make: Leaving directory 'lvm2/tools'

Please fix bashism in Makefile. Thanks!
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] bashism in tools/Makefile.in
  2020-01-06  9:48 [linux-lvm] bashism in tools/Makefile.in Christian Hesse
@ 2020-01-06 11:24 ` Zdenek Kabelac
  2020-01-06 12:54   ` [linux-lvm] [PATCH 1/1] build: force to use bash (was: Re: bashism in tools/Makefile.in) Christian Hesse
  0 siblings, 1 reply; 3+ messages in thread
From: Zdenek Kabelac @ 2020-01-06 11:24 UTC (permalink / raw)
  To: LVM general discussion and development, Christian Hesse

Dne 06. 01. 20 v 10:48 Christian Hesse napsal(a):
> Hello everybody,
> 
> building lvm2 with a shell other than bash fails:
> 
> % make -C tools/ command-count.h
> make: Entering directory 'lvm2/tools'
>      [GEN] cmds.h
> /bin/dash: 1: set: Illegal option -o pipefail
>      [GEN] command-lines-input.h
> /bin/dash: 1: set: Illegal option -o pipefail
>      [GEN] command-count.h
> /bin/dash: 1: set: Illegal option -o pipefail
> make: *** [Makefile:170: command-count.h] Error 2
> make: Leaving directory 'lvm2/tools'
> 
> Please fix bashism in Makefile. Thanks!
> 


Hi

Unfortunately whole lvm2 project is mostly 'bash' based and all developers 
mostly use bash - so we would welcome patches if they would provide 
equivalently working code without bashism...

Fixing couple things while the whole rest of project is still requiring bash 
doesn't make it any better - ATM  all scripts/tests/Makefiles mostly expect 
presence of bash.

Regards

Zdenek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [linux-lvm] [PATCH 1/1] build: force to use bash (was: Re: bashism in tools/Makefile.in)
  2020-01-06 11:24 ` Zdenek Kabelac
@ 2020-01-06 12:54   ` Christian Hesse
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Hesse @ 2020-01-06 12:54 UTC (permalink / raw)
  To: LVM general discussion and development; +Cc: Christian Hesse, Zdenek Kabelac

From: Christian Hesse <mail@eworm.de>

> Unfortunately whole lvm2 project is mostly 'bash' based and all developers
> mostly use bash - so we would welcome patches if they would provide
> equivalently working code without bashism...
>
> Fixing couple things while the whole rest of project is still requiring bash
> doesn't make it any better - ATM  all scripts/tests/Makefiles mostly expect
> presence of bash.

Fine with me. So how about forcing the build system to use bash?

-- >8 --
From: Christian Hesse <mail@eworm.de>
Subject: build: force to use bash

The build system expects bash, so force to use it. This mitigates issues
where other shells are fed with bashism.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 configure    | 15 +++++++++++++++
 configure.ac | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/configure b/configure
index 6dd7edac3..190d13c77 100755
--- a/configure
+++ b/configure
@@ -2960,6 +2960,21 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
 
+################################################################################
+if test -z "$BASH_VERSION$CONFIG_SHELL"
+then
+    CONFIG_SHELL=bash
+    export CONFIG_SHELL
+    if $CONFIG_SHELL -c "exit 0"
+    then
+        exec $CONFIG_SHELL $0 "$@"
+    else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: The 'bash' shell is needed to build lvm2" >&5
+$as_echo "$as_me: The 'bash' shell is needed to build lvm2" >&6;}
+        as_fn_error $? "'bash' not found" "$LINENO" 5
+    fi
+fi
+
 ################################################################################
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
diff --git a/configure.ac b/configure.ac
index 74ca20191..f8d0abdfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,21 @@ AC_CONFIG_HEADERS([include/configure.h])
 dnl -- Setup the directory where autoconf has auxilary files
 AC_CONFIG_AUX_DIR(autoconf)
 
+################################################################################
+dnl -- We need to run the build system with bash.
+if test -z "$BASH_VERSION$CONFIG_SHELL"
+then
+    CONFIG_SHELL=bash
+    export CONFIG_SHELL
+    if $CONFIG_SHELL -c "exit 0"
+    then
+        exec $CONFIG_SHELL $0 "$@"
+    else
+        AC_MSG_NOTICE([The 'bash' shell is needed to build lvm2])
+        AC_MSG_ERROR(['bash' not found])
+    fi
+fi
+
 ################################################################################
 dnl -- Get system type
 AC_CANONICAL_TARGET([])

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-06 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06  9:48 [linux-lvm] bashism in tools/Makefile.in Christian Hesse
2020-01-06 11:24 ` Zdenek Kabelac
2020-01-06 12:54   ` [linux-lvm] [PATCH 1/1] build: force to use bash (was: Re: bashism in tools/Makefile.in) Christian Hesse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).