bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] ls: print "?", not "0" as inode of dereferenced dangling sym


From: Pádraig Brady
Subject: Re: [PATCH] ls: print "?", not "0" as inode of dereferenced dangling symlink
Date: Mon, 28 Sep 2009 22:20:30 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Jim Meyering wrote:
> Here's another corner-case fix.
> I'll push something like this as soon as I've updated NEWS
> and added a test.
> 
>>From 26a1306a0a9028eceed388dad0d8916aeeb00233 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Mon, 28 Sep 2009 20:24:41 +0200
> Subject: [PATCH] ls: print "?", not "0" as inode of dereferenced dangling 
> symlink
> 
> ls prints inode numbers two ways: for long (-l) listings,
> and for short ones, e.g., ls -li and ls -i.  The code to print
> long listings properly printed "?" when the inode was unknown,
> but the code for handling short listings would print 0 instead.
> Factor out the formatting code into a new function so ls prints
> the right string ("?") from both places

looks good.

For my reference I notice the documented `find` behavior is to
fall back to reporting on the dangling symlinks themselves:

$ ls -RLli t/
t/:
ls: cannot access t/bad.link: No such file or directory
total 0
    ? l????????? ? ?       ?       ?                ? bad.link
88141 -rw-rw-r-- 1 padraig padraig 0 2009-09-28 22:10 t
88141 -rw-rw-r-- 1 padraig padraig 0 2009-09-28 22:10 t.link

$ find -L t/ -ls
 84691    4 drwxrwxr-x   2 padraig  padraig      4096 Sep 28 22:13 t/
 88141    0 -rw-rw-r--   1 padraig  padraig         0 Sep 28 22:10 t/t
 88141    0 -rw-rw-r--   1 padraig  padraig         0 Sep 28 22:10 t/t.link
134826    0 lrwxrwxrwx   1 padraig  padraig         4 Sep 28 22:04 t/bad.link 
-> blah





reply via email to

[Prev in Thread] Current Thread [Next in Thread]