Skip to contentSkip to conversation

configure: Fix shell syntax to placate OpenBSD's pdksh

PATCH In review Peter Maydell 5 participants 7 messages Dec 14, 2015 – Dec 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Fix shell syntax to placate OpenBSD's pdksh

Unfortunately the OpenBSD pdksh does not like brackets inside the right part of a ${variable+word} parameter expansion:

  $ echo "${a+($b)}"
  ksh: ${a+($b)}": bad substitution

though both bash and dash accept them. In any case this line was causing odd output in the case where nettle is not present:
nettle no ()

(because if nettle is not present then $nettle will be "no", not a null string or unset).

Rewrite it to just use an if.

This bug was originally introduced in becaeb726 and was present in the 2.4.0 release.

---
This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -1
index b9552fd..6ca6c64 100755
@@ -4758,7 +4758,11 @@ echo "GTK GL support    $gtk_gl"
 echo "GNUTLS support    $gnutls"
 echo "GNUTLS hash       $gnutls_hash"
 echo "libgcrypt         $gcrypt"
-echo "nettle            $nettle ${nettle+($nettle_version)}"
+if test "$nettle" = "yes"; then
+    echo "nettle            $nettle ($nettle_version)"
+else
+    echo "nettle            $nettle"
+fi
 echo "libtasn1          $tasn1"
 echo "VTE support       $vte"
 echo "curses support    $curses"
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Peter Maydell

Unfortunately the OpenBSD pdksh does not like brackets inside the right part of a ${variable+word} parameter expansion:

  $ echo "${a+($b)}"
  ksh: ${a+($b)}": bad substitution

though both bash and dash accept them. In any case this line was causing odd output in the case where nettle is not present:
nettle no ()

(because if nettle is not present then $nettle will be "no", not a null string or unset).

Rewrite it to just use an if.

This bug was originally introduced in becaeb726 and was present in the 2.4.0 release.

Quoted 8 lines

---
This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

Can OpenBSD users do:

/path/to/bash ./configure

to work around it?

That, and the fact that we went an entire release cycle without a report of a problem, means few developers are even attempting OpenBSD builds. So, I would argue that as a non-regression, and where there is a likely workaround of using a different shell, this can wait until 2.6.

Quoted 9 lines
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +0 -0
index b9552fd..6ca6c64 100755

configure echo "GTK GL support $gtk_gl" · line 4765

Quoted 9 lines
configure +5 -1
@@ -4758,7 +4758,11 @@ echo "GTK GL support    $gtk_gl"
 echo "GNUTLS support    $gnutls"
 echo "GNUTLS hash       $gnutls_hash"
 echo "libgcrypt         $gcrypt"
-echo "nettle            $nettle ${nettle+($nettle_version)}"
+if test "$nettle" = "yes"; then
+    echo "nettle            $nettle ($nettle_version)"
+else
+    echo "nettle            $nettle"
+fi

At any rate,

Quoted 4 lines
configure +0 -0
 echo "libtasn1          $tasn1"
 echo "VTE support       $vte"
 echo "curses support    $curses"
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw
In reply to Peter Maydell
Quoted 18 lines · Peter Maydell

Unfortunately the OpenBSD pdksh does not like brackets inside the right part of a ${variable+word} parameter expansion:

  $ echo "${a+($b)}"
  ksh: ${a+($b)}": bad substitution

though both bash and dash accept them. In any case this line was causing odd output in the case where nettle is not present:
nettle no ()

(because if nettle is not present then $nettle will be "no", not a null string or unset).

Rewrite it to just use an if.

This bug was originally introduced in becaeb726 and was present in the 2.4.0 release.

Quoted 8 lines

---
This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

Harmless enough that it shouldn't warrant an extra rc.

Paolo

Quoted 21 lines
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -1
index b9552fd..6ca6c64 100755
@@ -4758,7 +4758,11 @@ echo "GTK GL support    $gtk_gl"
 echo "GNUTLS support    $gnutls"
 echo "GNUTLS hash       $gnutls_hash"
 echo "libgcrypt         $gcrypt"
-echo "nettle            $nettle ${nettle+($nettle_version)}"
+if test "$nettle" = "yes"; then
+    echo "nettle            $nettle ($nettle_version)"
+else
+    echo "nettle            $nettle"
+fi
 echo "libtasn1          $tasn1"
 echo "VTE support       $vte"
 echo "curses support    $curses"
#2 lore raw
In reply to Eric Blake
Quoted 8 lines · Eric Blake
Quoted 4 lines · Peter Maydell

This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

Can OpenBSD users do:

Quoted 8 lines

/path/to/bash ./configure

to work around it?

That, and the fact that we went an entire release cycle without a report of a problem, means few developers are even attempting OpenBSD builds. So, I would argue that as a non-regression, and where there is a likely workaround of using a different shell, this can wait until 2.6.

Mmm, I'm kind of leaning towards "don't put this in 2.5" as well.

thanks
-- PMM

#3 lore raw
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Eric Blake
Quoted 4 lines · Peter Maydell

This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

Can OpenBSD users do:

/path/to/bash ./configure

Quoted 8 lines
Quoted 6 lines

to work around it?

That, and the fact that we went an entire release cycle without a report of a problem, means few developers are even attempting OpenBSD builds. So, I would argue that as a non-regression, and where there is a likely workaround of using a different shell, this can wait until 2.6.

Mmm, I'm kind of leaning towards "don't put this in 2.5" as well.

Add to http://qemu-project.org/ChangeLog/2.5#Known_issues and call it a day?

#6 lore raw
In reply to Peter Maydell
Quoted 18 lines · Peter Maydell

Unfortunately the OpenBSD pdksh does not like brackets inside the right part of a ${variable+word} parameter expansion:

  $ echo "${a+($b)}"
  ksh: ${a+($b)}": bad substitution

though both bash and dash accept them. In any case this line was causing odd output in the case where nettle is not present:
nettle no ()

(because if nettle is not present then $nettle will be "no", not a null string or unset).

Rewrite it to just use an if.

This bug was originally introduced in becaeb726 and was present in the 2.4.0 release.

Quoted 8 lines

---
This fixes a problem where configure just falls over on OpenBSD, but on the other hand it is not a regression since 2.4.0... Opinions on whether we should put it in 2.5 as a last minute thing welcome.

Now committed to master since we're post-2.5. I added a
Cc: [email protected]

too.

thanks
-- PMM