bugfindutils - Bugs: bug #44732, -user flag gives different output...

 
 

bug #44732: -user flag gives different output with -exec ls and -ls

Submitter:  DAndC <aravindvjn>
Submitted:  Sun 05 Apr 2015 09:59:28 AM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Invalid
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  None Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 06 Apr 2015 06:55:20 PM UTC, comment #2: 



Thank you for the reply. You are correct, I got the expected output with "-type f " .

[casper@localhost find_test]$ find $PWD -type f -not -user root -exec ls -l {} \;
-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
[casper@localhost find_test]$

DAndC <aravindvjn>
Sun 05 Apr 2015 02:12:52 PM UTC, comment #1: 

Hello,

find does not only find files but also directories, therefore "find $PWD -not -user root -exec ls -l {} \;" inter alia runs this command

ls -l /home/casper/find_test

and will therefore list test1 and test2

cu Andreas

Andreas Metzler <ametzler>
Sun 05 Apr 2015 09:59:28 AM UTC, original submission:  

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

DAndC <aravindvjn>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by aravindvjn (Submitted the item)
  • -email is unavailable- added by aravindvjn
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-23 jay StatusNone Invalid
        Assigned toNone jay
        Open/ClosedOpen Closed
    2015-04-05 aravindvjn Carbon-Copy- Added aravindvjn

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code