qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] configure echo usage
@ 2008-12-17  7:24 Lev Lvovsky
  2008-12-17  9:32 ` John Haxby
  0 siblings, 1 reply; 7+ messages in thread
From: Lev Lvovsky @ 2008-12-17  7:24 UTC (permalink / raw)
  To: qemu-devel

I'm new to the list, so please let me know if this isn't the way to go  
about this:

/bin/sh on my system (OS X 10.5.x) invokes a shell which has a built- 
in echo command which doesn't have a "-n" option.  Subseqently the  
config output files don't get comments where they should.  The  
following patch should provide the same functionality.

thanks,
-lev

------


bash-3.2$ svn diff configure
Index: configure
===================================================================
--- configure   (revision 6069)
+++ configure   (working copy)
@@ -1094,8 +1094,7 @@
  test -f $config_h && mv $config_h ${config_h}~

  echo "# Automatically generated by configure - do not modify" >  
$config_mak
-echo -n "# Configured with:" >> $config_mak
-printf " '%s'" "$0" "$@" >> $config_mak
+printf "# Configured with: $0 $@" >> $config_mak
  echo >> $config_mak
  echo "/* Automatically generated by configure - do not modify */" >  
$config_h

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

* Re: [Qemu-devel] configure echo usage
  2008-12-17  7:24 [Qemu-devel] configure echo usage Lev Lvovsky
@ 2008-12-17  9:32 ` John Haxby
  2008-12-17  9:46   ` Andreas Schwab
  2008-12-17 17:15   ` Lev Lvovsky
  0 siblings, 2 replies; 7+ messages in thread
From: John Haxby @ 2008-12-17  9:32 UTC (permalink / raw)
  To: qemu-devel

Lev Lvovsky wrote:
>
> bash-3.2$ svn diff configure
> Index: configure
> ===================================================================
> --- configure   (revision 6069)
> +++ configure   (working copy)
> @@ -1094,8 +1094,7 @@
>  test -f $config_h && mv $config_h ${config_h}~
>
>  echo "# Automatically generated by configure - do not modify" > 
> $config_mak
> -echo -n "# Configured with:" >> $config_mak
> -printf " '%s'" "$0" "$@" >> $config_mak
> +printf "# Configured with: $0 $@" >> $config_mak
>  echo >> $config_mak
>  echo "/* Automatically generated by configure - do not modify */" > 
> $config_h
>
>
>


That doesn't give the same output: the original puts each of $0 and the 
$@'s with single quotes around them in the config file, yours misses out 
the quotes.   Replacing the original echo -n, printf and echo like this 
would work though:

    echo "# Configured with:$(printf " '%s'" "$0" "$@")" >> $config_mak

If the OS X shell doesn't do $(...) then this will work, albeit at the 
cost of readabilty

    echo "# Configured with:"`printf " '%s'" "$0" "$@"` >> $config_mak

(those pesky backquotes are harder to see and for the ultra-picky it's 
not quite the same thing).

jch

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

* Re: [Qemu-devel] configure echo usage
  2008-12-17  9:32 ` John Haxby
@ 2008-12-17  9:46   ` Andreas Schwab
  2008-12-17 10:34     ` John Haxby
  2008-12-17 17:15   ` Lev Lvovsky
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2008-12-17  9:46 UTC (permalink / raw)
  To: qemu-devel

John Haxby <john.haxby@oracle.com> writes:

>    echo "# Configured with:$(printf " '%s'" "$0" "$@")" >> $config_mak

You don't need echo if you have printf.

    { printf "# Configured with:"
      printf " '%s'" "$0" "$@"
    } >> $config_mak

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [Qemu-devel] configure echo usage
  2008-12-17  9:46   ` Andreas Schwab
@ 2008-12-17 10:34     ` John Haxby
  0 siblings, 0 replies; 7+ messages in thread
From: John Haxby @ 2008-12-17 10:34 UTC (permalink / raw)
  To: qemu-devel

Andreas Schwab wrote:
> John Haxby <john.haxby@oracle.com> writes:
>
>   
>>    echo "# Configured with:$(printf " '%s'" "$0" "$@")" >> $config_mak
>>     
>
> You don't need echo if you have printf.
>
>     { printf "# Configured with:"
>       printf " '%s'" "$0" "$@"
>     } >> $config_mak
>
>   
You're missing a new line :-)  Seriously though, there are any number of 
ways to do the job, some longer and more obscure than others.   If you 
don't have printf and echo -n you can still do it:

   echo $(echo "# Configured with:"; for i in "$0" "$@"; do echo "'$i'"; 
done)

