diff mbox series

[4/5] meson: !/bin/sh are msys2 friendly.

Message ID 20200825083500.359-4-luoyonggang@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/5] meson: SIMPLE_PATH_RE should match the full path token. Or the $ and : contained in path would not matched. if the path are start with C:/ and E:/ | expand

Commit Message

Yonggang Luo Aug. 25, 2020, 8:34 a.m. UTC
From: Yonggang Luo <luoyonggang@gmail.com>

---
 scripts/undefsym.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel P. Berrangé Aug. 25, 2020, 8:59 a.m. UTC | #1
On Tue, Aug 25, 2020 at 04:34:59PM +0800, luoyonggang@gmail.com wrote:
> From: Yonggang Luo <luoyonggang@gmail.com>
> 
> ---
>  scripts/undefsym.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/undefsym.sh b/scripts/undefsym.sh
> index b9ec332e95..8189308b2c 100755
> --- a/scripts/undefsym.sh
> +++ b/scripts/undefsym.sh
> @@ -1,4 +1,4 @@
> -#! /usr/bin/env bash
> +#!/bin/sh

Does this script actually work on non-bash shells ?  If not, then this
change will likely break on plaforms where /bin/sh is not bash.

>  
>  # Before a shared module's DSO is produced, a static library is built for it
>  # and passed to this script.  The script generates -Wl,-u options to force
> -- 
> 2.27.0.windows.1
> 
> 

Regards,
Daniel
Yonggang Luo Aug. 25, 2020, 9:11 a.m. UTC | #2
Hi, works, msys2 sh compiled and run

On Tue, Aug 25, 2020 at 4:59 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:

> On Tue, Aug 25, 2020 at 04:34:59PM +0800, luoyonggang@gmail.com wrote:
> > From: Yonggang Luo <luoyonggang@gmail.com>
> >
> > ---
> >  scripts/undefsym.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/undefsym.sh b/scripts/undefsym.sh
> > index b9ec332e95..8189308b2c 100755
> > --- a/scripts/undefsym.sh
> > +++ b/scripts/undefsym.sh
> > @@ -1,4 +1,4 @@
> > -#! /usr/bin/env bash
> > +#!/bin/sh
>
> Does this script actually work on non-bash shells ?  If not, then this
> change will likely break on plaforms where /bin/sh is not bash.
>
> >
> >  # Before a shared module's DSO is produced, a static library is built
> for it
> >  # and passed to this script.  The script generates -Wl,-u options to
> force
> > --
> > 2.27.0.windows.1
> >
> >
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-
> https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
> https://www.instagram.com/dberrange :|
>
>
Eric Blake Aug. 25, 2020, 1:59 p.m. UTC | #3
On 8/25/20 4:11 AM, 罗勇刚(Yonggang Luo) wrote:
> Hi, works, msys2 sh compiled and run

Top-formatting makes it harder to read, compared to interleaving your 
responses.

msys2 sh _is_ bash, so that's not answering the question Dan asked.


>>> +++ b/scripts/undefsym.sh
>>> @@ -1,4 +1,4 @@
>>> -#! /usr/bin/env bash
>>> +#!/bin/sh
>>
>> Does this script actually work on non-bash shells ?  If not, then this
>> change will likely break on plaforms where /bin/sh is not bash.

A quick look at the script sees:

comm -12 \
   <( $NM -P -g $staticlib | awk '$2!="U"{print "-Wl,-u," $1}' | sort -u) \
   <( $NM -P -g "$@" | awk '$2=="U"{print "-Wl,-u," $1}' | sort -u)


<() is a bash'ism, so you _are_ breaking things on platforms like Debian 
where /bin/sh is dash rather than bash.
Yonggang Luo Aug. 25, 2020, 2:21 p.m. UTC | #4
OK, maybe convert this to python script would be a better option.
Then skip this first

On Tue, Aug 25, 2020 at 9:59 PM Eric Blake <eblake@redhat.com> wrote:

> On 8/25/20 4:11 AM, 罗勇刚(Yonggang Luo) wrote:
> > Hi, works, msys2 sh compiled and run
>
> Top-formatting makes it harder to read, compared to interleaving your
> responses.
>
> msys2 sh _is_ bash, so that's not answering the question Dan asked.
>
>
> >>> +++ b/scripts/undefsym.sh
> >>> @@ -1,4 +1,4 @@
> >>> -#! /usr/bin/env bash
> >>> +#!/bin/sh
> >>
> >> Does this script actually work on non-bash shells ?  If not, then this
> >> change will likely break on plaforms where /bin/sh is not bash.
>
> A quick look at the script sees:
>
> comm -12 \
>    <( $NM -P -g $staticlib | awk '$2!="U"{print "-Wl,-u," $1}' | sort -u) \
>    <( $NM -P -g "$@" | awk '$2=="U"{print "-Wl,-u," $1}' | sort -u)
>
>
> <() is a bash'ism, so you _are_ breaking things on platforms like Debian
> where /bin/sh is dash rather than bash.
>
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
>
>
diff mbox series

Patch

diff --git a/scripts/undefsym.sh b/scripts/undefsym.sh
index b9ec332e95..8189308b2c 100755
--- a/scripts/undefsym.sh
+++ b/scripts/undefsym.sh
@@ -1,4 +1,4 @@ 
-#! /usr/bin/env bash
+#!/bin/sh
 
 # Before a shared module's DSO is produced, a static library is built for it
 # and passed to this script.  The script generates -Wl,-u options to force