Date: Mon, 09 Nov 1998 01:05:29 +0900 From: horikawa@jp.freebsd.org To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: docs/8602: symlink(7) manpage says that file(1) has -h option. Message-ID: <19981109010529T.k-horik@yk.rim.or.jp>
next in thread | raw e-mail | index | archive | help
>Number: 8602 >Category: docs >Synopsis: symlink(7) manpage says that file(1) has -h option. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 8 08:10:01 PST 1998 >Last-Modified: >Originator: Kazuo Horikawa >Organization: jpman project, Japan FreeBSD users group. >Release: FreeBSD 2.2.7-RELEASE i386 >Environment: 2.2.7-RELEASE >Description: The symlink(7) manpage describes symbolic link handling of file(1) command. But it is not correct. 1) file(1) command does not have -h option, while symlink(7) manpage says that file(1) has -h options. 2) file(1) command does not follow symbolic links named as command line arguments by default, while symlink(7) manpage says that ``Except as noted below, commands follow symbolic links named as command line arguments.'' 3) file(1) command does follow sumbolic links named as command line arguments if -L option is specified. ``man 7 symlink'' says: [snip] Commands not traversing a file tree. The second area is symbolic links, specified as command line file name arguments, to commands which are not traversing a file tree. Except as noted below, commands follow symbolic links named as command line arguments. For example, if there were a symbolic link ``slink'' which pointed to a file named ``afile'', the command ``cat slink'' would display the contents of the file ``afile''. It is important to realize that this rule includes commands which may op- tionally traverse file trees, e.g. the command ``chown file'' is included in this rule, while the command ``chown -R file'' is not. (The latter is described in the third area, below.) If it is explicitly intended that the command operate on the symbolic link instead of following the symbolic link, e.g., it is desired that ``file slink'' display the type of file that ``slink'' is, whether it is a symbolic link or not, the -h option should be used. In the above exam- ple, ``file slink'' would report the type of the file referenced by ``slink'', while ``file -h slink'' would report that ``slink'' was a sym- bolic link. [snip] I think that file(1) command is also exception like mv(1), rm(1) and ls(1), because file(1) command does not follow symbolic links by default. >How-To-Repeat: % /usr/bin/file -h /tmp/z file: illegal option -- h Usage: file [-vczL] [-f namefile] [-m magicfiles] file... % /usr/bin/file /tmp/z /tmp/z: symbolic link to /tmp/a % /usr/bin/file -L /tmp/z /tmp/z: ASCII text >Fix: Apply following patch for src/bin/ln/symlink.7, or adopt file(1) command which has -h option and follows symbolic links by default (like file(1) command in BSD 4.4 Lite). --- symlink.7.bak Mon Nov 9 00:12:52 1998 +++ symlink.7 Mon Nov 9 00:47:07 1998 @@ -160,25 +160,7 @@ is not. (The latter is described in the third area, below.) .Pp -If it is explicitly intended that the command operate on the symbolic -link instead of following the symbolic link, e.g., it is desired that -.Dq Li "file slink" -display the type of file that -.Dq Li slink -is, whether it is a symbolic link or not, the -.Fl h -option should be used. -In the above example, -.Dq Li "file slink" -would report the type of the file referenced by -.Dq Li slink , -while -.Dq Li "file -h slink" -would report that -.Dq Li slink -was a symbolic link. -.Pp -There are three exceptions to this rule. +There are four exceptions to this rule. The .Xr mv 1 and @@ -219,12 +201,23 @@ a file tree.) .Pp The +.Xr file 1 +command is also an exception to this rule. +The +.Xr file 1 +command does not follow symbolic links named as argument by default. +The +.Xr file 1 +command does follow symbolic links named as argument if +.Fl L +option is specified. +.Pp +The .Bx 4.4 system differs from historical 4BSD systems in that the -.Nm chown , -.Nm chgrp +.Nm chown and -.Nm file +.Nm chgrp commands follow symbolic links specified on the command line. .Ss Commands traversing a file tree. The following commands either optionally or always traverse file trees: @@ -302,11 +295,6 @@ .Dq Li "chown -HR user slink" will traverse the file hierarchy rooted in the file pointed to by .Dq Li slink . -Note, the -.Fl H -is not the same as the previously discussed -.Fl h -flag. The .Fl H flag causes symbolic links specified on the command line to be >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981109010529T.k-horik>