Subject: misc/15125: The manpage of file(1) presents linuxisms
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Weber <Ephaeton@gmx.net>
List: netbsd-bugs
Date: 01/03/2002 17:58:12
>Number:         15125
>Category:       misc
>Synopsis:       The manpage of file(1) uses linux style devices as example
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 03 08:59:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Martin Weber
>Release:        NetBSD 1.5ZA
>Organization:
Entropie Erlangen
	
>Environment:
	
	
System: NetBSD phaeton.entropie.net 1.5ZA NetBSD 1.5ZA (PHAETON) #1: Sun Dec 23 00:55:12 CET 2001 root@phaeton.entropie.net:/usr/src/sys/arch/i386/compile/PHAETON i386
Architecture: i386
Machine: i386
>Description:
	The manpage of file(1) uses linux-style device names as example in
	the EXAMPLE section. Look at the following quote from the manpage:
--------------------------------------
EXAMPLES
       $ file file.c file /dev/hda
       file.c:   C program text
       file:     ELF 32-bit LSB executable, Intel 80386, version 1,
                 dynamically linked, not stripped
       /dev/hda: block special

       $ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
       /dev/hda:   x86 boot sector
       /dev/hda1:  Linux/i386 ext2 filesystem
       /dev/hda2:  x86 boot sector
       /dev/hda3:  x86 boot sector, extended partition table
       /dev/hda4:  Linux/i386 ext2 filesystem
       /dev/hda5:  Linux/i386 swap file
       /dev/hda6:  Linux/i386 swap file
       /dev/hda7:  Linux/i386 swap file
       /dev/hda8:  Linux/i386 swap file
       /dev/hda9:  empty
       /dev/hda10: empty

       $ file -i file.c file /dev/hda
       file.c:      text/x-c
       file:        application/x-executable, dynamically linked (uses shared libs), not stripped
       /dev/hda:    application/x-not-regular-file
--------------------------------------
	Although file derives from GNU I think it's worth fixing to use
	NetBSD style device naming especially as it comes in the base system :)

	Additionally file does not seem to recognize NetBSD partitions, or only
	recognizes them as 'data', look at this:
---------------------------------------
# disklabel wd0
[...]
8 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 a:   2048000        63     4.2BSD   1024  8192    16   # (Cyl.    0*- 2031*)
 b:   2048000   2048000       swap                      # (Cyl. 2031*- 4063*)
 c:  19807137        63     unused      0     0         # (Cyl.    0*- 19649)
 d:  19807200         0     unused      0     0         # (Cyl.    0 - 19649)
 e:  15711200   4096000     4.2BSD   1024  8192    16   # (Cyl. 4063*- 19649)
 h:  19807137        63     unused      0     0         # (Cyl.    0*- 19649)
# file -s /dev/wd0{a,b,c,d,e,h}
/dev/wd0a: can't read `/dev/wd0a' (Device busy).
/dev/wd0b: data
/dev/wd0c: can't read `/dev/wd0c' (Device not configured).
/dev/wd0d: x86 boot sector
/dev/wd0e: can't read `/dev/wd0e' (Device busy).
/dev/wd0h: can't read `/dev/wd0h' (Device not configured).
#
---------------------------------------

>How-To-Repeat:
	man file, scroll down to the examples section.
	
>Fix:
	Actually I think best to fix it would be the fitting entries
	in /usr/share/misc/magic to recognize the (Net?)BSD partitions,
	and report them adequately. Then replace the fdisk -i /dev/hda{,1,2,3,4,5,6,7,8,9,10}
	with fdisk -i /dev/wd0{a,b,c,...}. There are two other places in which
	linux style device naming is used, apply the following patch to burn 'em out:
---------------------------------------
--- /usr/src/usr.bin/file/file.1        Sun Dec  2 23:47:24 2001
+++ file.1      Thu Jan  3 17:55:54 2002
@@ -306,29 +306,16 @@
 .IR /usr/share/misc/magic.orig ).
 .SH EXAMPLES
 .nf
-$ file file.c file /dev/hda
-file.c:   C program text
-file:     ELF 32-bit LSB executable, Intel 80386, version 1,
-          dynamically linked, not stripped
-/dev/hda: block special
+$ file file.c file /dev/wd0a
+file.c:    C program text
+file:      ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
+           dynamically linked (uses shared libs), stripped
+/dev/wd0a: block special (0/0)
 
-$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}
-/dev/hda:   x86 boot sector
-/dev/hda1:  Linux/i386 ext2 filesystem
-/dev/hda2:  x86 boot sector
-/dev/hda3:  x86 boot sector, extended partition table
-/dev/hda4:  Linux/i386 ext2 filesystem
-/dev/hda5:  Linux/i386 swap file
-/dev/hda6:  Linux/i386 swap file
-/dev/hda7:  Linux/i386 swap file
-/dev/hda8:  Linux/i386 swap file
-/dev/hda9:  empty
-/dev/hda10: empty
-
-$ file -i file.c file /dev/hda
+$ file -i file.c file /dev/wd0a
 file.c:      text/x-c
 file:        application/x-executable, dynamically linked (uses shared libs), not stripped
-/dev/hda:    application/x-not-regular-file
+/dev/wd0a:   application/x-not-regular-file
 
 .fi
 .SH HISTORY
---------------------------------------
	Sadly enough I cannot provide the fitting entries for the magicfile,
	as I don't know how BSD partitions mark themselves.
>Release-Note:
>Audit-Trail:
>Unformatted: