From jaakko@saunalahti.fi  Tue Feb 10 18:08:20 2009
Return-Path: <jaakko@saunalahti.fi>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79E80106568E
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 2009 18:08:20 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from gw01.mail.saunalahti.fi (gw01.mail.saunalahti.fi [195.197.172.115])
	by mx1.freebsd.org (Postfix) with ESMTP id 36DC78FC23
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 2009 18:08:20 +0000 (UTC)
	(envelope-from jaakko@saunalahti.fi)
Received: from ws64.jh.dy.fi (a91-153-125-115.elisa-laajakaista.fi [91.153.125.115])
	by gw01.mail.saunalahti.fi (Postfix) with ESMTP id 6243415197A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 2009 20:08:18 +0200 (EET)
Received: from ws64.jh.dy.fi (localhost [127.0.0.1])
	by ws64.jh.dy.fi (8.14.3/8.14.3) with ESMTP id n1AI8ImN005867
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Feb 2009 20:08:18 +0200 (EET)
	(envelope-from jaakko@ws64.jh.dy.fi)
Received: (from jaakko@localhost)
	by ws64.jh.dy.fi (8.14.3/8.14.3/Submit) id n1AI8HPh005866;
	Tue, 10 Feb 2009 20:08:18 +0200 (EET)
	(envelope-from jaakko)
Message-Id: <200902101808.n1AI8HPh005866@ws64.jh.dy.fi>
Date: Tue, 10 Feb 2009 20:08:18 +0200 (EET)
From: Jaakko Heinonen <jh@saunalahti.fi>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] stat(1) -x doesn't print the file mode correctly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         131569
>Category:       bin
>Synopsis:       [patch] stat(1) -x doesn't print the file mode correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 10 18:10:01 UTC 2009
>Closed-Date:    Fri Feb 20 07:13:38 UTC 2009
>Last-Modified:  Fri Feb 20 07:13:38 UTC 2009
>Originator:     Jaakko Heinonen
>Release:        FreeBSD 7.1-STABLE / 8.0-CURRENT
>Organization:
>Environment:

	
>Description:

The octal representation of the file mode displayed with stat(1) -x option
ignores suid, sgid and sticky bits.

This was reported on -stable:
http://lists.freebsd.org/pipermail/freebsd-stable/2008-October/046195.html

>How-To-Repeat:

$ touch foo
$ chmod 4755 foo
$ stat -x foo | grep Mode
  Mode: (0755/-rwsr-xr-x)         Uid: ( 1000/  jaakko)  Gid: (    0/   wheel)

After applying the patch:

$ stat -x foo | grep Mode
  Mode: (4755/-rwsr-xr-x)         Uid: ( 1000/  jaakko)  Gid: (    0/   wheel)

>Fix:

--- stat--x-file-mode.diff begins here ---
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" \
--- stat--x-file-mode.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: maxim 
State-Changed-When: Wed Feb 11 10:51:47 UTC 2009 
State-Changed-Why:  
Fixed in HEAD.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131569 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131569: commit references a PR
Date: Wed, 11 Feb 2009 10:50:42 +0000 (UTC)

 Author: maxim
 Date: Wed Feb 11 10:50:26 2009
 New Revision: 188481
 URL: http://svn.freebsd.org/changeset/base/188481
 
 Log:
   o Print an octal representation of suid, sgid and sticky bits with -x flag.
   
   PR:		bin/131569
   Submitted by:	Jaakko Heinonen
   Reported by:	Yannick Cadin
   MFC after:	1 week
 
 Modified:
   head/usr.bin/stat/stat.c
 
 Modified: head/usr.bin/stat/stat.c
 ==============================================================================
 --- head/usr.bin/stat/stat.c	Wed Feb 11 10:29:45 2009	(r188480)
 +++ head/usr.bin/stat/stat.c	Wed Feb 11 10:50:26 2009	(r188481)
 @@ -108,7 +108,7 @@ __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" \
 _______________________________________________
 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: maxim 
State-Changed-When: Fri Feb 20 07:12:01 UTC 2009 
State-Changed-Why:  
Merged to RELENG_7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131569 
>Unformatted:
