Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 17:00:25 GMT
From:      TANAKA Hiroyuki <kattyo@abk.nu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/102394: ls(1) do not shows inode number symbolic link itself with -P option
Message-ID:  <200608221700.k7MH0PlI076603@www.freebsd.org>
Resent-Message-ID: <200608221710.k7MHAFkk090757@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help


>Number:         102394
>Category:       bin
>Synopsis:       ls(1) do not shows inode number symbolic link itself with -P option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 22 17:10:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     TANAKA Hiroyuki
>Release:        6.1-STABLE
>Organization:
>Environment:
FreeBSD localhost.localdomain 6.1-STABLE FreeBSD 6.1-STABLE #2: Thu May 11 11:09:42 JST 2006     root@localhost.localdomain:/usr/obj/usr/src/sys/mykernel  amd64
>Description:
ls(1) command shows inode number about symblic link references when used with -P option.

In manpage, the -P option shows symbolic link itself instead of it pointed to.
But now ls(1) shows inode number which resolved symbolic link references.
If manpage is correct, please fix this.


following command line option settings is 
conflicted by default when used with only -P option:
>                case 'P':
>                        fts_options &= ~FTS_COMFOLLOW;
>                        fts_options &= ~FTS_LOGICAL;
>                        fts_options |= FTS_PHYSICAL;
>                        break;
..
>        /*
>         * If not -F, -d or -l options, follow any symbolic links listed on
>         * the command line.
>         */
>        if (!f_longform && !f_listdir && !f_type)
>                fts_options |= FTS_COMFOLLOW;
 
>How-To-Repeat:
kattyo@ bin $ \ls -iF /usr/sbin/mailwrapper
1578123 /usr/sbin/mailwrapper*
kattyo@ bin $ \ls -il mailq
1201534 lrwxr-xr-x  1 root  wheel  21 May 11 11:29 mailq -> /usr/sbin/mailwrapper
kattyo@ bin $ \ls -iL mailq
1578123 mailq
kattyo@ bin $ \ls -iH mailq
1578123 mailq
kattyo@ bin $ \ls -iP mailq
1578123 mailq
kattyo@ bin $ \ls -ih mailq
1578123 mailq
kattyo@ bin $ \ls -id mailq
1201534 mailq

>Fix:
This is not tested.

src/bin/ls/ls.c:
 		case 'P':
 			fts_options &= ~FTS_COMFOLLOW;
 			fts_options &= ~FTS_LOGICAL;
 			fts_options |= FTS_PHYSICAL;
+			f_listdir = 1;
 			break;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608221700.k7MH0PlI076603>