[CentOS] unable to check in code to svn when files contain spaces or characters

Nico Kadel-Garcia nkadel at gmail.com
Wed Jan 26 04:21:40 UTC 2011


On Mon, Jan 24, 2011 at 9:06 AM,  <cpolish at surewest.net> wrote:
> Nico Kadel-Garcia wrote:

>> > i as able to add other files with space using the following command :
>> >
>> >  svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
>>
>> Second, stop playing with xargs in command line handling. It is not your friend.
>
> That seems harsh. Can you explain? It's been my experience
> that using "find mumble/ -print0 | xargs -0 mumble" almost
> always provides a way to process arbitrary file names. But
> maybe this particular case can't be shoehorned into that
> idiom?

It's a bit harsh, The fact that this conversation is happening here,
instead of the subversion user list where it would be more
appropriate, is a bit problematic. I personally hang out on both, but
you'll get better application advice like this on the appropriate user
mailing list.

xargs is very useful, but for line-by-line processing like this, its
default mangling of whitespace is designed to pass the set of
arguments as command line arguments to some basic shell command like
"rm" or "cp" or "cat". Read the manual page for details, or run "info
xargs" to get the full  texinfo documentation.

If you *NEED* to do this, you can use something like:

            svn st |grep ^'?' |cut -c8- | xargs --null svn add

This helps avoid border cases with spaces or tabs or '?' in filenames.
Robustly sanitizing inputs is an art form.



More information about the CentOS mailing list