URL: <http://savannah.gnu.org/bugs/?44732>
Summary: -user flag gives different output with -exec ls and -ls Project: findutils Submitted by: aravindvjn Submitted on: Sun 05 Apr 2015 09:59:28 AM GMT Category: find Severity: 3 - Normal Item Group: Wrong result Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Discussion Lock: Any Release: None Fixed Release: None _______________________________________________________ Details: Hi, Thanking you for a nice tool called find . I met with some confusion when i tried to use find, Please advice on this. Please find the list of files in find_test . [casper@localhost find_test]$ ls -lrt total 0 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test1 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test2 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test3 -rw-r--r-- 1 root root 0 Mar 27 18:35 root_test1 -rw-r--r-- 1 root root 0 Mar 27 18:35 root_test2 [casper@localhost find_test]$ when i tried to execute the command, "find $PWD -not -user root -exec ls -l {} \;" It gave me an output as, [casper@localhost find_test]$ find $PWD -not -user root -exec ls -l {} \; total 0 -rw-r--r-- 1 root root 0 Mar 27 18:35 root_test1 -rw-r--r-- 1 root root 0 Mar 27 18:35 root_test2 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test1 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test2 -rw-r--r-- 1 casper users 0 Mar 27 18:34 test3 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test2 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test1 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test3 which is not accurate , as i am expecting files that are not owned by root only. but with the command, "find $PWD -not -user root -ls" find gave me an output as, [casper@localhost find_test]$ find $PWD -not -user root -ls 9182333 4 drwxr-xr-x 2 casper users 4096 Mar 27 18:35 /home/casper/find_test 8921411 0 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test2 8918596 0 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test1 8921412 0 -rw-r--r-- 1 casper users 0 Mar 27 18:34 /home/casper/find_test/test3 which looks good. and my find version, [casper@localhost find_test]$ find --version find (GNU findutils) 4.4.2 about os, [casper@localhost find_test]$ uname -a Linux localhost 3.15.0-rc4-ARCH-00298-g9f1eb57 #1 SMP PREEMPT Fri May 23 01:56:57 IST 2014 x86_64 GNU/Linux _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?44732> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/