bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #44221] Spurious warning about non-option arguments is spurious


From: anonymous
Subject: [bug #44221] Spurious warning about non-option arguments is spurious
Date: Tue, 10 Feb 2015 13:45:23 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0

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

                 Summary: Spurious warning about non-option arguments is
spurious
                 Project: findutils
            Submitted by: None
            Submitted on: Tue 10 Feb 2015 01:45:22 PM UTC
                Category: find
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Andrew McGill
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.2
           Fixed Release: None

    _______________________________________________________

Details:

When you specify multiple options which must all apply (AND-logic) then for
-maxdepth n and -mindepth n, find lately displays a warning, explaining that
there are fine points of the order of operations at work -- as if find is
using a special form of logic which is something less than boolean.  This
warning makes no sense at all.  For a file to be 'found', ALL of the
conditions have to apply.  Why would anyone care which one fails first? 
Specifying multiple AND-conditions for find is the most common use case, and
for this use case, without a single OR-condition, the warning is most rudely
displayed.  Other GNU utilities allow arguments (additional conditions) to be
added at the end of the command line, but find has this feature / regression
by which it does not do so.

It seems that `find' is trying to warn the uer about the global nature of
-maxdepth and -mindepth -- but this warning is entirely unnecessary when the
entire find command consists of AND-conditions.  All conditions must apply, so
none of them apply first.  

This spurious warning is a good and proper bug, as evidenced by the slew of
bug reports in all sorts of projects since 2006 

To reproduce this bug:

  find -type f -maxdepth 1 -mindepth 1

Expected behaviour:

  print a list of files in the current directory, without spurious warnings.


Incorrect behaviour:

Spurious warnings are printed.

find: warning: you have specified the -mindepth option after a non-option
argument -type, but options are not positional (-mindepth affects tests
specified before it as well as those specified after it).  Please specify
options before other arguments.

find: warning: you have specified the -maxdepth option after a non-option
argument -type, but options are not positional (-maxdepth affects tests
specified before it as well as those specified after it).  Please specify
options before other arguments.


Proposed fix 1:

  Only display this warning when it may indicate a logic bug, e.g. OR-logic is
included.  (I can't improve this suggestion, since I don't understand
circumstances where one would benefit from this warning.)


Proposed fix 2:

  Remove this warning as per attached patch :P

(How about this: no warning is showed for "find -maxdepth 1  -print  -type d"
where "-type d" has no effect ... this is a real error ...  unless it was
"-type d $ACTION" where $ACTION is null ...)



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 10 Feb 2015 01:45:22 PM UTC  Name:
findutils.positional-warnings-considered-harmful.diff  Size: 1kB   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=33046>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]