qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: avoid basename usage message
@ 2011-04-08 16:33 Scott Wood
  2011-04-08 18:56 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2011-04-08 16:33 UTC (permalink / raw)
  To: qemu-devel

basename prints a missing-argument error when sdlconfig is empty
and we're cross-compiling.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 configure |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index ae97e11..c5b85fe 100755
--- a/configure
+++ b/configure
@@ -1233,7 +1233,8 @@ else
   fi
   sdl=no
 fi
-if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then
+if test -n "$cross_prefix" -a -n "$sdlconfig" && \
+   test "`basename $sdlconfig`" = sdl-config; then
   echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
 fi
 
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] configure: avoid basename usage message
  2011-04-08 16:33 [Qemu-devel] [PATCH] configure: avoid basename usage message Scott Wood
@ 2011-04-08 18:56 ` Stefan Hajnoczi
  2011-04-08 19:15   ` [Qemu-devel] [PATCH v2] " Scott Wood
  2011-04-08 20:06   ` [Qemu-devel] [PATCH] " Anthony Liguori
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-04-08 18:56 UTC (permalink / raw)
  To: Scott Wood; +Cc: qemu-devel

On Fri, Apr 08, 2011 at 11:33:49AM -0500, Scott Wood wrote:
> diff --git a/configure b/configure
> index ae97e11..c5b85fe 100755
> --- a/configure
> +++ b/configure
> @@ -1233,7 +1233,8 @@ else
>    fi
>    sdl=no
>  fi
> -if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then
> +if test -n "$cross_prefix" -a -n "$sdlconfig" && \
> +   test "`basename $sdlconfig`" = sdl-config; then

Instead of doing test -n "$sdlconfig" first with short-circuit
evaluation, I think would should do:

test $(basename "$sdlconfig") = sdl-config

Then you don't need to test sdlconfig because basename will produce an
empty string without error.

Stefan

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

* [Qemu-devel] [PATCH v2] configure: avoid basename usage message
  2011-04-08 18:56 ` Stefan Hajnoczi
@ 2011-04-08 19:15   ` Scott Wood
  2011-04-09 11:19     ` [Qemu-devel] " Stefan Hajnoczi
  2011-04-08 20:06   ` [Qemu-devel] [PATCH] " Anthony Liguori
  1 sibling, 1 reply; 6+ messages in thread
From: Scott Wood @ 2011-04-08 19:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

basename prints a missing-argument error when sdlconfig is empty
and we're cross-compiling.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
v2: quote the input to basename rather than introduce an extra test,
as suggested by Stefan.

 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index ae97e11..2bb3faa 100755
--- a/configure
+++ b/configure
@@ -1233,7 +1233,7 @@ else
   fi
   sdl=no
 fi
-if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then
+if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
   echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
 fi
 
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] configure: avoid basename usage message
  2011-04-08 18:56 ` Stefan Hajnoczi
  2011-04-08 19:15   ` [Qemu-devel] [PATCH v2] " Scott Wood
@ 2011-04-08 20:06   ` Anthony Liguori
  2011-04-08 20:20     ` Scott Wood
  1 sibling, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2011-04-08 20:06 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Scott Wood, qemu-devel

On 04/08/2011 01:56 PM, Stefan Hajnoczi wrote:
> On Fri, Apr 08, 2011 at 11:33:49AM -0500, Scott Wood wrote:
>> diff --git a/configure b/configure
>> index ae97e11..c5b85fe 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1233,7 +1233,8 @@ else
>>     fi
>>     sdl=no
>>   fi
>> -if test -n "$cross_prefix"&&  test "`basename $sdlconfig`" = sdl-config; then
>> +if test -n "$cross_prefix" -a -n "$sdlconfig"&&  \
>> +   test "`basename $sdlconfig`" = sdl-config; then
> Instead of doing test -n "$sdlconfig" first with short-circuit
> evaluation, I think would should do:
>
> test $(basename "$sdlconfig") = sdl-config

$() is a bash-ism FYI.

Regards,

Anthony Liguori

> Then you don't need to test sdlconfig because basename will produce an
> empty string without error.
>
> Stefan
>

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

* Re: [Qemu-devel] [PATCH] configure: avoid basename usage message
  2011-04-08 20:06   ` [Qemu-devel] [PATCH] " Anthony Liguori
@ 2011-04-08 20:20     ` Scott Wood
  0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2011-04-08 20:20 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefan Hajnoczi, qemu-devel

On Fri, 8 Apr 2011 15:06:57 -0500
Anthony Liguori <anthony@codemonkey.ws> wrote:

> On 04/08/2011 01:56 PM, Stefan Hajnoczi wrote:
> > On Fri, Apr 08, 2011 at 11:33:49AM -0500, Scott Wood wrote:
> >> diff --git a/configure b/configure
> >> index ae97e11..c5b85fe 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -1233,7 +1233,8 @@ else
> >>     fi
> >>     sdl=no
> >>   fi
> >> -if test -n "$cross_prefix"&&  test "`basename $sdlconfig`" = sdl-config; then
> >> +if test -n "$cross_prefix" -a -n "$sdlconfig"&&  \
> >> +   test "`basename $sdlconfig`" = sdl-config; then
> > Instead of doing test -n "$sdlconfig" first with short-circuit
> > evaluation, I think would should do:
> >
> > test $(basename "$sdlconfig") = sdl-config
> 
> $() is a bash-ism FYI.

See section 2.6.3 of
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

And I've tested that it works in dash.

-Scott

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

* [Qemu-devel] Re: [PATCH v2] configure: avoid basename usage message
  2011-04-08 19:15   ` [Qemu-devel] [PATCH v2] " Scott Wood
@ 2011-04-09 11:19     ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2011-04-09 11:19 UTC (permalink / raw)
  To: Scott Wood; +Cc: qemu-devel

On Fri, Apr 08, 2011 at 02:15:50PM -0500, Scott Wood wrote:
> basename prints a missing-argument error when sdlconfig is empty
> and we're cross-compiling.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> v2: quote the input to basename rather than introduce an extra test,
> as suggested by Stefan.
> 
>  configure |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

I have merged into the trivial patches tree since $() is POSIX and we
already use it in ./configure:
git://repo.or.cz/qemu/stefanha.git trivial-patches

A pull request will be sent to merge this into qemu.git.  For more
information, see http://wiki.qemu.org/Contribute/TrivialPatches.

Stefan

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

end of thread, other threads:[~2011-04-09 11:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-08 16:33 [Qemu-devel] [PATCH] configure: avoid basename usage message Scott Wood
2011-04-08 18:56 ` Stefan Hajnoczi
2011-04-08 19:15   ` [Qemu-devel] [PATCH v2] " Scott Wood
2011-04-09 11:19     ` [Qemu-devel] " Stefan Hajnoczi
2011-04-08 20:06   ` [Qemu-devel] [PATCH] " Anthony Liguori
2011-04-08 20:20     ` Scott Wood

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).