From owner-svn-src-all@FreeBSD.ORG Mon Feb 8 15:42:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B7431065672; Mon, 8 Feb 2010 15:42:56 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22A878FC22; Mon, 8 Feb 2010 15:42:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o18Fgusq085223; Mon, 8 Feb 2010 15:42:56 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o18FguQs085221; Mon, 8 Feb 2010 15:42:56 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002081542.o18FguQs085221@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 8 Feb 2010 15:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203665 - head/bin/ls X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2010 15:42:56 -0000 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; /*