no bzr problem - bzr behaves correctly with quoting (was: Re: broken handling of properly quoted relative paths)

Martin Steigerwald Martin at lichtvoll.de
Fri Jun 22 15:09:03 BST 2007


Am Freitag 22 Juni 2007 schrieb Kent Gibson:
> Hi Martin,
>
> Actually shell is doing the unquoting without you realising it - not
> the other tools.
> e.g.
> ~> find -type d -and -name .bzr -printf "%h\n" | xargs -n1 -i{} ls
> \"{}\" ls: "./bzr.dev": No such file or directory
> ...
>
> Or is ls broken too?

Hello Kent!

Thanks for the hint:

"bzr" indeed supports quoting as correctly as "ls":

---------------------------------------------------------------------
martin at shambala:~> mkdir "Name with spaces"
martin at shambala:~> LANG=C ls -l Name with spaces
ls: Name: No such file or directory
ls: with: No such file or directory
ls: spaces: No such file or directory
martin at shambala:~> LANG=C ls -l "Name with spaces"
total 0

martin at shambala:~> bzr check Geburtstag 2007
bzr: ERROR: extra argument to command check: 2007
martin at shambala:~#2> bzr check "Geburtstag 2007"
checked branch file:///home/martin/Geburtstag%202007/ format Bazaar-NG 
branch format 5
checked repository <bzrlib.transport.local.LocalTransport 
url=file:///home/martin/Geburtstag%202007/> format 
<RepositoryFormatKnit1>
    15 revisions
    22 unique file texts
    78 repeated file texts
     9 weaves
---------------------------------------------------------------------

So I stumbled upon the behavior of xargs, that is documented in its 
manpage:

---------------------------------------------------------------------
       -I replace-str
              Replace  occurrences of replace-str in the initial-arguments 
with names read from standard input.  Also, unquoted
              blanks do not terminate input items; instead the separator 
is the newline character.  Implies -x and -L 1.
---------------------------------------------------------------------

Well xargs actually seems to construct an array of arguments for the 
command it executes instead of executing it as a command line that could 
have been typed in the shell. That would also explain why it doesn't 
display any quotes when combinded with "echo". 

That also would explains that something like

xargs -n1 -I {} "OLDDIR=$(pwd) ; cd {} ; hg verify ; cd $OLDDIR" 

does not work, as it is not executed as a command line.

Anyway, its not bzr at fault. 

Thanks for the hint, Kent.

Regards,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070622/805ac036/attachment.pgp 


More information about the bazaar mailing list