bugfindutils - Bugs: bug #40648, xargs -t does not show EXACT...

 
 

bug #40648: xargs -t does not show EXACT command line

Submitter:  None
Submitted:  Wed 20 Nov 2013 05:06:28 PM UTC
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Works For Me
Privacy:  Public Assigned to:  None
Originator Name:  Anne van Rossum Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  None
Fixed Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Sun 12 Jan 2014 08:30:31 PM UTC, comment #1: 

Shell quoting would probably be misleading though; xargs does not use a shell to launch its commands.

The --quoting-style=shell variant appears to work since, by default, xargs does some quote processing on its input.  However this quote processing is not the same as what the shell does, so depending on this is not a safe option for the general case.

In your examples though, I don't think that it's nautilus's fault.  The problem is that xargs considers arguments to be separated by spaces.   Hence a better way to solve the problem you are describing is this:

$ find . -name "example*" -exec nautilus {} \+

No quoting, shell or otherwise, is needed here to make Nautilus work correctly.

Since xargs only launches a shell if you specify it as the command, I'm not inclined to change the format of the output of "xargs -t" as this would be backward-incompatible and I don't think doing so has a compelling advantage.

Please feel free to re-open the bug if you plan to convince me otherwise.

James Youngman <jay>
Project Administrator
Wed 20 Nov 2013 05:06:28 PM UTC, original submission:  

Bug:

To reproduce:

$ mkdir "example 1"
$ mkdir "example 2"

Here "nautilus" is just an example program that does choke on something provided by spaces:

$ ls --quoting-style=literal | grep example | xargs -t nautilus
nautilus example 1 example 2 examples

$ ls --quoting-style=shell | grep example | xargs -t nautilus
nautilus example 1 example 2 examples

The former option does fail to open with nautilus ("example", "1", and "2" are opened), while the second properly does open nautilus properly.

Expected:

What I would expect as xargs -t output is the following:

$ ls --quoting-style=literal | grep example | xargs -t nautilus
nautilus example 1 example 2 examples

$ ls --quoting-style=shell | grep example | xargs -t nautilus
nautilus 'example 1' 'example 2' examples

So, I would expect it to have the quotes from the ls --quoting-style=shell | grep example command

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-12 jay StatusNone Works For Me
        Open/ClosedOpen Closed

    Back to the top


    Powered by Savane 3.9