From nobody@FreeBSD.org Tue Aug 22 17:00:34 2006 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 90D7816A500 for ; Tue, 22 Aug 2006 17:00:34 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED58C43D7E for ; Tue, 22 Aug 2006 17:00:27 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k7MH0PWs076613 for ; Tue, 22 Aug 2006 17:00:25 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k7MH0PlI076603; Tue, 22 Aug 2006 17:00:25 GMT (envelope-from nobody) Message-Id: <200608221700.k7MH0PlI076603@www.freebsd.org> Date: Tue, 22 Aug 2006 17:00:25 GMT From: TANAKA Hiroyuki To: freebsd-gnats-submit@FreeBSD.org Subject: ls(1) do not shows inode number symbolic link itself with -P option X-Send-Pr-Version: www-2.3 >Number: 102394 >Category: bin >Synopsis: [patch] ls(1) do not shows inode number symbolic link itself with -P option >Confidential: no >Severity: non-critical >Priority: low >Responsible: jh >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 22 17:10:15 GMT 2006 >Closed-Date: Sun Feb 28 14:18:31 UTC 2010 >Last-Modified: Sun Feb 28 14:18:31 UTC 2010 >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: From: Jaakko Heinonen To: bug-followup@FreeBSD.org, kattyo@abk.nu Cc: Subject: Re: bin/102394: [patch] ls(1) do not shows inode number symbolic link itself with -P option Date: Sat, 6 Feb 2010 18:08:48 +0200 Here's a possible fix for the problem: http://people.freebsd.org/~jh/patches/ls--P.diff The patch needs some review. -- Jaakko Responsible-Changed-From-To: freebsd-bugs->jh Responsible-Changed-By: jh Responsible-Changed-When: Sun Feb 7 09:31:04 UTC 2010 Responsible-Changed-Why: Take. http://www.freebsd.org/cgi/query-pr.cgi?pr=102394 From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: bin/102394: commit references a PR Date: Mon, 8 Feb 2010 15:43:04 +0000 (UTC) Author: jh Date: Mon Feb 8 15:42:55 2010 New Revision: 203665 URL: http://svn.freebsd.org/changeset/base/203665 Log: Make sure that FTS_COMFOLLOW is not set when the -P option is in effect. Otherwise the -i option will show the inode number of the referenced file for symbolic links given on the command line. Similarly, the file color was printed according to the link target in colorized output. PR: bin/102394 Reviewed by: jilles MFC after: 2 weeks Modified: head/bin/ls/ls.c Modified: head/bin/ls/ls.c ============================================================================== --- head/bin/ls/ls.c Mon Feb 8 15:39:48 2010 (r203664) +++ head/bin/ls/ls.c Mon Feb 8 15:42:55 2010 (r203665) @@ -113,6 +113,7 @@ static int f_listdir; /* list actual di static int f_listdot; /* list files beginning with . */ static int f_noautodot; /* do not automatically enable -A for root */ int f_longform; /* long listing format */ +static int f_nofollow; /* don't follow symbolic link arguments */ int f_nonprint; /* show unprintables as ? */ static int f_nosort; /* don't sort output */ int f_notabs; /* don't use tab-separated multi-col output */ @@ -234,6 +235,7 @@ main(int argc, char *argv[]) break; case 'H': fts_options |= FTS_COMFOLLOW; + f_nofollow = 0; break; case 'G': setenv("CLICOLOR", "", 1); @@ -241,11 +243,13 @@ main(int argc, char *argv[]) case 'L': fts_options &= ~FTS_PHYSICAL; fts_options |= FTS_LOGICAL; + f_nofollow = 0; break; case 'P': fts_options &= ~FTS_COMFOLLOW; fts_options &= ~FTS_LOGICAL; fts_options |= FTS_PHYSICAL; + f_nofollow = 1; break; case 'R': f_recursive = 1; @@ -396,10 +400,10 @@ main(int argc, char *argv[]) fts_options |= FTS_NOSTAT; /* - * If not -F, -d or -l options, follow any symbolic links listed on + * If not -F, -P, -d or -l options, follow any symbolic links listed on * the command line. */ - if (!f_longform && !f_listdir && (!f_type || f_slash)) + if (!f_nofollow && !f_longform && !f_listdir && (!f_type || f_slash)) fts_options |= FTS_COMFOLLOW; /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State-Changed-From-To: open->patched State-Changed-By: jh State-Changed-When: Mon Feb 8 15:55:41 UTC 2010 State-Changed-Why: Patched in head (r203665). http://www.freebsd.org/cgi/query-pr.cgi?pr=102394 From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: bin/102394: commit references a PR Date: Sun, 28 Feb 2010 14:04:33 +0000 (UTC) Author: jh Date: Sun Feb 28 14:04:20 2010 New Revision: 204448 URL: http://svn.freebsd.org/changeset/base/204448 Log: MFC r203665: Make sure that FTS_COMFOLLOW is not set when the -P option is in effect. Otherwise the -i option will show the inode number of the referenced file for symbolic links given on the command line. Similarly, the file color was printed according to the link target in colorized output. PR: bin/102394 Modified: stable/8/bin/ls/ls.c Directory Properties: stable/8/bin/ls/ (props changed) Modified: stable/8/bin/ls/ls.c ============================================================================== --- stable/8/bin/ls/ls.c Sun Feb 28 13:31:29 2010 (r204447) +++ stable/8/bin/ls/ls.c Sun Feb 28 14:04:20 2010 (r204448) @@ -113,6 +113,7 @@ static int f_listdir; /* list actual di static int f_listdot; /* list files beginning with . */ static int f_noautodot; /* do not automatically enable -A for root */ int f_longform; /* long listing format */ +static int f_nofollow; /* don't follow symbolic link arguments */ int f_nonprint; /* show unprintables as ? */ static int f_nosort; /* don't sort output */ int f_notabs; /* don't use tab-separated multi-col output */ @@ -234,6 +235,7 @@ main(int argc, char *argv[]) break; case 'H': fts_options |= FTS_COMFOLLOW; + f_nofollow = 0; break; case 'G': setenv("CLICOLOR", "", 1); @@ -241,11 +243,13 @@ main(int argc, char *argv[]) case 'L': fts_options &= ~FTS_PHYSICAL; fts_options |= FTS_LOGICAL; + f_nofollow = 0; break; case 'P': fts_options &= ~FTS_COMFOLLOW; fts_options &= ~FTS_LOGICAL; fts_options |= FTS_PHYSICAL; + f_nofollow = 1; break; case 'R': f_recursive = 1; @@ -396,10 +400,10 @@ main(int argc, char *argv[]) fts_options |= FTS_NOSTAT; /* - * If not -F, -d or -l options, follow any symbolic links listed on + * If not -F, -P, -d or -l options, follow any symbolic links listed on * the command line. */ - if (!f_longform && !f_listdir && !f_type) + if (!f_nofollow && !f_longform && !f_listdir && !f_type) fts_options |= FTS_COMFOLLOW; /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" State-Changed-From-To: patched->closed State-Changed-By: jh State-Changed-When: Sun Feb 28 14:18:30 UTC 2010 State-Changed-Why: Fixed in head and stable/8. http://www.freebsd.org/cgi/query-pr.cgi?pr=102394 >Unformatted: