URL:
  <http://savannah.gnu.org/bugs/?36652>

                 Summary: read_string() is wrongly documented to check for
logical eof.
                 Project: findutils
            Submitted by: None
            Submitted on: Wed 13 Jun 2012 09:15:49 PM UTC
                Category: xargs
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Samuel Bronson
        Originator Email: naes...@gmail.com
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
           Fixed Release: None

    _______________________________________________________

Details:


The documentation comment for the read_string() function in xargs.c is:

/* Read a null-terminated string from the input and add it to the list of
   arguments to pass to the command.
   Return -1 if eof (either physical or logical) is reached,
   otherwise the length of the string read (including the null).  */

But, there does not appear to be any place where "logical" eof (input matching
eof_str) could be checked for (nor is it really desirable that it be checked
for in -0 mode, since the whole point of -0 is to allow *any* filename).

(It might also be a good idea to state in the documentation that -e/-E have no
effect in -0 mode.  Emacs' grep.el actually tries to use "xargs -0 -e", and if
that doesn't work -- for example, with BSD xargs -- it falls back to "find
-exec" ...)

And, nitpicking further, this function actually only returns -1 when it hits
an EOF *before* it manages to read any characters into the buffer; otherwise,
EOF is treated basically the same way as the seperator character (which, by
the way, might not be NUL).




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36652>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


Reply via email to