8 Replies Latest reply: Aug 30, 2012 4:30 AM by Bulls123 RSS

    Find command make me crazy

    Bulls123
      Hi Folks,

      Find command make me crazy

      Solaris 9
      Kernel patch 118558-34

      1) 2 Find command /usr/bin/find and /usr/local/bin/find

      # ls -lh /usr/bin/find
      -r-xr-xr-x 1 root bin 20K Apr 6 2002 /usr/bin/find

      # ls -lh /usr/local/bin/find
      -rwxr-xr-x 1 root bin 328K Jun 21 2002 /usr/local/bin/find

      What is the actual different b/w these two find commands


      2) For non root account users use /usr/local/bin/find command (by default) and give the following error when I try to remove the file with find command.

      /usr/local/bin/find . -mtime +1 -exec ls -lh {} \;

      Value too large for defined data type
      Value too large for defined data type
      Value too large for defined data type
      Value too large for defined data type
      Value too large for defined data type

      If I use, /usr/bin/find . -mtime +1 -exec ls -lh {} \; --> this works

      if I just just find command it shows permission denied

      $ /usr/bin/find . -print
      /usr/bin/find: cannot open .: Permission denied

      The complete directory path has enough permission.
        • 1. Re: Find command make me crazy
          bobthesungeek76036
          1) /usr/local/bin/find (and anything else within /usr/local) was not installed by the Solaris installer. You would need to go find the admin that installed it and find out what flavor of "find" it is. /usr/bin/find <b>is</b> the Solaris "find".

          2) It would be nice to see the output of:

          <pre>ls -ld .
          getfacl .</pre>

          for the directory you are trying to run your find against. And whether it is on a local disk or an NFS share.
          • 2. Re: Find command make me crazy
            Bulls123
            Hi

            Please find the permission details below.

            $ pwd
            /u01/oraback/INFO

            $ id -a
            uid=40004(oracle) gid=4002(dba) groups=4002(dba),101(wheel)

            $ ls -ld /u01/oraback/INFO
            drwxr-x--- 2 oracle dba 8192 Aug 23 22:37 /u01/oraback/INFO

            $ ls -ld /u01/oraback
            drwxr-x--- 26 oracle dba 1024 Aug 20 08:23 /u01/oraback

            $ ls -ld /u01
            drwxr-xr-x 6 oracle dba 96 Nov 30 2007 /u01

            $ getfacl .

            # file: .
            # owner: oracle
            # group: dba
            user::rwx
            group::r-x #effective:r-x
            mask:r-x
            other:---


            pwd

            /u01/oraback/INFO

            /usr/bin/find . -print
            /usr/bin/find: cannot open .: Permission denied ----> Gives me an error

            but, if I do it in /tmp, same command works fine :(
            • 3. Re: Find command make me crazy
              bobthesungeek76036
              Very strange...

              Run "truss /usr/bin/find . -print" and post the output please
              • 4. Re: Find command make me crazy
                Bulls123
                $ truss /usr/bin/find . -print
                execve("/usr/bin/find", 0xFFBFFA9C, 0xFFBFFAAC) argc = 3
                resolvepath("/usr/lib/ld.so.1", "/usr/lib/ld.so.1", 1023) = 16
                resolvepath("/usr/bin/find", "/usr/bin/find", 1023) = 13
                stat("/usr/bin/find", 0xFFBFF870) = 0
                open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
                stat("/usr/lib/libc.so.1", 0xFFBFF378) = 0
                resolvepath("/usr/lib/libc.so.1", "/usr/lib/libc.so.1", 1023) = 18
                open("/usr/lib/libc.so.1", O_RDONLY) = 3
                mmap(0x00010000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 3, 0) = 0xFF3A0000
                mmap(0x00010000, 802816, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF280000
                mmap(0xFF280000, 702900, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF280000
                mmap(0xFF33C000, 24688, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 704512) = 0xFF33C000
                munmap(0xFF32C000, 65536) = 0
                memcntl(0xFF280000, 117444, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
                close(3) = 0
                stat("/usr/lib/libdl.so.1", 0xFFBFF378) = 0
                resolvepath("/usr/lib/libdl.so.1", "/usr/lib/libdl.so.1", 1023) = 19
                open("/usr/lib/libdl.so.1", O_RDONLY) = 3
                mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                mmap(0x00002000, 8192, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFF3FA000
                mmap(0xFF3FA000, 1894, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3FA000
                close(3) = 0
                stat("/usr/platform/SUNW,Sun-Fire-V490/lib/libc_psr.so.1", 0xFFBFF088) = 0
                resolvepath("/usr/platform/SUNW,Sun-Fire-V490/lib/libc_psr.so.1", "/usr/platform/sun4u-us3/lib/libc_psr.so.1", 1023) = 41
                open("/usr/platform/SUNW,Sun-Fire-V490/lib/libc_psr.so.1", O_RDONLY) = 3
                mmap(0xFF3A0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xFF3A0000
                close(3) = 0
                mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xFF390000
                getustack(0xFFBFF6B4)
                getrlimit(RLIMIT_STACK, 0xFFBFF6AC) = 0
                getcontext(0xFFBFF4E8)
                setustack(0xFF343A74)
                brk(0x000261C0) = 0
                brk(0x000281C0) = 0
                time() = 1346071131
                open(".", O_RDONLY|O_LARGEFILE) = 3
                fstat64(3, 0xFFBFEF48) = 0
                close(3) = 0
                open("./..", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3
                fstat64(3, 0xFFBFEF48) = 0
                getdents64(3, 0xFFBFC4F8, 8192) = 824
                close(3) = 0
                open("./../..", O_RDONLY|O_NDELAY|O_LARGEFILE) = 3
                fstat64(3, 0xFFBFEF48) = 0
                getdents64(3, 0xFFBFC4F8, 8192) = 176
                close(3) = 0
                open("./../../..", O_RDONLY|O_NDELAY|O_LARGEFILE) Err#13 EACCES
                fstat64(2, 0xFFBFEAE8) = 0
                /usr/bin/findwrite(2, " / u s r / b i n / f i n".., 13) = 13
                : cannot open write(2, " : c a n n o t o p e".., 14) = 14
                .: write(2, " . : ", 3) = 3
                Permission deniedwrite(2, " P e r m i s s i o n d".., 17) = 17

                write(2, "\n", 1) = 1
                _exit(1)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                • 5. Re: Find command make me crazy
                  bobthesungeek76036
                  Run this from /u01/oraback/INFO:

                  ls -lad ./../../..

                  It is possible that your mountpoint /u01 has incorrect permissions. You will not see that unless you umount /u01 and look at the permissions of the directory /u01 before the disk is mounted...
                  • 6. Re: Find command make me crazy
                    Bulls123
                    $ ls -lad ./../../..
                    ls: ./../../..: Permission denied

                    $ cd ./../../..
                    $ pwd
                    /

                    $ ls -lad ./../../
                    drwxr-xr-x 6 oracle dba 96 Nov 30 2007 ./../../
                    $ cd ./../../
                    $ pwd
                    /u01

                    It's really strange as this issue just started very recently, the uptime shows more than 400 days. :( and production its, I can't afford to try umount /u01
                    • 7. Re: Find command make me crazy
                      bobthesungeek76036
                      log on as root and cd to /u01/oraback/INFO and see what:

                      <pre>ls -lad ./../../..</pre>

                      shows. I bet it's different than:

                      <pre>ls -lad /</pre>

                      which would indicate an issue with the mountpoint directory.
                      • 8. Re: Find command make me crazy
                        Bulls123
                        No differnce :(

                        # ls -lad ./../../..
                        drwxr-xr-x 23 root root 1024 Mar 19 2004 ./../../..
                        # ls -ld /
                        drwxr-xr-x 23 root root 1024 Mar 19 2004 /

                        well, this may be a bug. and I can't afford to unmount the filesystem and try as it's a production server.