2 (very old) bugs?

Jaakko Heinonen jh at saunalahti.fi
Sat Jan 10 05:41:11 PST 2009


Hi,

On 2009-01-09, Doug Barton wrote:
> Yannick Cadin wrote:
> > - first in the stat command. Only with the -x option. If you execute
> > stat -x on /tmp or /usr/bin/passwd parameters for example, the numeric
> > representation of mode is wrong. The "special" bits are always 0. No
> > suid-bit, no sticky bit!
> 
> Our version of stat(1) is essentially an exact duplicate of the code
> from NetBSD. I imported this originally, but I have not not had time
> to merge changes for a while now. If anyone is interested in taking
> this on have a look at:
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/stat/

The reported bug still exists in the NetBSD version too. I believe that
the following patch fixes the bug:

%%%
Index: usr.bin/stat/stat.c
===================================================================
--- usr.bin/stat/stat.c	(revision 186786)
+++ usr.bin/stat/stat.c	(working copy)
@@ -108,7 +108,8 @@ __FBSDID("$FreeBSD$");
 #define LINUX_FORMAT \
 	"  File: \"%N\"%n" \
 	"  Size: %-11z  FileType: %HT%n" \
-	"  Mode: (%04OLp/%.10Sp)         Uid: (%5u/%8Su)  Gid: (%5g/%8Sg)%n" \
+	"  Mode: (%OMp%03OLp/%.10Sp)         " \
+	"Uid: (%5u/%8Su)  Gid: (%5g/%8Sg)%n" \
 	"Device: %Hd,%Ld   Inode: %i    Links: %l%n" \
 	"Access: %Sa%n" \
 	"Modify: %Sm%n" \
%%%

-- 
Jaakko


More information about the freebsd-stable mailing list