Description of problem: stat always returns an exit status of 0 Version-Release number of selected component (if applicable): coreutils-5.2.1-31.6 How reproducible: every time Steps to Reproduce: 1. Stat a non-existant file 2. echo $? Actual results: [root@rhel4 ~]# /usr/bin/stat /bin/bash File: `/bin/bash' Size: 616248 Blocks: 1216 IO Block: 4096 regular file Device: 802h/2050d Inode: 2490433 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2007-07-24 16:25:02.000000000 -0400 Modify: 2006-04-12 16:01:32.000000000 -0400 Change: 2007-07-23 14:47:24.000000000 -0400 [root@rhel4 ~]# echo $? 0 [root@rhel4 ~]# /usr/bin/stat /bin/noexist /usr/bin/stat: cannot stat `/bin/noexist': No such file or directory [root@rhel4 ~]# echo $? 0 Expected results: [root@rhel5 ~]# /usr/bin/stat /bin/bash File: `/bin/bash' Size: 722684 Blocks: 1432 IO Block: 4096 regular file Device: 901h/2305d Inode: 3365258 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2007-07-24 16:25:01.000000000 -0400 Modify: 2007-01-05 23:24:14.000000000 -0500 Change: 2007-05-07 08:21:27.000000000 -0400 [root@rhel5 ~]# echo $? 0 [root@rhel5 ~]# /usr/bin/stat /bin/noexist /usr/bin/stat: cannot stat `/bin/noexist': No such file or directory [root@rhel5 ~]# echo $? 1 Additional info:
Thanks for the report. FYI, that was fixed upstream in coreutils-5.90 (2005-09-29) [unstable]. From NEWS: stat now exits nonzero if a file operand does not exist
*** This bug has been marked as a duplicate of 231019 ***