From: Ulrich Mueller <ulm@gentoo.org>
To: 9817@debbugs.gnu.org
Subject: bug#9817: 24.0.90; tar-mode: wrong display of suid and sgid bits
Date: Fri, 21 Oct 2011 00:37:18 +0200 [thread overview]
Message-ID: <20128.41630.10577.712614@a1i15.kph.uni-mainz.de> (raw)
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 <ulm@gentoo.org>
* 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'."
next reply other threads:[~2011-10-20 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-20 22:37 Ulrich Mueller [this message]
2011-10-21 6:44 ` bug#9817: 24.0.90; tar-mode: wrong display of suid and sgid bits Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20128.41630.10577.712614@a1i15.kph.uni-mainz.de \
--to=ulm@gentoo.org \
--cc=9817@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.