OpenSolaris

Printable Version Enter a New Search
Bug ID 6203159
Synopsis xargs sometimes strips quote characters from input
State 10-Fix Delivered (Fix available in build)
Category:Subcategory utility:other
Keywords
Responsible Engineer Paul M Roberts
Reported Against 5.7 , s10_60
Duplicate Of
Introduced In solaris_2.5
Commit to Fix snv_12
Fixed In snv_12
Release Fixed solaris_nevada(snv_12) , solaris_10u1(s10u1_09) (Bug ID:2125271) solaris_9(s9patch) (Bug ID:2125404,) solaris_8(s8patch) (Bug ID:2125405,) solaris_7(s7patch) (Bug ID:2125406,)
Related Bugs 1208164 , 6181999
Submit Date 2-December-2004
Last Update Date 30-June-2005
Description
xargs does not always handle its arguments correctly.
Please find attached to the bug, the follwing files:
* in
* sedscript
* echo_args

As will be seen, the sedscript reads the file named "in", takes
each character and precedes it with a backslash, then feeds it
onto xargs which prints each of the arguments it's given to the
file out. At the end, the files "in" and "out" should be identical.
For a small enough "in" file they are, but for the file "in"
attached (6623 characters), they are not.

Here's the output of "diff in out"
39c39,44
< are found in <filename>/dev/dsk</filename>; the names of the raw files are
---
> are
> found
> in
> <filename>/dev/dsk</filename>;
> the
> names of the raw files are

If the gnu version of xargs (from the sunfreeware site) is used,
the files "in" and "out" are identical.

The same behaviour is observed with Solars 2.6, 7, 8, 9 and 
10_70.

Work Around
Use the '-n' argument with a small value, which reduces the likelihood
that the maximum arglist length will be reached. To guarantee that the
bug won't appear, use a '-n' value of 1. This severely reduces the
efficiency of xargs, however, by causing it to exec the target command
more frequently.

Alternatively, use GNU xargs instead (/opt/sfw/bin/gxargs).
 xxxxx@xxxxx.com 2005-1-07 17:20:40 GMT
Comments
N/A