Subject: bug#9817: closed (Re: bug#9817: 24.0.90; tar-mode: wrong display of suid and sgid bits)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 21 Oct 2011 06:46:03 +0000

Your bug report

#9817: 24.0.90; tar-mode: wrong display of suid and sgid bits

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
9817: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9817
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#9817: 24.0.90; tar-mode: wrong display of suid and sgid bits
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Fri, 21 Oct 2011 02:44:36 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.0.91

Thanks; applied.

Subject: 24.0.90; tar-mode: wrong display of suid and sgid bits
From: Ulrich Mueller <[email-masked]>
To: [email-masked]
Date: Fri, 21 Oct 2011 00:37:18 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

In the display of file modes in tar-mode's listing, the suid and sgid
bits are interchanged.

The following session illustrates the problem:

$ touch foo bar
$ chmod u+s foo
$ chmod g+s bar
$ ls -fl foo bar
-rwSr--r-- 1 ulm users 0 Oct 20 23:22 foo
-rw-r-Sr-- 1 ulm users 0 Oct 20 23:22 bar
$ tar cf foo.tar foo bar
$ tar tvf foo.tar
-rwSr--r-- ulm/users         0 2011-10-20 23:22 foo
-rw-r-Sr-- ulm/users         0 2011-10-20 23:22 bar
$ emacs -Q foo.tar

Now, in tar-mode's listing the two flags are interchanged:

 -rw-r-sr--     ulm/users         0 foo
 -rwsr--r--     ulm/users         0 bar

Also, they should be displayed with a capital letter S if the
corresponding executable bit is not set, and the sticky bit should
be shown, too. The patch included below fixes the problem for me.

2011-10-20  Ulrich Mueller  <[email-masked]>

	* tar-mode.el (tar-grind-file-mode): Display suid and sgid flags
	correctly.

@@ -404,13 +404,19 @@
   (string
    (if (zerop (logand 256 mode)) ?- ?r)
    (if (zerop (logand 128 mode)) ?- ?w)
-   (if (zerop (logand 1024 mode)) (if (zerop (logand  64 mode)) ?- ?x) ?s)
+   (if (zerop (logand 2048 mode))
+       (if (zerop (logand  64 mode)) ?- ?x)
+     (if (zerop (logand  64 mode)) ?S ?s))
    (if (zerop (logand  32 mode)) ?- ?r)
    (if (zerop (logand  16 mode)) ?- ?w)
-   (if (zerop (logand 2048 mode)) (if (zerop (logand   8 mode)) ?- ?x) ?s)
+   (if (zerop (logand 1024 mode))
+       (if (zerop (logand   8 mode)) ?- ?x)
+     (if (zerop (logand   8 mode)) ?S ?s))
    (if (zerop (logand   4 mode)) ?- ?r)
    (if (zerop (logand   2 mode)) ?- ?w)
-   (if (zerop (logand   1 mode)) ?- ?x)))
+   (if (zerop (logand 512 mode))
+       (if (zerop (logand   1 mode)) ?- ?x)
+     (if (zerop (logand   1 mode)) ?T ?t))))
 
 (defun tar-header-block-summarize (tar-hblock &optional mod-p)
   "Return a line similar to the output of `tar -vtf'."