and there are ways of using 'tr -d' as well.  And, I'm sure, many 
others.   We should have a Holiday Competition for the most obscure :-)

jch

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

* Re: [Qemu-devel] configure echo usage
  2008-12-17  9:32 ` John Haxby
  2008-12-17  9:46   ` Andreas Schwab
@ 2008-12-17 17:15   ` Lev Lvovsky
       [not found]     ` <4510F100-F900-4CAF-8269-7721B6FA3001@hotmail.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Lev Lvovsky @ 2008-12-17 17:15 UTC (permalink / raw)
  To: qemu-devel, John Haxby


On Dec 17, 2008, at 1:32 AM, John Haxby wrote:
>
> That doesn't give the same output: the original puts each of $0 and  
> the $@'s with single quotes around them in the config file, yours  
> misses out the quotes.   Replacing the original echo -n, printf and  
> echo like this would work though:
>
>   echo "# Configured with:$(printf " '%s'" "$0" "$@")" >> $config_mak

The above works as intended.

> If the OS X shell doesn't do $(...) then this will work, albeit at  
> the cost of readabilty
>
>   echo "# Configured with:"`printf " '%s'" "$0" "$@"` >> $config_mak

This works too.

Typically how do these patches get absorbed into the source?

thanks!
-lev

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

* Re: [Qemu-devel] configure echo usage
       [not found]     ` <4510F100-F900-4CAF-8269-7721B6FA3001@hotmail.com>
@ 2008-12-18  4:46       ` C.W. Betts
  2008-12-18  5:23         ` Lev Lvovsky
  0 siblings, 1 reply; 7+ messages in thread
From: C.W. Betts @ 2008-12-18  4:46 UTC (permalink / raw)
  To: qemu-devel

The reason why /bin/sh's echo doesn't work is because it's working in  
legacy mode: http://developer.apple.com/releasenotes/Darwin/RN-Unix03Conformance/
Maybe changing the shell that processes it to /bin/bash?
On Dec 17, 2008, at 10:15 AM, Lev Lvovsky wrote:

>
> On Dec 17, 2008, at 1:32 AM, John Haxby wrote:
>>
>> That doesn't give the same output: the original puts each of $0 and  
>> the $@'s with single quotes around them in the config file, yours  
>> misses out the quotes.   Replacing the original echo -n, printf and  
>> echo like this would work though:
>>
>>  echo "# Configured with:$(printf " '%s'" "$0" "$@")" >> $config_mak
>
> The above works as intended.
>
>> If the OS X shell doesn't do $(...) then this will work, albeit at  
>> the cost of readabilty
>>
>>  echo "# Configured with:"`printf " '%s'" "$0" "$@"` >> $config_mak
>
> This works too.
>
> Typically how do these patches get absorbed into the source?
>
> thanks!
> -lev
>
>

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

* Re: [Qemu-devel] configure echo usage
  2008-12-18  4:46       ` C.W. Betts
@ 2008-12-18  5:23         ` Lev Lvovsky
  0 siblings, 0 replies; 7+ messages in thread
From: Lev Lvovsky @ 2008-12-18  5:23 UTC (permalink / raw)
  To: qemu-devel, C.W. Betts

C.W.,

On Dec 17, 2008, at 8:46 PM, C.W. Betts wrote:

> The reason why /bin/sh's echo doesn't work is because it's working  
> in legacy mode: http://developer.apple.com/releasenotes/Darwin/RN-Unix03Conformance/
> Maybe changing the shell that processes it to /bin/bash?

By that, do you mean the ! line at the top, or changing it on my  
system end?  I figured that that might break more than just what I had  
intended.

thanks,
-lev

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

end of thread, other threads:[~2008-12-18  5:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17  7:24 [Qemu-devel] configure echo usage Lev Lvovsky
2008-12-17  9:32 ` John Haxby
2008-12-17  9:46   ` Andreas Schwab
2008-12-17 10:34     ` John Haxby
2008-12-17 17:15   ` Lev Lvovsky
     [not found]     ` <4510F100-F900-4CAF-8269-7721B6FA3001@hotmail.com>
2008-12-18  4:46       ` C.W. Betts
2008-12-18  5:23         ` Lev Lvovsky

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