bug-findutils
[Top][All Lists]
Advanced

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

[bug #61501] find -execdir wrong root item path


From: Bernhard Voelker
Subject: [bug #61501] find -execdir wrong root item path
Date: Wed, 17 Nov 2021 18:12:23 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0

Update of bug #61501 (project findutils):

                  Status:                    None => Need Info              
             Assigned to:                    None => berny                  

    _______________________________________________________

Follow-up Comment #1:

Thanks for the report, but what is exactly wrong with those entries?

For a better comparison, here's the complete reproducer.
The 'find' command line prints out 4 lines per item:
1. the full argument (%p),
2. the working directory for -execdir,
3. the replacement value for the argument '{}' for -execdir, and
4. the replacement value for the argument '{}' for -exec.


$ mkdir /foo && cd /foo && touch apple banana

$ find . -printf '1:%p\n'  -execdir pwd ';' -execdir printf '2:%s\n' '{}' ';'
-exec printf '3:%s\n\n' '{}' ';'
1:.
/foo
2:./.
3:.

1:./banana
/foo
2:./banana
3:./banana

1:./apple
/foo
2:./apple
3:./apple

$ find /foo -printf '1:%p\n'  -execdir pwd ';' -execdir printf '2:%s\n' '{}'
';' -exec printf '3:%s\n\n' '{}' ';'
1:/foo
/
2:./foo
3:/foo

1:/foo/banana
/foo
2:./banana
3:/foo/banana

1:/foo/apple
/foo
2:./apple
3:/foo/apple


In the first find(1) invocation, it's maybe debatable whether '.' or './.'
is better, still both are correct and properly resolve to the current
directory.

The second find(1) invocation shows that the output of './foo' is also
correct,
as the working directory is '/'.

Would you please explain what is the problem with that behavior?

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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