[bug #58149] Whitespace parsing differs with and without -i

anonymous <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/bugs/?58149>

                 Summary: Whitespace parsing differs with and without -i
                 Project: findutils
            Submitted by: None
            Submitted on: Thu 09 Apr 2020 05:55:59 PM UTC
                Category: xargs
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Ryan Moore
        Originator Email: [email protected]
             Open/Closed: Open
                 Release: 4.7.0
         Discussion Lock: Any
           Fixed Release: None

    _______________________________________________________

Details:

I would expect this to use -n1 to separate the whitespace-delimited parameters
"a" and "b" and "c" to print 3 separate lines:


root@rmoore:~# echo "a b c" | xargs -n1 -i{} echo foo {}
foo a b c


If I manually specify a space as the delimiter, it works as expected (and
gives an extra CR with the last line, since it's now "c\n"):


root@rmoore:~# echo "a b c" | xargs -d\  -n1 -i{} echo foo {}
foo a
foo b
foo c




If I run without -I{} as a substitution, it works as expected (and prints {}
explicitly):

root@rmoore:~# echo "a b c" | xargs -n1 echo foo {}
foo {} a
foo {} b
foo {} c



Version info, from Ubuntu 16.04 (also confirmed on 18.04):

root@rmoore:~# xargs --version
xargs (GNU findutils) 4.7.0-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58149>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.