Re: [PATCH 0/7] pull: whereis changes

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

 



On Sat, Mar 16, 2013 at 11:40 PM, Sami Kerola <kerolasa@xxxxxx> wrote:
> Here are the results of the whereis(1) work which I mentioned earlier the
> week in irc.  All of the patches are related to that command, and as you
> can see from the diff stats a lot has changed.
>
> The first patch is quite big.  Unfortunately I ran out of imagination how
> to make it smaller, as the patch is the core change enabling rest of the
> work.  Most what the 0001 has got going is with search directory list
> building using new data structure.
>
> In between patches are quite straight forward till second last which will
> canonicalize output file names.  I think that is what users are
> interested, but I a may be wrong as well.  Comments, anyone?
>
> The last patch is a bug fix to RedHat item.  See commit message for
> further details.
>
> One funky side note.  After the changes the whereis seems to run about
> 20% quicker.  That was unintentional enhancement.

Hi,

Is this regression, or a command behavior change resulting to correct
output when not patched? I think earlier whereis misbehaved. Reason
being is that shell 'which' or path completion does not recognize
broken symlink.

$ cd ~/bin
$ ln -s bar foo
$ whereis foo
foo: /home/kerolasa/bin/foo
$ cd ~/src/util-linux
$ ./whereis foo
# no results
$ git diff
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index 0e333e1..30a6819 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -179,7 +179,8 @@ static int is_same_file(char *file, struct is_here
*filelist)
        struct is_here *prev = NULL;

        if (stat(file, &statbuf))
-               return 1;
+               if (lstat(file, &statbuf))
+                       return 1;
        while (filelist) {
                if (filelist->st_ino == statbuf.st_ino &&
                    filelist->st_dev == statbuf.st_dev)
$ make
# <...>
./whereis foo
foo: /home/kerolasa/bin/foo

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux