From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Aug 2017 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 27952@debbugs.gnu.org Cc: stefan monnier X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: stefan monnier Received: via spool by submit@debbugs.gnu.org id=B.15018548414630 (code B ref -1); Fri, 04 Aug 2017 13:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Aug 2017 13:54:01 +0000 Received: from localhost ([127.0.0.1]:41156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddd3B-0001CU-40 for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:54:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddd39-0001CJ-7i for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:54:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddd20-0006NT-6J for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:53:54 -0400 Received: from lists.gnu.org ([2001:4830:134:3::11]:59291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ddd1z-0006M5-Kd for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:52:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddd11-0000QN-0v for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 09:52:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddbmJ-0007GF-CV for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 08:33:40 -0400 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]:38619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddbmJ-0007F5-0L for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 08:32:31 -0400 Received: by mail-pg0-x231.google.com with SMTP id l64so7497711pge.5 for ; Fri, 04 Aug 2017 05:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=V2tSIRjz35gWamMP95JyYDFzviTCJ4od/vaKrX8/Xe4=; b=jpKtgRMOQZoCXhiqVdqHAw91MjtnYq0ubAkfPsFGtUGovDMmnz3GwLayhPjkyzLnSI XtXZ6DYdutLP8qQv3AjSz+eVwk58V+DL83hU+Gg2aoYZg5uMSUAWAA0du2G0YoT52MX5 ursgxqhinn2BQQWFiLgbk4H8OYp5fNvRbdvOnn7WZa/QJaamGaNBcGiH7Rvf291GFZNS YaFbqZA+HMQsk9Iuxmd0IvD1EIp8i/wy4lnKgIDKwVjZX6gC7smxrMKdIHKC3cd59BmK COx/6OYlN6UKEsQZglhLecXYsaXI+9kChfOxNDdWW19Lk6mVXPXSjN68GKyKywkbWQHy jnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=V2tSIRjz35gWamMP95JyYDFzviTCJ4od/vaKrX8/Xe4=; b=EzETkbTdZyzIkt9q6tLyhzm+UMiN7THCVFWiFvGSd2BBd4HlTQlLzvppMPGPVEQ0jl GxBUrnpN6MwWvob+oAnnBJ3M66p8Wpq8WunO6qIuxwqDG09whjXsDHlERSge0Xb5YVRD Oag6sUzITG81IgdkDhmJdf1qD6K2yqtweuuf0IB7nowSuc3dyV8lwgkqdMITKS6pwn5n +KRL5ZJbCy88q+d/oIv4EjKfhdtoXPINnIMbxAjncYUaj9WvNlmiu2cUWpdZOWJmNxUx 9IkkK+jIxbeZHVuZOInyBw0fJdtzrNxqDV8W8xmkmTyuh4R8nkjj8xZnOHIqJwfKTtB0 zaxw== X-Gm-Message-State: AIVw1136nKbdMgW21TfCboyJzwtx2LmKCzMmmUeNvZUwb1R220hbZi+Y Lqxs4rG5Jqz49xDQ X-Received: by 10.84.241.76 with SMTP id u12mr2631863plm.196.1501849949696; Fri, 04 Aug 2017 05:32:29 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id f88sm3354579pff.74.2017.08.04.05.32.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Aug 2017 05:32:29 -0700 (PDT) From: Tino Calancha Date: Fri, 04 Aug 2017 21:32:24 +0900 Message-ID: <8760e3zf6v.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Severity: wishlist Tag: patch X-Debbugs-CC: Stefan Monnier These functions are almost identical; archive-int-to-mode has a FIXME suggesting merging it with tar-grind-file-mode. --8<-----------------------------cut here---------------start------------->8--- commit c6d36b04de7f6442653af7e4699bdad44ee57201 Author: Tino Calancha Date: Fri Aug 4 21:25:44 2017 +0900 Combine archive-int-to-mode and tar-grind-file-mode These functions are almost identical. Add a new function file-modes-number-to-symbolic; use it to define the other two. * lisp/files.el (file-modes-number-to-symbolic-1) (file-modes-number-to-symbolic): New defuns. * lisp/arc-mode.el (archive-int-to-mode): Define as a alias of file-modes-number-to-symbolic. * lisp/tar-mode.el (tar-grind-file-mode): Fix docstring. Use file-modes-number-to-symbolic. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index bd7548b704..8f3691b337 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -549,26 +549,7 @@ archive-l-e (aref str (- len i))))) result)) -(defun archive-int-to-mode (mode) - "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------." - ;; FIXME: merge with tar-grind-file-mode. - (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (if (zerop (logand 64 mode)) - (if (zerop (logand 1024 mode)) ?- ?S) - (if (zerop (logand 1024 mode)) ?x ?s)) - (if (zerop (logand 32 mode)) ?- ?r) - (if (zerop (logand 16 mode)) ?- ?w) - (if (zerop (logand 8 mode)) - (if (zerop (logand 2048 mode)) ?- ?S) - (if (zerop (logand 2048 mode)) ?x ?s)) - (if (zerop (logand 4 mode)) ?- ?r) - (if (zerop (logand 2 mode)) ?- ?w) - (if (zerop (logand 1 mode)) ?- ?x))) +(defalias 'archive-int-to-mode 'file-modes-number-to-symbolic) (defun archive-calc-mode (oldmode newmode &optional error) "From the integer OLDMODE and the string NEWMODE calculate a new file mode. diff --git a/lisp/files.el b/lisp/files.el index 89f6f9f44d..e776b00b91 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7188,6 +7188,65 @@ file-modes-symbolic-to-number (error "Parse error in modes near `%s'" (substring modes 0)))) num-modes))) +(defun file-modes-number-to-symbolic-1 (mode) + (string + (if (zerop (logand 8192 mode)) + (if (zerop (logand 16384 mode)) ?- ?d) + ?c) ; completeness + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 1 mode)) ?- ?x))) + +(defun file-modes-number-to-symbolic (mode &optional detailed from) + "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------. +If optional arg DETAILED is non-nil, then use the format 'u=rwx,g=,o='. +If optional argument FROM is non-nil, then it's the original file mode + to compare with MODE. FROM is ignored unless DETAILED is non-nil. + +For instance, if MODE is 448, DETAILED is non-nil, and FROM is 400, +the output is 'u+x,g-w'." + (let ((mode (file-modes-number-to-symbolic-1 mode)) + (from (and from (substring (file-modes-number-to-symbolic-1 from) 1)))) + (if (not detailed) + mode + (setq mode (substring mode 1)) + (cond (from + (let ((res "u")) + (dotimes (i (length mode)) + (let ((x (aref mode i)) + (y (aref from i))) + (when (= i 3) (setq res (concat res ",g"))) + (when (= i 6) (setq res (concat res ",o"))) + (setq res (concat res + (cond ((eq x y) "") + ((eq x ?-) (string ?- y)) + ((eq y ?-) (string ?+ x))))))) + (replace-regexp-in-string + ",\\'" "" + (replace-regexp-in-string + "u," "" + (replace-regexp-in-string + "g," "" + (replace-regexp-in-string + "o\\'" "" res)))))) + (t + (replace-regexp-in-string + "-" "" + (format "u=%s,g=%s,o=%s" + (substring mode 0 3) + (substring mode 3 6) + (substring mode 6)))))))) + (defun read-file-modes (&optional prompt orig-file) "Read file modes in octal or symbolic notation and return its numeric value. PROMPT is used as the prompt, default to \"File modes (octal or symbolic): \". diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 1d453d2980..f41cc25532 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -469,24 +469,12 @@ tar-clip-time-string (concat " " (substring str 4 16) (format-time-string " %Y" time)))) (defun tar-grind-file-mode (mode) - "Construct a `-rw--r--r--' string indicating MODE. + "Construct a `rw-r--r--' string indicating MODE. MODE should be an integer which is a file mode value." - (string - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (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 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 512 mode)) - (if (zerop (logand 1 mode)) ?- ?x) - (if (zerop (logand 1 mode)) ?T ?t)))) + (let ((str (substring (file-modes-number-to-symbolic mode) 1))) + (unless (zerop (logand 512 mode)) + (aset mode 8 (if (zerop (logand 1 mode)) ?T ?t))) + str)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) "Return a line similar to the output of `tar -vtf'." --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-08-04 Repository revision: db5d38ddb0de83d8f920b7a128fe3fd5156fdf85 From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 04 21:23:55 2017 Received: (at control) by debbugs.gnu.org; 5 Aug 2017 01:23:55 +0000 Received: from localhost ([127.0.0.1]:42188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddnoo-0005Zt-P0 for submit@debbugs.gnu.org; Fri, 04 Aug 2017 21:23:54 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:34346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddnol-0005Zc-9T for control@debbugs.gnu.org; Fri, 04 Aug 2017 21:23:52 -0400 Received: by mail-it0-f50.google.com with SMTP id m34so9828164iti.1 for ; Fri, 04 Aug 2017 18:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version; bh=Wj5PMjLYOlQBV4ziEhpJMsn7udEhQssJ2VTWzvaeA4s=; b=bh7kDv6JOajv9ejxQerNmz+m1J3JUEfdZxsu5sCSxOL74b/2Qs7lwk9X9Ti/c8QsIs yPsx30y8+gWSpL5J6oR1NN0kohtdYh8YhQ3xCHPHAl1ce/zgu4ZWb0ddfVHfmSkgdkEH /Xe9/0ufTQ6p8l3wF3hkwZu7oWOtLF8NWmA1+3eeH0sTjnN4TypgQBKVJ0ipxtg2ktTL KcEfoHICUxt/w9RokiPQBpqM9L6k95KEgMUGVYX0E5CK8f4/4LyAOK8ILejlCjJzSzQ6 qfYKwbYyiUn9SbKYil+T0pYhjWWCo2dtiWwGx6mOepdKQx03ImeA0BH3N/wyBq1KdT7M Sl3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=Wj5PMjLYOlQBV4ziEhpJMsn7udEhQssJ2VTWzvaeA4s=; b=sMgiJmQJi0IYiwvmfH+hssBfRGH0tA1WeR/gmo0EBuUPsZrlzPtmT9x5av9K2BXMTy cKd3g6juY/sjV31dksxpfFGo+EAVsDSfVnjWooEUsPQTCbwRCANVBxRAcl5zfV6rq6LE 5lWWOyjA6vCND/VF8V/r4UAY5bSbyK05Q0Mx1UQ1Oaj54l4JAEJv4GkJZK8sPw27cxB8 iJn+VXev9W/nFiwZZWwI/tNMa3indTnbsO/YUpKNZXdwaTD+9XJGHR7TfF+hsChw/9tg 1lZNhBMJGmU5c1HjFdkK2E/z/K1cfCIJUZaPngCJnaV5ykQqEutTNrpPw/AGI8IlGtR1 uOqw== X-Gm-Message-State: AIVw111aqhbsvdmudapwK4tAC0fPIF4YJdPejtNHxGyiizOxRb40bAEV vNLq/L0g7tG3I3mk X-Received: by 10.36.66.16 with SMTP id i16mr4106201itb.132.1501896225870; Fri, 04 Aug 2017 18:23:45 -0700 (PDT) Received: from zony ([45.2.119.48]) by smtp.googlemail.com with ESMTPSA id 134sm1393775ion.32.2017.08.04.18.23.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Aug 2017 18:23:45 -0700 (PDT) From: npostavs@users.sourceforge.net To: control@debbugs.gnu.org Subject: control message for bug #27952 Date: Fri, 04 Aug 2017 21:25:27 -0400 Message-ID: <87a83e7qm0.fsf@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) tags 27952 + patch quit From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 11:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 27952@debbugs.gnu.org Cc: Eli Zaretskii , stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.150288381810413 (code B ref 27952); Wed, 16 Aug 2017 11:44:02 +0000 Received: (at 27952) by debbugs.gnu.org; 16 Aug 2017 11:43:38 +0000 Received: from localhost ([127.0.0.1]:40269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhwja-0002hs-4u for submit@debbugs.gnu.org; Wed, 16 Aug 2017 07:43:38 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36261) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhwjY-0002he-5F for 27952@debbugs.gnu.org; Wed, 16 Aug 2017 07:43:36 -0400 Received: by mail-pf0-f178.google.com with SMTP id c28so5295517pfe.3 for <27952@debbugs.gnu.org>; Wed, 16 Aug 2017 04:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=xwXgytBJ29Jbpxs/AFDHk+JSDgkVca7MYvA8f/UqETo=; b=kMkgbmIY1MsSdKLWp+1SXmvkIqi/lmGwE2bkay2poJ0WDsBZGChjWYbOJxpvTxSGlD JhgRBi7vEw1dqFBAXBPnbsPPS26rwQObutSaRDKAce/px5KmBzUrvcpjCjox7tu1W0yI c5i5Dr0bOkPxKDR65rPvUJU2x1vO84p8miEabpRLx833EQnhZ4uVDufHBhRlFZnMcLrA 0C4WDoYhsDxxVQiKjyoYPJBJiX0RXfx3l9KqPfKXhm2k4BrH4XLeB0FGbiUBmsSBhD8+ w/IHaeLrIfZKZ3VaJcOzQOUBlsdifGC16bpIEauHTzORF6iDQ7yiWcZNmrIp6lhtuLGV aYWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=xwXgytBJ29Jbpxs/AFDHk+JSDgkVca7MYvA8f/UqETo=; b=tsltWQ+ZPdrhqTvQvdfjvp5QIrM+T0SoVbm9YirDOPj0EjIdiZt3ly24KE8dcckOTR Q2qUC31ZddWXiFplwKHCyGpQMWhXuRmHp3Mnkh4ROSuamZmiNWNGD4eUwjLPSoLwpyD8 X8pl2iER5fhJg0n7TmDOQ35bmSzphLGJQhH3Ah7NLZqmnv5Ae6Uml3VSB+/pmRhLj43F dCbCmAd8i0klU5R/BxsAhKA+0nA+Q1Q19sMlT1YA1Q+KbKNYkSgnxHYH1KULp8hBgpi+ 5BrHcuJ3NsZMCGBmPMeFe/vs0/eR8NFoGGOF96kHVCkXt86rOYi/+eNbf/dD7c/z45jP AAiw== X-Gm-Message-State: AHYfb5h1Jr7ILIB8NKt7nC1Gvu5XflEk8Wkx2e+7uGx+PeHeM5DK+TFl IpQWvfvRSnenSg== X-Received: by 10.99.106.65 with SMTP id f62mr307732pgc.32.1502883809904; Wed, 16 Aug 2017 04:43:29 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id m3sm2074302pfg.16.2017.08.16.04.43.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Aug 2017 04:43:29 -0700 (PDT) From: Tino Calancha References: <8760e3zf6v.fsf@calancha-pc> Date: Wed, 16 Aug 2017 20:43:17 +0900 In-Reply-To: <8760e3zf6v.fsf@calancha-pc> (Tino Calancha's message of "Fri, 04 Aug 2017 21:32:24 +0900") Message-ID: <87efsb7n6y.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.8 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) Tino Calancha writes: > These functions are almost identical; archive-int-to-mode has a FIXME > suggesting merging it with tar-grind-file-mode. *) Updated the patch after Bug#28092 has being fixed. **) Now `archive-int-to-mode' also shows the sticky bit info as `tar-grind-file-mode' does: (archive-int-to-mode 996) => "-rwxr--r-T" (archive-int-to-mode 997) => "-rwxr--r-t" (tar-grind-file-mode 996) => "rwxr--r-T" (tar-grind-file-mode 997) => "rwxr--r-t" ;; `archive-int-to-mode' already was showing the 's' bit info, so ;; the fact that wasn't showing the sticky bit must be a mistake. ***) Added new tests. Please, let me know if you want to have this patch in. Tino --8<-----------------------------cut here---------------start------------->8--- commit 74d1a07379a88f62fdb0e497111fdf4845723806 Author: Tino Calancha Date: Wed Aug 16 20:23:34 2017 +0900 Combine archive-int-to-mode and tar-grind-file-mode These functions are almost identical. Extract a new function 'file-modes-number-to-symbolic' from them; use it to define 'archive-int-to-mode' and 'tar-grind-file-mode' (Bug#27952). * lisp/files.el (file-modes-number-to-symbolic-1): New defun extracted from 'archive-int-to-mode' and 'tar-grind-file-mode'. (file-modes-number-to-symbolic): New defun; like `file-modes-number-to-symbolic-1' with 2 optional arguments: 'detailed' and 'from'. * lisp/tar-mode.el (tar-grind-file-mode) * lisp/arc-mode.el (archive-int-to-mode): Use file-modes-number-to-symbolic in its definition. * test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode): Update test. * test/lisp/files-tests.el (file-modes-symbolic-to-number) (file-modes-number-to-symbolic) (file-modes-number-to-symbolic-inverse): Add tests. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 938c143b8e..c1987ee774 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -550,25 +550,10 @@ archive-l-e result)) (defun archive-int-to-mode (mode) - "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------." - ;; FIXME: merge with tar-grind-file-mode. - (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (if (zerop (logand 64 mode)) - (if (zerop (logand 2048 mode)) ?- ?S) - (if (zerop (logand 2048 mode)) ?x ?s)) - (if (zerop (logand 32 mode)) ?- ?r) - (if (zerop (logand 16 mode)) ?- ?w) - (if (zerop (logand 8 mode)) - (if (zerop (logand 1024 mode)) ?- ?S) - (if (zerop (logand 1024 mode)) ?x ?s)) - (if (zerop (logand 4 mode)) ?- ?r) - (if (zerop (logand 2 mode)) ?- ?w) - (if (zerop (logand 1 mode)) ?- ?x))) + "Construct a `-rw-r--r--' string indicating MODE. +MODE should be an integer which is a file mode value. +For instance, if mode is 448, then it produces `-rwx------'." + (file-modes-number-to-symbolic mode)) (defun archive-calc-mode (oldmode newmode &optional error) "From the integer OLDMODE and the string NEWMODE calculate a new file mode. diff --git a/lisp/files.el b/lisp/files.el index b05d453b0e..664ea943d9 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7143,6 +7143,95 @@ file-modes-rights-to-number op char-right))) num-rights)) +(defun file-modes-number-to-symbolic-1 (mode) + (string + (if (zerop (logand 8192 mode)) + (if (zerop (logand 16384 mode)) ?- ?d) + ?c) ; completeness + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 512 mode)) + (if (zerop (logand 1 mode)) ?- ?x) + (if (zerop (logand 1 mode)) ?T ?t)))) + +(defun file-modes-number-to-symbolic (mode &optional detailed from) + "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------. +If optional arg DETAILED is non-nil, then use the format 'u=rwx,g=,o='. +If optional argument FROM is non-nil, then it's the original file mode + to compare with MODE. FROM is ignored unless DETAILED is non-nil. + +For instance, if MODE is 448, DETAILED is non-nil, and FROM is 400, +the output is 'u+x,g-w'. + +Note: This is not the inverse of `file-modes-symbolic-to-number'; +The reason is that this function might return an string containing 'S' +or 'T' i.e., not valid characters for `file-modes-symbolic-to-number'. +For example, (file-modes-symbolic-to-number \"o=t\") returns 512; +and (file-modes-number-to-symbolic 512 t) returns \"o=T\"." + (let ((mode (file-modes-number-to-symbolic-1 mode)) + (from (and from (substring (file-modes-number-to-symbolic-1 from) 1)))) + (if (not detailed) + mode + (let ((replace-fn (lambda (x) + (replace-regexp-in-string + ",\\`" "" + (replace-regexp-in-string + "u=," "" + (replace-regexp-in-string + "g=," "" + (replace-regexp-in-string + "o=\\'" "" x))))))) + (setq mode (substring mode 1)) + (cond (from + (let* ((res "u") + (special-bit-fn (lambda (x y c C &optional inv) ; c or C in (x y) + (cond ((eq x c) ; xc + (cond ((eq y ?-) (string (if inv ?- ?+) ?x c)) + ((eq y ?x) (string (if inv ?- ?+) c)) + ((eq y C) (string (if inv ?- ?+) ?x)))) + ((eq x C) ; just c + (cond ((eq y ?-) (string (if inv ?- ?+) c)) + ((eq y ?x) (if inv (string ?+ ?x c) (string ?- ?x ?+ c))) + ((eq y c) (string (if inv ?+ ?-) ?x)))) + (t nil)))) + (compare-fn (lambda (x y) + (cond ((eq x y) "") + ;; sticky bit or setuid setgid changes. + ((or (eq x ?t) (eq x ?T) (eq y ?t) (eq y ?T) + (eq x ?s) (eq x ?S) (eq y ?s) (eq y ?S)) + (if (or (eq x ?t) (eq x ?T) (eq y ?t) (eq y ?T)) + (or (funcall special-bit-fn x y ?t ?T) + (funcall special-bit-fn y x ?t ?T 'inv)) + (or (funcall special-bit-fn x y ?s ?S) + (funcall special-bit-fn y x ?s ?S 'inv)))) + ((eq x ?-) (string ?- y)) + ((eq y ?-) (string ?+ x)))))) + (dotimes (i (length mode)) + (let ((x (aref mode i)) + (y (aref from i))) + (when (= i 3) (setq res (concat res ",g"))) + (when (= i 6) (setq res (concat res ",o"))) + (setq res (concat res (funcall compare-fn x y))))) + (funcall replace-fn res))) + (t + (funcall replace-fn + (replace-regexp-in-string + "-" "" + (format "u=%s,g=%s,o=%s" + (substring mode 0 3) + (substring mode 3 6) + (substring mode 6)))))))))) + (defun file-modes-symbolic-to-number (modes &optional from) "Convert symbolic file modes to numeric file modes. MODES is the string to convert, it should match diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index b0d3177694..1843cfcc4a 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -470,23 +470,9 @@ tar-clip-time-string (defun tar-grind-file-mode (mode) "Construct a `rw-r--r--' string indicating MODE. -MODE should be an integer which is a file mode value." - (string - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (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 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 512 mode)) - (if (zerop (logand 1 mode)) ?- ?x) - (if (zerop (logand 1 mode)) ?T ?t)))) +MODE should be an integer which is a file mode value. +For instance, if mode is 448, then it produces `rwx------'." + (substring (file-modes-number-to-symbolic mode) 1)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) "Return a line similar to the output of `tar -vtf'." diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el index 8c8465d366..f136becf55 100644 --- a/test/lisp/arc-mode-tests.el +++ b/test/lisp/arc-mode-tests.el @@ -26,7 +26,7 @@ (let ((alist (list (cons 448 "-rwx------") (cons 420 "-rw-r--r--") (cons 292 "-r--r--r--") - (cons 512 "----------") + (cons 512 "---------T") (cons 1024 "------S---") ; Bug#28092 (cons 2048 "---S------")))) (dolist (x alist) diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index a2f2b74312..fc3017027d 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -344,6 +344,71 @@ files-tests--with-temp-file (cdr path-res) (insert-directory-wildcard-in-dir-p (car path-res))))))) +(ert-deftest file-modes-symbolic-to-number () + (let ((alist '(("a=rwx" . 511) + ("o=t" . 512) + ("o=xt" . 513) + ("o=tx" . 513) ; Order doesn't matter. + ("u=rwx,g=rx,o=rx" . 493) + ("u=rwx,g=,o=" . 448) + ("u=rwx" . 448) ; Empty permissions can be ignored. + ("u=rw,g=r,o=r" . 420) + ("u=rw,g=r,o=t" . 928) + ("u=rw,g=r,o=xt" . 929) + ("u=rwxs,g=rs,o=xt" . 4065) + ("u=rws,g=rs,o=t" . 4000) + ("u=rws,g=rs,o=r" . 3492) + ("a=r" . 292) + ("u=S") + ("u=T") + ("u=Z")))) + (dolist (x alist) + (if (cdr-safe x) + (equal (cdr-safe x) (file-modes-symbolic-to-number (car x))) + (should-error (file-modes-symbolic-to-number (car x))))))) + +(ert-deftest file-modes-number-to-symbolic () + (let ((from 644) + (fn #'file-modes-number-to-symbolic) + ;; Alist of the form (MODE RES1 RES2 RES3), + ;; MODE is the first argument of FN. + ;; RES1, the result of calling FN with 1 argument. + ;; RES2, the result of calling FN with 2nd arg non-nil. + ;; RES3, the result of calling FN with 2nd arg non-nil and 3rd arg FROM. + (alist '((493 "-rwxr-xr-x" "u=rwx,g=rx,o=rx" "u+r+x,g+r+x,o+xt") + (448 "-rwx------" "u=rwx,g=,o=" "u+r+x,o-r-t") + (420 "-rw-r--r--" "u=rw,g=r,o=r" "u+r,g+r,o-t") + (928 "-rw-r----T" "u=rw,g=rx,o=r" "u+r,g+r,o-r") + (929 "-rw-r----t" "u=rw,g=rx,o=rx" "u+r,g+r,o-r+x") + (4065 "-rwsr-S--t" "u=rws,g=rS,o=t" "u+r+xs,g+r+s,o-r+x") + (4000 "-rwSr-S--T" "u=rwS,g=rS,o=T" "u+r+s,g+r+s,o-r") + (3492 "-rwSr-Sr--" "u=rwS,g=rS,o=r" "u+r+s,g+r+s,o-t") + (292 "-r--r--r--" "u=r,g=r,o=r" "u+r-w,g+r,o-t") + ("u=S") + ("u=T") + ("u=Z")))) + (dolist (x alist) + (cond ((cdr-safe x) + (let ((res1 (cadr x)) (res2 (caddr x)) (res3 (cadddr x))) + (equal res1 (funcall fn (car x))) + ;; FROM is ignored when DETAILED is nil. + (equal res1 (funcall fn (car x) nil from)) + (equal res2 (funcall fn (car x) 'detailed)) + (equal res3 (funcall fn (car x) 'detailed from)))) + (t (should-error (funcall fn (car x)))))))) + +(ert-deftest file-modes-number-to-symbolic-inverse () + (dotimes (i 4096) ; from 0 to 7777 in octal. + ;; If neithr sticky bit nor set_uid not set_gid are set, then + ;; `file-modes-symbolic-to-number' is the inverse of + ;; `file-modes-number-to-symbolic'. + (when (and (zerop (logand i 512)) + (zerop (logand i 1024)) + (zerop (logand i 2048))) + (should + (= i + (file-modes-symbolic-to-number + (file-modes-number-to-symbolic i t))))))) (provide 'files-tests) ;;; files-tests.el ends here --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-08-16 Repository revision: 400934b694087f4fe94755d78cbd1569efdb1fa8 From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 11:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Eli Zaretskii , 27952@debbugs.gnu.org, stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.150288471311772 (code B ref 27952); Wed, 16 Aug 2017 11:59:02 +0000 Received: (at 27952) by debbugs.gnu.org; 16 Aug 2017 11:58:33 +0000 Received: from localhost ([127.0.0.1]:40278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhwy0-00033o-Nc for submit@debbugs.gnu.org; Wed, 16 Aug 2017 07:58:32 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:35236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhwxz-00033Z-8X for 27952@debbugs.gnu.org; Wed, 16 Aug 2017 07:58:31 -0400 Received: by mail-it0-f53.google.com with SMTP id 76so16329973ith.0 for <27952@debbugs.gnu.org>; Wed, 16 Aug 2017 04:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=KoVUT4ViE9p9YNnKiGMXyLnibN0jq6EG+uq4C1D/h1k=; b=MbBONnV3Mty3s1xy1j+CJD4F9BrH1pE2b512UJ7uHLI9CJ0J3wRoED9Eil36BbUvp1 s6uQmHKTK72WprJsaGnPb+DQBQMNfNDvgbnQH2qh8rNg9n0D0k6cBBuqZO+5XWVyjQfy WIG0586M0wcXFnO8t6xKsaQn8w4STOunmD0kNAfkka7sq/TqqRryjCz+ZqHDfILOu3Hq WEnocNvs1ik7VLljbvih4ovrg864GS/ctry6JTXavjL+xrvrVeT0PwP+xvwEToAt5KCS gl9nFwd66AQAca5UbKMfEgASYuP9CFxv62kgPwjqircC8VHUquEbzs1xI+j6hiWY6ZBu 0ruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=KoVUT4ViE9p9YNnKiGMXyLnibN0jq6EG+uq4C1D/h1k=; b=lLssVbm+sH/Zicz7+gfItPJIATnfJmJYF3J2G+nJMCgmgFlqfJ+f0uyInegcHThn+R bx+j/oUD4WOkogB7ZY40CuiM48FboQAQvwO5MtxHEdt9foIZxAbSkMTj0TxuB5tKyIId Z/ot8E3jMWqPjt/Jb5agToaeVHx3lZ9OyCgB+8xliRQIp7siffwJiCIhcZD4eAi8gREd YOeY2TYbnfkqoVm2KetHbHCf+afbo3mxNvdvu13U4dPYjBNq8IcjRz7Q3iWoMOSAQpvH sA9mo8Hb9bcPi0T09zO4aZwTuX615smCMTKmPudiPM/Do+GwDEotKNjuDwmRdUQcugfk lVeQ== X-Gm-Message-State: AHYfb5gliVAl7Ad++n8gbUq00DzHRC5/b/LkQIhC6nXoYd48RFTKb7SH uzPbIQw7xfmCnQ== X-Received: by 10.36.41.143 with SMTP id p137mr1467766itp.98.1502884705666; Wed, 16 Aug 2017 04:58:25 -0700 (PDT) Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id o10sm256830ioe.27.2017.08.16.04.58.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Aug 2017 04:58:25 -0700 (PDT) From: npostavs@users.sourceforge.net References: <8760e3zf6v.fsf@calancha-pc> <87efsb7n6y.fsf@calancha-pc> Date: Wed, 16 Aug 2017 08:00:03 -0400 In-Reply-To: <87efsb7n6y.fsf@calancha-pc> (Tino Calancha's message of "Wed, 16 Aug 2017 20:43:17 +0900") Message-ID: <87fucrzprw.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Tino Calancha writes: > + (replace-regexp-in-string > + ",\\`" "" This regex doesn't match anything, did you mean \\' at the end? > (defun tar-grind-file-mode (mode) > "Construct a `rw-r--r--' string indicating MODE. > +MODE should be an integer which is a file mode value. > +For instance, if mode is 448, then it produces `rwx------'." IMO, it's clearer if you write #o700 instead of 448 here, perhaps in the code too. From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 12:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 27952@debbugs.gnu.org, stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.150288529312822 (code B ref 27952); Wed, 16 Aug 2017 12:09:02 +0000 Received: (at 27952) by debbugs.gnu.org; 16 Aug 2017 12:08:13 +0000 Received: from localhost ([127.0.0.1]:40305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhx7N-0003Kk-3M for submit@debbugs.gnu.org; Wed, 16 Aug 2017 08:08:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:46628 helo=mx1.suse.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhx7M-0003Kd-3O for 27952@debbugs.gnu.org; Wed, 16 Aug 2017 08:08:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 27A99AD8E; Wed, 16 Aug 2017 12:08:11 +0000 (UTC) From: Andreas Schwab References: <8760e3zf6v.fsf@calancha-pc> <87efsb7n6y.fsf@calancha-pc> X-Yow: My EARS are GONE!! Date: Wed, 16 Aug 2017 14:08:10 +0200 In-Reply-To: <87efsb7n6y.fsf@calancha-pc> (Tino Calancha's message of "Wed, 16 Aug 2017 20:43:17 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On Aug 16 2017, Tino Calancha wrote: > +Note: This is not the inverse of `file-modes-symbolic-to-number'; > +The reason is that this function might return an string containing 'S' > +or 'T' i.e., not valid characters for `file-modes-symbolic-to-number'. > +For example, (file-modes-symbolic-to-number \"o=t\") returns 512; > +and (file-modes-number-to-symbolic 512 t) returns \"o=T\"." Why would it use uppercase T in the detailed case? Uppercase is only needed when it would overlay the 'x' position in the non-detailed case. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 13:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Andreas Schwab Cc: 27952@debbugs.gnu.org, stefan monnier , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.150288903018899 (code B ref 27952); Wed, 16 Aug 2017 13:11:03 +0000 Received: (at 27952) by debbugs.gnu.org; 16 Aug 2017 13:10:30 +0000 Received: from localhost ([127.0.0.1]:40388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhy5d-0004ul-L7 for submit@debbugs.gnu.org; Wed, 16 Aug 2017 09:10:29 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:34890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhy5b-0004uW-UR for 27952@debbugs.gnu.org; Wed, 16 Aug 2017 09:10:28 -0400 Received: by mail-pg0-f52.google.com with SMTP id v189so22847175pgd.2 for <27952@debbugs.gnu.org>; Wed, 16 Aug 2017 06:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DjYECUcztDEK76GPE/AuXfm1oxfMDqNaCzESzACTs+w=; b=Xhcj6yvo/wc/k90NGvDRSVnMtsoG6oqs6faxFgOdpTqemeGAmn6lnA0lYCV9cVSkj3 QhKfIiuDlRE3D8jl37iq/FLnc6APE2TpxXRy7Q2lze6Pnn80by/n8ln1bCGJixm9n0r8 OGFyDFTJxt1/tDZHkkJf5BJwnW7tFaXJvGvq3OcwWn1xJEF8KFSvwUb7b74ej+7jHEiS ls7yXHtngAz/0VoDZYCfSFQpnB8S13go8uVf8as060BS6+8Zr40yF+4Z91UQizHhEIGp h1mDsjBeDiaWZGHbQhpq3tK85ZnteTnSd3ASSnZDX7QlgAxb5gcEPy8pUXjwFRn0NnUy 61Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DjYECUcztDEK76GPE/AuXfm1oxfMDqNaCzESzACTs+w=; b=Byh/3HfWYty+bkrYon5+naxmOyoxKY8IxzYvElgs+g5gvVLvclEsMh0RnOKltv6b/2 F/itKvBeoNKczxxAcg/qKbInkMDNAELrb5AXE9MApBXUMW9MgwM3jI/GUFPCsYNwI8/L 3uOV4GGdtJSR3UZ+awUA9kZIVx06PZKjvMefLVyK1eL9RqfSD5xVeORvrK1mrKywRJII 0EeP9A2Jzzga5nugl/ef3OvBmA8iLeTbgF6Bg8NVYVFyHUubeiO2IM61TBHk+9azuY4z rl9WC3etPcESp5XuqkOWTiU0qYJ30GDcL1YMN1AvuH0xkEQcb6FPZP4Km0F8HEZMrbVV DVow== X-Gm-Message-State: AHYfb5hHOzEARgyl+ltLNWcjB+G5lG41Nh6wreKjbSXC+026olg9rMjW ifbSVYJA1wEEHA== X-Received: by 10.84.143.1 with SMTP id 1mr1888964ply.103.1502889021856; Wed, 16 Aug 2017 06:10:21 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id s3sm3830704pgn.70.2017.08.16.06.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Aug 2017 06:10:20 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Wed, 16 Aug 2017 22:10:17 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87efsb7n6y.fsf@calancha-pc> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On Wed, 16 Aug 2017, Andreas Schwab wrote: > On Aug 16 2017, Tino Calancha wrote: > >> +Note: This is not the inverse of `file-modes-symbolic-to-number'; >> +The reason is that this function might return an string containing 'S' >> +or 'T' i.e., not valid characters for `file-modes-symbolic-to-number'. >> +For example, (file-modes-symbolic-to-number \"o=t\") returns 512; >> +and (file-modes-number-to-symbolic 512 t) returns \"o=T\"." > > Why would it use uppercase T in the detailed case? Uppercase is only > needed when it would overlay the 'x' position in the non-detailed case. Not special reason i think. To keep more similar with the case when DETAILED is nil. (file-modes-number-to-symbolic 512) => "---------T" At the end of the function that is changed into "o=T" with: (funcall replace-fn (replace-regexp-in-string "-" "" ... I liked like this when i wrote the patch. We could changed it in case is confusing. From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Aug 2017 13:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: npostavs@users.sourceforge.net Cc: Eli Zaretskii , 27952@debbugs.gnu.org, stefan monnier , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.150288923819233 (code B ref 27952); Wed, 16 Aug 2017 13:14:01 +0000 Received: (at 27952) by debbugs.gnu.org; 16 Aug 2017 13:13:58 +0000 Received: from localhost ([127.0.0.1]:40398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhy90-000508-Es for submit@debbugs.gnu.org; Wed, 16 Aug 2017 09:13:58 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:38500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhy8z-0004zt-De for 27952@debbugs.gnu.org; Wed, 16 Aug 2017 09:13:57 -0400 Received: by mail-pg0-f53.google.com with SMTP id l64so22822146pge.5 for <27952@debbugs.gnu.org>; Wed, 16 Aug 2017 06:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Vqdgm+vJLyV7ayDcUBT8ygt6rFCk2zplwxYs1gmlnrs=; b=t2vndKjgu6IhMmI/rTgFAx3OKD37ekBYNuyhEhD94pAxEi4GO/XaNbfc1OywBUcKwj 1x3RpnOR3ogh/03mPUwIC8TmTeFZ9kqqUdCocGNmoE+F/ncWkE/T/d21pU+fjcRgWgrI oykM//Mnigf+w/74v+gUtytL4PA3kvrHIQ1ssM3LETlgLI4g2DwK4c/Y83wNUyUKftYh BgCStf0gm0YyjNOh2p6GT2N8+dXYDdGaoQReNyUudRNhYrwDfBQlJj/FW8+EZo+RIhr0 pO7AbmdR08mZbOCLMqlRojD2tuM+cuyastf/vfU5lOXwdin//KjOBpE9VjFZpa3mjhFc 7yYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Vqdgm+vJLyV7ayDcUBT8ygt6rFCk2zplwxYs1gmlnrs=; b=DIULoD09HbEB7j/Tfsv8DRPo3n5RzppHDJ9esDrmKn/ad04Nudg1+vYDzqdR3N01By iMC6DAIHwvGrz7xxXQmW+xFsUhZog6e0l+fenKjI0A+9/ep8i53wQ3gsu9NHGlGhzu1c 36rWorKKRwLMR/DwMz5uJL88hLaY4l0wT0RJePhESEGUoFh36sB7qlP/BuinWUwMyXx9 2BmmEYmicEfJ6AYtLwSUNM/cGWSSLFwXqxFffGsO1y6QkZdKHgcnBhk1hmdF6SN21Kse FGaJ+RlWSzRsPapicEVQu1cqlcoyPiPfBRBZ9xx+GO87vZdQ9TfPG2kq2EtN1tHriEYV Yzyg== X-Gm-Message-State: AHYfb5jlAgwhLX/+nM4by1x6fFh9lS08BIpCLPp7hVJTzq94Kpi70sAa BlhKiVkD/gRBgjIK X-Received: by 10.101.73.72 with SMTP id q8mr1575911pgs.219.1502889231889; Wed, 16 Aug 2017 06:13:51 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id t12sm3512363pgo.46.2017.08.16.06.13.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Aug 2017 06:13:51 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Wed, 16 Aug 2017 22:13:48 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <87fucrzprw.fsf@users.sourceforge.net> Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87efsb7n6y.fsf@calancha-pc> <87fucrzprw.fsf@users.sourceforge.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Wed, 16 Aug 2017, npostavs@users.sourceforge.net wrote: > Tino Calancha writes: > >> + (replace-regexp-in-string >> + ",\\`" "" > > This regex doesn't match anything, did you mean \\' at the end? Yes, you are right. I wanted to drop comma at the end. >> (defun tar-grind-file-mode (mode) >> "Construct a `rw-r--r--' string indicating MODE. > >> +MODE should be an integer which is a file mode value. >> +For instance, if mode is 448, then it produces `rwx------'." > > IMO, it's clearer if you write #o700 instead of 448 here, perhaps in the > code too. Yeah, for those people not having nbc.el (num-base-converters) might be easier to follow. Opps, i am the only one having nbc.el! :-) From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2019 20:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 27952@debbugs.gnu.org, stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.156140850714762 (code B ref 27952); Mon, 24 Jun 2019 20:36:02 +0000 Received: (at 27952) by debbugs.gnu.org; 24 Jun 2019 20:35:07 +0000 Received: from localhost ([127.0.0.1]:58130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVgB-0003q0-Gj for submit@debbugs.gnu.org; Mon, 24 Jun 2019 16:35:07 -0400 Received: from quimby.gnus.org ([80.91.231.51]:36106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVgA-0003pr-1M for 27952@debbugs.gnu.org; Mon, 24 Jun 2019 16:35:06 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfVg7-0007R7-5u; Mon, 24 Jun 2019 22:35:05 +0200 From: Lars Ingebrigtsen References: <8760e3zf6v.fsf@calancha-pc> Date: Mon, 24 Jun 2019 22:35:03 +0200 In-Reply-To: <8760e3zf6v.fsf@calancha-pc> (Tino Calancha's message of "Fri, 04 Aug 2017 21:32:24 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Tino Calancha writes: > These functions are almost identical; archive-int-to-mode has a FIXME > suggesting merging it with tar-grind-file-mode. Tino, there were some suggestions about some syntactical issues, but otherwise I don't think anybody objected to the patch. Did you continue to work on it? It doesn't seem to have been applied. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Tino Calancha writes: > These functions are almost identical; archive-int-to-mode has a FIXME > suggesting merging it with tar-grind-file-mode. Tino, there were some suggestions about some syntactical issues, but otherwise I don't think anybody objected to the patch. Did you continue to work on it? It doesn't seem to have been applied. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2019 20:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: 27952@debbugs.gnu.org, stefan monnier , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.156140898215590 (code B ref 27952); Mon, 24 Jun 2019 20:43:03 +0000 Received: (at 27952) by debbugs.gnu.org; 24 Jun 2019 20:43:02 +0000 Received: from localhost ([127.0.0.1]:58141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVnq-00043L-25 for submit@debbugs.gnu.org; Mon, 24 Jun 2019 16:43:02 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:33848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVnm-000431-O6 for 27952@debbugs.gnu.org; Mon, 24 Jun 2019 16:42:59 -0400 Received: by mail-wr1-f47.google.com with SMTP id k11so15354743wrl.1 for <27952@debbugs.gnu.org>; Mon, 24 Jun 2019 13:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=VHZz6UbcSj9GZEeuyJRI5UrhDE4nCbJT03QUCkwd/Jk=; b=UdTXU/KrekTkVGJvbcf41+CTpz/zmQoxrxicDj55a1PJxa+Eec1Ue8skkwqvJAfqDE AnOmHaw8kOsAXt5Xo6S4XfGAKjEmpWs1GQuhvFbqBLrz7VnR1dcBZNV54UzUiN2K7Alg EnoXXCipnA8K8YT9I1l/IGjr+3fiZLu0+sgfGIesvUbnJkbSUWI/YeKwcX9k/H4ciaAE gy5YygIFLtkYkoxPlRrJm+cTjmYdf8iKffut1CbZaAZDCGCOvd5g/M6iNT4yHu8rceeu gljTeJtcCt/3jZhgRZDJEpP8keY7uvDfof4iOX6YXtJyYtHvdfB5YyLjFFlTSfruiLTn 7fFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=VHZz6UbcSj9GZEeuyJRI5UrhDE4nCbJT03QUCkwd/Jk=; b=g2l8YDpOvL6BRMMyu//3LsV9RzVwKVZHKWm0NIWIxNYBaHAvckQs7SdRYaU8mPCxjn NABIPbaBGRUbarZFOGUGt9qAFCbG2RzGk5e6hKyfVKMN6Ukr+2Ypgnka2WCWfORqJoBJ 6e40DYeCDRxfpVlFXI7hg3fVIcMtyCn6Mkd34wTNXqGRw9sg6weK0XEaEYTqzFuQYrwf tz9Dy2XFC6/VooyiVKzbVJ1dUQPgtAzz+4OUdBxp19j4tdX65kl9S5faMO0ctirsxKxd OsgXKR8cHwf2LDshkdStDEDg81YSfiwWCPdIJCSul4Iq+1GraYnDCimWUzhF3gwZfqnu TnAQ== X-Gm-Message-State: APjAAAWshyp2gParOR//Uy5jKjbHmHM0Pe3GOnE1ISnBoM5Ld9kfK1RC aOi9Ga0Jso2Bd6ZDLISK1cg= X-Google-Smtp-Source: APXvYqyQFO7zQj7d52gVCB9iWF4ovrfRAScEPcCkB6PSBjU2FB3WsaDrU4J7d4qIqTbm/FHkIIIXVQ== X-Received: by 2002:adf:e50c:: with SMTP id j12mr32226524wrm.117.1561408972781; Mon, 24 Jun 2019 13:42:52 -0700 (PDT) Received: from calancha-pc.dy.bbexcite.jp ([2a02:8308:70c5:4d00:a2fc:1435:82df:8682]) by smtp.gmail.com with ESMTPSA id e21sm21199927wra.27.2019.06.24.13.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 13:42:52 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Tue, 25 Jun 2019 05:42:50 +0900 (JST) X-X-Sender: calancha@calancha-pc.dy.bbexcite.jp In-Reply-To: Message-ID: References: <8760e3zf6v.fsf@calancha-pc> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Probably I wasn't happy enough with my patch and that's why I forget about it (I maybe started the fishing season and that got all my attention; I cannot remember). I will work on this again since next weekend and try to prepare the simples patch as possible. Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ingebrigtsen.no] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.47 listed in list.dnswl.org] 1.1 MALFORMED_FREEMAIL Bad headers on message from free email service X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Probably I wasn't happy enough with my patch and that's why I forget about it (I maybe started the fishing season and that got all my attention; I cannot remember). I will work on this again since next weekend and try to prepare the simples patch as possible. Thank you for the reminder! Tino > Tino Calancha writes: > >> These functions are almost identical; archive-int-to-mode has a FIXME >> suggesting merging it with tar-grind-file-mode. > > Tino, there were some suggestions about some syntactical issues, but > otherwise I don't think anybody objected to the patch. Did you continue > to work on it? It doesn't seem to have been applied. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no > From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Nov 2019 03:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Lars Ingebrigtsen , 27952@debbugs.gnu.org, stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.15734416766750 (code B ref 27952); Mon, 11 Nov 2019 03:08:02 +0000 Received: (at 27952) by debbugs.gnu.org; 11 Nov 2019 03:07:56 +0000 Received: from localhost ([127.0.0.1]:52984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iU03X-0001kn-OM for submit@debbugs.gnu.org; Sun, 10 Nov 2019 22:07:55 -0500 Received: from host.gofardesign.uk ([208.79.239.190]:40197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iU03V-0001kU-UY for 27952@debbugs.gnu.org; Sun, 10 Nov 2019 22:07:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jfelC5HJyOL9C9cOuhAozw1abnXryoBgjy21FgLKSNE=; b=WrGKkElGdG4fA8C9ccosaqLAbS NcpVP2bvYzA9yAJXkJL3q3WG75N6qLm+oHw4eCtJtpVnVaR0NKG7pxsr1t0YrDflItZGKQfr7/IjL XnEcmF1ofx3EMCvsikB6GpFBY0TjWWSzf5j1knV4M8iCcikM1uoWhmIjQc0oQzp2Go4A=; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:54892 helo=localhost) by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iU03P-0004My-2M; Sun, 10 Nov 2019 21:07:47 -0600 From: Stefan Kangas In-Reply-To: (Tino Calancha's message of "Tue, 25 Jun 2019 05:42:50 +0900 (JST)") References: <8760e3zf6v.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Mon, 11 Nov 2019 04:07:45 +0100 Message-ID: <87h83bqfem.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: host.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Tino Calancha writes: > Probably I wasn't happy enough with my patch and that's why I forget > about it (I maybe started the fishing season and that got all my attention; I > cannot remember). > > I will work on this again since next weekend and try to prepare the simples > patch as possible. That was 19 weeks ago. Were you able to make any progress here? Thanks in advance. Best regards, Stefan Kangas From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Nov 2019 16:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: Lars Ingebrigtsen , 27952@debbugs.gnu.org, stefan monnier , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.15736643373674 (code B ref 27952); Wed, 13 Nov 2019 16:59:02 +0000 Received: (at 27952) by debbugs.gnu.org; 13 Nov 2019 16:58:57 +0000 Received: from localhost ([127.0.0.1]:60070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUvyr-0000xC-5p for submit@debbugs.gnu.org; Wed, 13 Nov 2019 11:58:57 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:37009) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iUvyo-0000wt-Bf for 27952@debbugs.gnu.org; Wed, 13 Nov 2019 11:58:55 -0500 Received: by mail-wr1-f48.google.com with SMTP id t1so3228269wrv.4 for <27952@debbugs.gnu.org>; Wed, 13 Nov 2019 08:58:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=iibRr6kFfw4qwpIbcPFF3tJ/3e0HYT1trTV91xtv1+s=; b=JezTfO3CJt25wJCn8sZRqGUE143Q/MIdT/r4Z8jaEunVqNehQXOzmt2PBDpe0Dj/e9 X0w+GKve3hi7GHpu9e5j8xWcj3vP3FaS1uNrCy/TvSd1Xr9dlQIf/Wr4VuOVPOmzI/N3 GzFgjrjNILkNJsxotv9hn9WhSqN4KR7+FspaKtz4JyZtC2vj5En4E78y+dMAMgLUa5qg dN8yUra6qCvsCZ0k7qX4ECJ95WMrND6nBTL89sfkBzAgiZfcgJkwLhhjXVB6j43dWsFK nkLKwGNqUgVs1Lwjxzh+2mutizGjaRml4QIHaaDH16T8KZh/iHqCfVaRwAzZF1bvJxSE 04QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=iibRr6kFfw4qwpIbcPFF3tJ/3e0HYT1trTV91xtv1+s=; b=Ye5vl7wPQTGL+8BYVycJFuVM19ga1PyMO0+SCuFrv8WeCXqjDO8hYWrc8T9nGTuavJ QmOnKaM22kzT9BhDKBlv3gAXXDoSnsuzB6BsFOugfuNfLb7vTnVlK2PqKHvLw5i3RyJe 6Be7A0vcTn9RhmKab0O1raCRjc3CRilUvY4FZ6hhLdFKnBqZWsyA71wBjcEueitHymMh FKkMQjcoawKkxghP4944Ewy6tFXzZ/HS0E00SeBNTLCEGcU4PXfAdZEfcWge7G4/4Me2 ly4zJHL2uCzMjqHVm3GTE68tzsn518uKBFgZ+c1XVMqPArTv4i/tW0hWhkUSQC6vT+fZ QWtA== X-Gm-Message-State: APjAAAWm4rK1IFp5lXC/NcScK6lMN8GV3Tw63jh//Yjna/ZKFAi2OMXk gb0qvd/AZzM7XN6ChmIHBuw= X-Google-Smtp-Source: APXvYqxhC/XIRQHpfeuoa8LfxT1rwpMi5jTTt2FFUxnPCB3UPZMobU7Wy4qtHRinM8Zb79OuP4LDQg== X-Received: by 2002:adf:dd12:: with SMTP id a18mr3787511wrm.123.1573664328417; Wed, 13 Nov 2019 08:58:48 -0800 (PST) Received: from calancha-pc.dy.bbexcite.jp ([2a02:8308:70c5:4d00:a2fc:1435:82df:8682]) by smtp.gmail.com with ESMTPSA id j11sm3397468wrq.26.2019.11.13.08.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2019 08:58:47 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Wed, 13 Nov 2019 17:58:45 +0100 (CET) X-X-Sender: calancha@calancha-pc.dy.bbexcite.jp In-Reply-To: <87h83bqfem.fsf@marxist.se> Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Mon, 11 Nov 2019, Stefan Kangas wrote: > Tino Calancha writes: > >> I will work on this again since next weekend and try to prepare the simples >> patch as possible. > > That was 19 weeks ago. Were you able to make any progress here? I a [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.48 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.48 listed in wl.mailspike.net] 1.4 MALFORMED_FREEMAIL Bad headers on message from free email service X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, 11 Nov 2019, Stefan Kangas wrote: > Tino Calancha writes: > >> I will work on this again since next weekend and try to prepare the simples >> patch as possible. > > That was 19 weeks ago. Were you able to make any progress here? I am in the process to 'recover' my copyright freedom; currently I can not submit any work > 15 lines. PD: After November 30th 2019 I will be back (as Terminator). From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 May 2020 11:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: Lars Ingebrigtsen , 27952@debbugs.gnu.org, stefan monnier Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.15885933583818 (code B ref 27952); Mon, 04 May 2020 11:56:01 +0000 Received: (at 27952) by debbugs.gnu.org; 4 May 2020 11:55:58 +0000 Received: from localhost ([127.0.0.1]:59183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVZhW-0000zW-88 for submit@debbugs.gnu.org; Mon, 04 May 2020 07:55:58 -0400 Received: from ted.gofardesign.uk ([67.225.143.91]:47406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVZhU-0000zG-Qn for 27952@debbugs.gnu.org; Mon, 04 May 2020 07:55:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cPWYJ1ds59ZTxABnUMdjVgXBa9/EPFfYMXHn1r1EeE8=; b=O+g3y/4M5KooOs/to+cSC3HWJl si+MF+uZvhYp04I9Wl/57h2cqLGq7q9A/NV49pHPcRREOtR4u53KibuVIX7lyCfSnFWudQNQN3q/u x+KeRHMm6V4HQrhaz7Z7GBRKXIPJG+gYX/bnWqUy+4qaWocB8e5/uhsi5c7fbYDjGlrtpBXB2uqu3 oux/NWE2TfxZ4M+n09aKH5KdUmJ0xdyDEo1k85fMYU+qicKVw/HXbAQuEKhk55Dm+Hk1N1aoXROFV pMjeWdWkAoLvQtf0G0vsNnhPSOIyDjgWthFOKsYt4fNeD1SNoeDcUM6F2FqkIJ1iHZ3SONowguB2Q i/6Yj3MQ==; Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:34764 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jVZhM-001eBU-H7; Mon, 04 May 2020 07:55:48 -0400 From: Stefan Kangas In-Reply-To: (Tino Calancha's message of "Wed, 13 Nov 2019 17:58:45 +0100 (CET)") References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Mon, 04 May 2020 13:55:46 +0200 Message-ID: <871rnzzzgd.fsf@stefankangas.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Tino Calancha writes: > On Mon, 11 Nov 2019, Stefan Kangas wrote: > >> Tino Calancha writes: >> >>> I will work on this again since next weekend and try to prepare the simples >>> patch as possible. >> >> That was 19 weeks ago. Were you able to make any progress here? > > I am in the process to 'recover' my copyright freedom; currently I can not > submit any work > 15 lines. Just another friendly ping, 6 months later. Please let us know if there has been any progress here. Thanks in advance. Best regards, Stefan Kangas From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 May 2020 19:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Kangas Cc: Lars Ingebrigtsen , 27952@debbugs.gnu.org, stefan monnier , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.158896761512801 (code B ref 27952); Fri, 08 May 2020 19:54:02 +0000 Received: (at 27952) by debbugs.gnu.org; 8 May 2020 19:53:35 +0000 Received: from localhost ([127.0.0.1]:46377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX93v-0003KO-4q for submit@debbugs.gnu.org; Fri, 08 May 2020 15:53:35 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:42303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX93s-0003K7-LH for 27952@debbugs.gnu.org; Fri, 08 May 2020 15:53:33 -0400 Received: by mail-wr1-f46.google.com with SMTP id s8so3283126wrt.9 for <27952@debbugs.gnu.org>; Fri, 08 May 2020 12:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=uVnK4mhY1Z20DOK6fzek64yhDqucJ46pBq+tC6uvEXk=; b=S9s1FsbhiCBBieOnyqN4D0OBpj/tZU/qqd2Rmirq/ZtRfB/gNPNJLHXKuSshDDwv26 z+ypu143DmfUu2eruLUS+BmVclE85TO1iDnV0cCkdl6M3BRBE0G7U9Af61/JCTODNVoF uvtmAgpoJSwifumqwfl0uObeg1C4X7gB+Xo99MkMa/oxiLVYtecvGsP0Y7Rvu88o/+8+ 7TphishpyizFkyeLxevOjM54dg6sJu+1voByjcDiqBGwfhwCAAJyqEnWXtVKw0358lcv n6lzQoU8Nz8muNCU7gBVSljHmRHKVV3mzMRJn84EF6QWDRja/4F0aUWiixU+3zwh8xjS 4OPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=uVnK4mhY1Z20DOK6fzek64yhDqucJ46pBq+tC6uvEXk=; b=XzE/6vd0v8GoI08uPWALb8l1Pi6nwWygs4JBiyvXZC5zr4TjarQ087n/+62eEegPyK bV54mSiBQPNh1xn3E1N49R1woPO3TkVjN+OncQDVuGfDdNqDqYj+llzP77d7F3iztUgD oiUaltlce1krfGPPkM6Fo1CdzIS7ttOPdpaBmx3jFGz3XiMCNDO/D2NEWllBSVPld3+6 5YZ947oZ91tj7tuczy0Tes0pauG5pyTxwSvPSTYAS2ZnYcYO/FvgxnS/LDySvQvQmQtf Gk1SiH1NVADu8EcnybNp+G5DYc1xKRWLczV7XUAnImyuiCZa5Vn0UJhKUs2Fnc3F4Baw Pw4w== X-Gm-Message-State: AGi0PuZS/p4+wlTteor3YT43H9iKSXKPGDHn3BZvBT0VIrSX3Ckml14R 4Sig5IxFuRsA41UknDDb2ds= X-Google-Smtp-Source: APiQypKjsbuS9QA6E6rGU/wLkOMkbL8NXaN/FgDJMIip/34CkIbEXyWDD4twf97TT7Ld3X10PN3Bvg== X-Received: by 2002:adf:f1c6:: with SMTP id z6mr4675124wro.361.1588967606460; Fri, 08 May 2020 12:53:26 -0700 (PDT) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id d1sm4149895wrx.65.2020.05.08.12.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 12:53:25 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 8 May 2020 21:53:24 +0200 (CEST) X-X-Sender: calancha@calancha-pc.dy.bbexcite.jp In-Reply-To: <871rnzzzgd.fsf@stefankangas.se> Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, 4 May 2020, Stefan Kangas wrote: > Just another friendly ping, 6 months later. Please let us know if > there has been any progress here. Thanks in advance. Thank you for the reminder! As I pointed out before, I wasn't really satisfied with my original patch; the one adding a function with > 1 arguments: too complex and I suspect failing side cases. Instead, I propose the following easy one: --8<-----------------------------cut here---------------start------------->8--- commit dc126c15c181afed9d236f4c1077e2c7f02b01df Author: Tino Calancha Date: Fri May 8 21:29:05 2020 +0200 Combine archive-int-to-mode and tar-grind-file-mode Add a new function, file-modes-number-to-symbolic. Make archive-int-to-mode and alias of it; use it to define tar-grind-file-mode (Bug#27952). * lisp/files.el (file-modes-number-to-symbolic): New defun. * lisp/arc-mode.el (archive-int-to-mode): Make it an alias. * lisp/tar-mode.el (tar-grind-file-mode): Use file-modes-number-to-symbolic. * test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode) * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): Update test. * test/lisp/files-tests.el (files-tests-file-modes-symbolic-to-number) (files-tests-file-modes-number-to-symbolic): New tests. * doc/lispref/files.texi (Changing Files): Document the new funtion. * etc/NEWS (Lisp Changes in Emacs 28.1): Announce it. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index b3ad9b9964..686dbdb1ca 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1909,6 +1909,11 @@ Changing Files all. @end defun +@defun file-modes-number-to-symbolic modes +This function converts a numeric file mode specification in +@var{modes} into the equivalent symbolic form. +@end defun + @defun set-file-times filename &optional time flag This function sets the access and modification times of @var{filename} to @var{time}. The return value is @code{t} if the times are successfully diff --git a/etc/NEWS b/etc/NEWS index ac93a76ff9..26426fc42b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -372,6 +372,10 @@ Use macro 'with-current-buffer-window' with action alist entry 'body-function'. * Lisp Changes in Emacs 28.1 ++++ +** New function 'file-modes-number-to-symbolic' to convert a numeric +file mode specification into symbolic form. + ** New macro 'dlet' to dynamically bind variables. ** The variable 'force-new-style-backquotes' has been removed. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index c918f06c80..0c801c67a5 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -563,28 +563,7 @@ archive-l-e (aref str (- len i))))) result)) -(defun archive-int-to-mode (mode) - "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------." - ;; FIXME: merge with tar-grind-file-mode. - (if (null mode) - "??????????" - (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (if (zerop (logand 64 mode)) - (if (zerop (logand 2048 mode)) ?- ?S) - (if (zerop (logand 2048 mode)) ?x ?s)) - (if (zerop (logand 32 mode)) ?- ?r) - (if (zerop (logand 16 mode)) ?- ?w) - (if (zerop (logand 8 mode)) - (if (zerop (logand 1024 mode)) ?- ?S) - (if (zerop (logand 1024 mode)) ?x ?s)) - (if (zerop (logand 4 mode)) ?- ?r) - (if (zerop (logand 2 mode)) ?- ?w) - (if (zerop (logand 1 mode)) ?- ?x)))) +(defalias 'archive-int-to-mode 'file-modes-number-to-symbolic) (defun archive-calc-mode (oldmode newmode) "From the integer OLDMODE and the string NEWMODE calculate a new file mode. diff --git a/lisp/files.el b/lisp/files.el index c34fe00388..dba704f7a4 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7552,6 +7552,27 @@ file-modes-rights-to-number op char-right))) num-rights)) +(defun file-modes-number-to-symbolic (mode) + (string + (if (zerop (logand 8192 mode)) + (if (zerop (logand 16384 mode)) ?- ?d) + ?c) ; completeness + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 512 mode)) + (if (zerop (logand 1 mode)) ?- ?x) + (if (zerop (logand 1 mode)) ?T ?t)))) + (defun file-modes-symbolic-to-number (modes &optional from) "Convert symbolic file modes to numeric file modes. MODES is the string to convert, it should match diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index a3c1715b1e..73978ffc4a 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -480,23 +480,9 @@ tar-clip-time-string (defun tar-grind-file-mode (mode) "Construct a `rw-r--r--' string indicating MODE. -MODE should be an integer which is a file mode value." - (string - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (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 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 512 mode)) - (if (zerop (logand 1 mode)) ?- ?x) - (if (zerop (logand 1 mode)) ?T ?t)))) +MODE should be an integer which is a file mode value. +For instance, if mode is #o700, then it produces `rwx------'." + (substring (file-modes-number-to-symbolic mode) 1)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) "Return a line similar to the output of `tar -vtf'." diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el index df658b9813..22ca7e2ec5 100644 --- a/test/lisp/arc-mode-tests.el +++ b/test/lisp/arc-mode-tests.el @@ -28,7 +28,7 @@ arc-mode-tests-data-directory (let ((alist (list (cons 448 "-rwx------") (cons 420 "-rw-r--r--") (cons 292 "-r--r--r--") - (cons 512 "----------") + (cons 512 "---------T") (cons 1024 "------S---") ; Bug#28092 (cons 2048 "---S------")))) (dolist (x alist) diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 05d9ceebf1..4b902fd82a 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1164,6 +1164,42 @@ files-tests-file-attributes-equal (should-not (make-directory a/b t)) (delete-directory dir 'recursive))) +(ert-deftest files-tests-file-modes-symbolic-to-number () + (let ((alist (list (cons "a=rwx" #o777) + (cons "o=t" #o1000) + (cons "o=xt" #o1001) + (cons "o=tx" #o1001) ; Order doesn't matter. + (cons "u=rwx,g=rx,o=rx" #o755) + (cons "u=rwx,g=,o=" #o700) + (cons "u=rwx" #o700) ; Empty permissions can be ignored. + (cons "u=rw,g=r,o=r" #o644) + (cons "u=rw,g=r,o=t" #o1640) + (cons "u=rw,g=r,o=xt" #o1641) + (cons "u=rwxs,g=rs,o=xt" #o7741) + (cons "u=rws,g=rs,o=t" #o7640) + (cons "u=rws,g=rs,o=r" #o6644) + (cons "a=r" #o444) + (cons "u=S" nil) + (cons "u=T" nil) + (cons "u=Z" nil)))) + (dolist (x alist) + (if (cdr-safe x) + (should (equal (cdr x) (file-modes-symbolic-to-number (car x)))) + (should-error (file-modes-symbolic-to-number (car x))))))) + +(ert-deftest files-tests-file-modes-number-to-symbolic () + (let ((alist (list (cons #o755 "-rwxr-xr-x") + (cons #o700 "-rwx------") + (cons #o644 "-rw-r--r--") + (cons #o1640 "-rw-r----T") + (cons #o1641 "-rw-r----t") + (cons #o7741 "-rwsr-S--t") + (cons #o7640 "-rwSr-S--T") + (cons #o6644 "-rwSr-Sr--") + (cons #o444 "-r--r--r--")))) + (dolist (x alist) + (should (equal (cdr x) (file-modes-number-to-symbolic (car x))))))) + (ert-deftest files-tests-no-file-write-contents () "Test that `write-contents-functions' permits saving a file. Usually `basic-save-buffer' will prompt for a file name if the diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el index bc41b863da..f05389df60 100644 --- a/test/lisp/tar-mode-tests.el +++ b/test/lisp/tar-mode-tests.el @@ -29,7 +29,8 @@ tar-mode-tests-data-directory (cons 420 "rw-r--r--") (cons 292 "r--r--r--") (cons 512 "--------T") - (cons 1024 "-----S---")))) + (cons 1024 "-----S---") + (cons 2048 "--S------")))) (dolist (x alist) (should (equal (cdr x) (tar-grind-file-mode (car x))))))) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-05-08 built on calancha-pc.dy.bbexcite.jp Repository revision: 4b8e6939bf7664fda33a7aaa03d2d8069358ff7b Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 May 2020 20:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 27952@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Kangas Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.158896839822128 (code B ref 27952); Fri, 08 May 2020 20:07:01 +0000 Received: (at 27952) by debbugs.gnu.org; 8 May 2020 20:06:38 +0000 Received: from localhost ([127.0.0.1]:46392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX9GY-0005kq-He for submit@debbugs.gnu.org; Fri, 08 May 2020 16:06:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX9GV-0005kY-Ut for 27952@debbugs.gnu.org; Fri, 08 May 2020 16:06:36 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6CBF7450AD7; Fri, 8 May 2020 16:06:30 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EEC85450AD4; Fri, 8 May 2020 16:06:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1588968388; bh=ja97boTAacq3jriGY9/pj/Guiliw2wmHdJY+96AUqAk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=YJiebz6Si/NKM9sir3iXIPfnp9RTEVWLZNGvL0Sq9365yky/sQVrewym37nJ3fyoK BHH8Zn+GueC4TfQpCGpQ1YV3JAve2sdccnMPdgb3fxfBRzpnBrpnoDpBesken8OMAd oGYGwXNVdv9PFyYw+qG/Ka2iHB5d+ON9a8GT9WhvXUtQsHYZPDPxAT6Z3kF7SXnPx3 XqEaKfjdtkJZ1zuMEkxyLHLehoVy8mHTXC+UsW01tCAnmXILUt6UGRXIYpceErH2uZ mEdZn9NbmXg2WrrUFaoEeKsH15EHlrF53anVLQaTraSK0VtcZdmPu1Wv8bnn3FnJe/ aCAwRj+TxgJjQ== Received: from alfajor (unknown [216.154.3.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 85683120735; Fri, 8 May 2020 16:06:28 -0400 (EDT) From: Stefan Monnier Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> Date: Fri, 08 May 2020 16:06:27 -0400 In-Reply-To: (Tino Calancha's message of "Fri, 8 May 2020 21:53:24 +0200 (CEST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.078 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > +(defalias 'archive-int-to-mode 'file-modes-number-to-symbolic) Make it a `define-obsolete-function-alias`. > (defun tar-grind-file-mode (mode) > "Construct a `rw-r--r--' string indicating MODE. [...] > +MODE should be an integer which is a file mode value. > +For instance, if mode is #o700, then it produces `rwx------'." > + (substring (file-modes-number-to-symbolic mode) 1)) LGTM. A second step might be to mark this function as obsolete and update all the call sites so they are happy with the output format of `file-modes-number-to-symbolic`. Stefan From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 May 2020 20:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 27952@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Kangas , Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.158896922623447 (code B ref 27952); Fri, 08 May 2020 20:21:02 +0000 Received: (at 27952) by debbugs.gnu.org; 8 May 2020 20:20:26 +0000 Received: from localhost ([127.0.0.1]:46401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX9Tu-000666-1a for submit@debbugs.gnu.org; Fri, 08 May 2020 16:20:26 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:40006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX9Tr-00065q-VI for 27952@debbugs.gnu.org; Fri, 08 May 2020 16:20:24 -0400 Received: by mail-wm1-f42.google.com with SMTP id u16so11991943wmc.5 for <27952@debbugs.gnu.org>; Fri, 08 May 2020 13:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=s7aVXq2YDJyxLOBsnXbz7E33cV5buWcV5RQG4Ylz7mY=; b=P/+a4dsQQ4o6wn2NdgPIruOTVCS7NGzl+xyxVAsJy3st/0h8E5udCkxFjGYAUjqpbO oOo06q5aJewiYnGTqEnn99+purdU3Jt8SHHvGNMtVhtue0hQL5FzsuAXZ0aaiELuUNDw aIEavljyoQ+e70zfKR0t8kRh76DdBJstMz9+IctskhEyWtwJD/Ug05Ot9NAxmyOxzSh+ vhba/93AIQnUkx3aUp6SKNgVSImZShnCagWIyRT22PKzAYYCu+kpCVt3laQkw72ZC7kR G1mFWgVj5GI2tQPuTxK78iBptK2g0PoZdjEvD13n3KNtW6kSD4Dr14R5xcDxzKP/hm1E enig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=s7aVXq2YDJyxLOBsnXbz7E33cV5buWcV5RQG4Ylz7mY=; b=oArIsiWWxiLU/fDU+ADMsM7CLVHxG+bMo7Z1SRW3teBi/OcVyG7HujIaoWbwtx3KKt mz6lU5l295MJrT+6zOaJn5lFrRp8RTa0bm/3SjA3cIyh/aikO5u4AxqWy2Tw26CF4mYk f2ZRsxHxJ0AKzfSmV2YqdD+LcCk9+fPkVX4XZlEw/xGSNsVvas3g554/XIeTF6WapcmW 3xhtGTr097rSsQim5A/t3qoTweYgyKd0ffaJ/dfBovDcOpXqp0KX2mYg+JhaIoAw4IBO NjGBDs/Wqcz5LqLF59M2ATEEmY5GKVUP1nzt/Db+JpflRAxCbbLHLPSOinMbZAqZUA86 fgJw== X-Gm-Message-State: AGi0PuamdzAxSviVtyChhR1FyReGVUDNa7jlEwoOGrPmW1W+ckrCko42 n8Hib6bFpTB6BTPm75Hqxa0= X-Google-Smtp-Source: APiQypJc4D/7MkEryNP50XGKspjoYTrfpBRWzmS4QSEH6WMhEaC09yip40j6nl9eoTaETxOol/UH8g== X-Received: by 2002:a05:600c:230f:: with SMTP id 15mr14922513wmo.101.1588969217863; Fri, 08 May 2020 13:20:17 -0700 (PDT) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id q2sm3034443wrx.60.2020.05.08.13.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 13:20:17 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 8 May 2020 22:20:15 +0200 (CEST) X-X-Sender: calancha@calancha-pc.dy.bbexcite.jp In-Reply-To: Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Fri, 8 May 2020, Stefan Monnier wrote: >> +(defalias 'archive-int-to-mode 'file-modes-number-to-symbolic) > > Make it a `define-obsolete-function-alias`. OK. >> (defun tar-grind-file-mode (mode) >> "Construct a `rw-r--r--' string indicating MODE. > [...] >> +MODE should be an integer which is a file mode value. >> +For instance, if mode is #o700, then it produces `rwx------'." >> + (substring (file-modes-number-to-symbolic mode) 1)) > > LGTM. Good. Then, I will merge it next week. > A second step might be to mark this function as obsolete and > update all the call sites so they are happy with the output format of > `file-modes-number-to-symbolic`. It sounds good; it's funny having those 2 defun with almost identical output. Maybe you can add a TODO in the code asking for this; people feel encouraged to contribute when they found those FIXME/TODOs. Amended patch follows: --8<-----------------------------cut here---------------start------------->8--- commit 043ecae1c0828bcad94083ef456195ae21675a1a Author: Tino Calancha Date: Fri May 8 22:14:03 2020 +0200 Combine archive-int-to-mode and tar-grind-file-mode Add a new function, file-modes-number-to-symbolic. Make archive-int-to-mode and obsolete alias of it; use it to define tar-grind-file-mode (Bug#27952). * lisp/files.el (file-modes-number-to-symbolic): New defun. * lisp/arc-mode.el (archive-int-to-mode): Make it an obsolete alias. * lisp/tar-mode.el (tar-grind-file-mode): Use file-modes-number-to-symbolic. * test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode) * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): Update test. * test/lisp/files-tests.el (files-tests-file-modes-symbolic-to-number) (files-tests-file-modes-number-to-symbolic): New tests. * doc/lispref/files.texi (Changing Files): Document the new funtion. * etc/NEWS (Lisp Changes in Emacs 28.1): Announce it. diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index b3ad9b9964..686dbdb1ca 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1909,6 +1909,11 @@ Changing Files all. @end defun +@defun file-modes-number-to-symbolic modes +This function converts a numeric file mode specification in +@var{modes} into the equivalent symbolic form. +@end defun + @defun set-file-times filename &optional time flag This function sets the access and modification times of @var{filename} to @var{time}. The return value is @code{t} if the times are successfully diff --git a/etc/NEWS b/etc/NEWS index ac93a76ff9..26426fc42b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -372,6 +372,10 @@ Use macro 'with-current-buffer-window' with action alist entry 'body-function'. * Lisp Changes in Emacs 28.1 ++++ +** New function 'file-modes-number-to-symbolic' to convert a numeric +file mode specification into symbolic form. + ** New macro 'dlet' to dynamically bind variables. ** The variable 'force-new-style-backquotes' has been removed. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index c918f06c80..6ce64fe24b 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -563,28 +563,8 @@ archive-l-e (aref str (- len i))))) result)) -(defun archive-int-to-mode (mode) - "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------." - ;; FIXME: merge with tar-grind-file-mode. - (if (null mode) - "??????????" - (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (if (zerop (logand 64 mode)) - (if (zerop (logand 2048 mode)) ?- ?S) - (if (zerop (logand 2048 mode)) ?x ?s)) - (if (zerop (logand 32 mode)) ?- ?r) - (if (zerop (logand 16 mode)) ?- ?w) - (if (zerop (logand 8 mode)) - (if (zerop (logand 1024 mode)) ?- ?S) - (if (zerop (logand 1024 mode)) ?x ?s)) - (if (zerop (logand 4 mode)) ?- ?r) - (if (zerop (logand 2 mode)) ?- ?w) - (if (zerop (logand 1 mode)) ?- ?x)))) +(define-obsolete-function-alias 'archive-int-to-mode + 'file-modes-number-to-symbolic "28.1") (defun archive-calc-mode (oldmode newmode) "From the integer OLDMODE and the string NEWMODE calculate a new file mode. diff --git a/lisp/files.el b/lisp/files.el index c34fe00388..dba704f7a4 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7552,6 +7552,27 @@ file-modes-rights-to-number op char-right))) num-rights)) +(defun file-modes-number-to-symbolic (mode) + (string + (if (zerop (logand 8192 mode)) + (if (zerop (logand 16384 mode)) ?- ?d) + ?c) ; completeness + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 512 mode)) + (if (zerop (logand 1 mode)) ?- ?x) + (if (zerop (logand 1 mode)) ?T ?t)))) + (defun file-modes-symbolic-to-number (modes &optional from) "Convert symbolic file modes to numeric file modes. MODES is the string to convert, it should match diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index a3c1715b1e..73978ffc4a 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -480,23 +480,9 @@ tar-clip-time-string (defun tar-grind-file-mode (mode) "Construct a `rw-r--r--' string indicating MODE. -MODE should be an integer which is a file mode value." - (string - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (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 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 512 mode)) - (if (zerop (logand 1 mode)) ?- ?x) - (if (zerop (logand 1 mode)) ?T ?t)))) +MODE should be an integer which is a file mode value. +For instance, if mode is #o700, then it produces `rwx------'." + (substring (file-modes-number-to-symbolic mode) 1)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) "Return a line similar to the output of `tar -vtf'." diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el index df658b9813..22ca7e2ec5 100644 --- a/test/lisp/arc-mode-tests.el +++ b/test/lisp/arc-mode-tests.el @@ -28,7 +28,7 @@ arc-mode-tests-data-directory (let ((alist (list (cons 448 "-rwx------") (cons 420 "-rw-r--r--") (cons 292 "-r--r--r--") - (cons 512 "----------") + (cons 512 "---------T") (cons 1024 "------S---") ; Bug#28092 (cons 2048 "---S------")))) (dolist (x alist) diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 05d9ceebf1..4b902fd82a 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1164,6 +1164,42 @@ files-tests-file-attributes-equal (should-not (make-directory a/b t)) (delete-directory dir 'recursive))) +(ert-deftest files-tests-file-modes-symbolic-to-number () + (let ((alist (list (cons "a=rwx" #o777) + (cons "o=t" #o1000) + (cons "o=xt" #o1001) + (cons "o=tx" #o1001) ; Order doesn't matter. + (cons "u=rwx,g=rx,o=rx" #o755) + (cons "u=rwx,g=,o=" #o700) + (cons "u=rwx" #o700) ; Empty permissions can be ignored. + (cons "u=rw,g=r,o=r" #o644) + (cons "u=rw,g=r,o=t" #o1640) + (cons "u=rw,g=r,o=xt" #o1641) + (cons "u=rwxs,g=rs,o=xt" #o7741) + (cons "u=rws,g=rs,o=t" #o7640) + (cons "u=rws,g=rs,o=r" #o6644) + (cons "a=r" #o444) + (cons "u=S" nil) + (cons "u=T" nil) + (cons "u=Z" nil)))) + (dolist (x alist) + (if (cdr-safe x) + (should (equal (cdr x) (file-modes-symbolic-to-number (car x)))) + (should-error (file-modes-symbolic-to-number (car x))))))) + +(ert-deftest files-tests-file-modes-number-to-symbolic () + (let ((alist (list (cons #o755 "-rwxr-xr-x") + (cons #o700 "-rwx------") + (cons #o644 "-rw-r--r--") + (cons #o1640 "-rw-r----T") + (cons #o1641 "-rw-r----t") + (cons #o7741 "-rwsr-S--t") + (cons #o7640 "-rwSr-S--T") + (cons #o6644 "-rwSr-Sr--") + (cons #o444 "-r--r--r--")))) + (dolist (x alist) + (should (equal (cdr x) (file-modes-number-to-symbolic (car x))))))) + (ert-deftest files-tests-no-file-write-contents () "Test that `write-contents-functions' permits saving a file. Usually `basic-save-buffer' will prompt for a file name if the diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el index bc41b863da..f05389df60 100644 --- a/test/lisp/tar-mode-tests.el +++ b/test/lisp/tar-mode-tests.el @@ -29,7 +29,8 @@ tar-mode-tests-data-directory (cons 420 "rw-r--r--") (cons 292 "r--r--r--") (cons 512 "--------T") - (cons 1024 "-----S---")))) + (cons 1024 "-----S---") + (cons 2048 "--S------")))) (dolist (x alist) (should (equal (cdr x) (tar-grind-file-mode (car x))))))) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-05-08 built on calancha-pc.dy.bbexcite.jp Repository revision: 4b8e6939bf7664fda33a7aaa03d2d8069358ff7b Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) From unknown Fri Sep 05 20:55:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#27952: closed (Re: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode) Message-ID: References: <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> <8760e3zf6v.fsf@calancha-pc> X-Gnu-PR-Message: they-closed 27952 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 27952@debbugs.gnu.org Date: Thu, 14 May 2020 16:48:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1589474882-4135-1" This is a multi-part message in MIME format... ------------=_1589474882-4135-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode 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 27952@debbugs.gnu.org. --=20 27952: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27952 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1589474882-4135-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 27952-done) by debbugs.gnu.org; 14 May 2020 16:47:54 +0000 Received: from localhost ([127.0.0.1]:34605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZH1W-00014M-7F for submit@debbugs.gnu.org; Thu, 14 May 2020 12:47:54 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:36150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZH1U-000144-Eg for 27952-done@debbugs.gnu.org; Thu, 14 May 2020 12:47:53 -0400 Received: by mail-lj1-f176.google.com with SMTP id u15so4303672ljd.3 for <27952-done@debbugs.gnu.org>; Thu, 14 May 2020 09:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=NHIephWa5s4QGYHn//Gc3XJtVBP8+LE5xHXkYgYB7Lc=; b=eDnt0fhSYeFW42ay+kiHXPqanA4RcHfr1Of8h9xWdgmH/cxuTAMklcbjqwvBt916rq 9UsT6qyBxXkGI46hwyqaTN1u0qz/Yibf7phI1K8PPq+phmIV5YkKOndVRgb/tRhShz6d ThZu874ydbz4hA6Dm4ehh2XIUiZe9CRGgTzrnh09C5Craj0INZj3Z0fDhbhyYeTY4lOy LZy5aMMQxeHKTlYiWxMnLQMkLYYG2uIRWQC1cDOzqX6khy3OJiQWiAvA3f3yvhEqVHtT rcd5ZgbanmzkrL8kpTf7/FESrXaUhymLF5bXgkeDW0dhQE5nnuNkyw2sE/AIDtOA/d44 0MMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NHIephWa5s4QGYHn//Gc3XJtVBP8+LE5xHXkYgYB7Lc=; b=mZJ6VAlKo1eFRO5o2LP8ppjIUZcf8U2O2p2PrmblIBN+LxJeX2qW5oJ219K+l75CVr U/GfXov0dZjRlIe6cG0XmqKOC1SNrbwVuMUrsXf7DmvUIGUghKx3O9xGgYv91Hps63iA z8/ed2ECbZ0BiTkMgNlbk1Yo5JsQajXBg2bMPZiFvBB4Ayzv7HttZ4BGoaXMkGP+Vy+Q LLoQuVLU1yA86NeUmZlXVSTmTXLc6xGaWwRgOCmEq+XuHBNFR9u7O+zrcpaD+OGBugb6 9JTk1arX39P1WskvXMrxFm5pUA5ul7F+jbgfV+UR1Mos5SFrjpuqHtS6TzgQOFXvkUiP L+Nw== X-Gm-Message-State: AOAM5334OCJFijtg823F92B2tlRA7p0LOapNvmDqKG+qhEEwgBW40ABr wTBBl9+kAttRe6f3YIiCypClBw6HqbI= X-Google-Smtp-Source: ABdhPJyfSSB5nfnxNCSNFDTowskpdrRa57Mi9JXhbFdwax6kdQ3gd5rG6VPHy6zAj0Chym2H8+trzg== X-Received: by 2002:a2e:a40b:: with SMTP id p11mr3236927ljn.148.1589474866039; Thu, 14 May 2020 09:47:46 -0700 (PDT) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id m10sm1288115lfd.15.2020.05.14.09.47.42 for <27952-done@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 09:47:43 -0700 (PDT) From: Tino Calancha To: 27952-done@debbugs.gnu.org Subject: Re: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> Date: Thu, 14 May 2020 18:47:34 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 08 May 2020 16:06:27 -0400") Message-ID: <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 27952-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: > LGTM. Fixed in master branch as commit 'Combine archive-int-to-mode and tar-grind-file-mode' (3a284e578625e617fdc6085ae11da2b4e41bb59b) ------------=_1589474882-4135-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Aug 2017 13:54:01 +0000 Received: from localhost ([127.0.0.1]:41156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddd3B-0001CU-40 for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:54:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddd39-0001CJ-7i for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:54:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddd20-0006NT-6J for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:53:54 -0400 Received: from lists.gnu.org ([2001:4830:134:3::11]:59291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ddd1z-0006M5-Kd for submit@debbugs.gnu.org; Fri, 04 Aug 2017 09:52:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddd11-0000QN-0v for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 09:52:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddbmJ-0007GF-CV for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 08:33:40 -0400 Received: from mail-pg0-x231.google.com ([2607:f8b0:400e:c05::231]:38619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddbmJ-0007F5-0L for bug-gnu-emacs@gnu.org; Fri, 04 Aug 2017 08:32:31 -0400 Received: by mail-pg0-x231.google.com with SMTP id l64so7497711pge.5 for ; Fri, 04 Aug 2017 05:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=V2tSIRjz35gWamMP95JyYDFzviTCJ4od/vaKrX8/Xe4=; b=jpKtgRMOQZoCXhiqVdqHAw91MjtnYq0ubAkfPsFGtUGovDMmnz3GwLayhPjkyzLnSI XtXZ6DYdutLP8qQv3AjSz+eVwk58V+DL83hU+Gg2aoYZg5uMSUAWAA0du2G0YoT52MX5 ursgxqhinn2BQQWFiLgbk4H8OYp5fNvRbdvOnn7WZa/QJaamGaNBcGiH7Rvf291GFZNS YaFbqZA+HMQsk9Iuxmd0IvD1EIp8i/wy4lnKgIDKwVjZX6gC7smxrMKdIHKC3cd59BmK COx/6OYlN6UKEsQZglhLecXYsaXI+9kChfOxNDdWW19Lk6mVXPXSjN68GKyKywkbWQHy jnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=V2tSIRjz35gWamMP95JyYDFzviTCJ4od/vaKrX8/Xe4=; b=EzETkbTdZyzIkt9q6tLyhzm+UMiN7THCVFWiFvGSd2BBd4HlTQlLzvppMPGPVEQ0jl GxBUrnpN6MwWvob+oAnnBJ3M66p8Wpq8WunO6qIuxwqDG09whjXsDHlERSge0Xb5YVRD Oag6sUzITG81IgdkDhmJdf1qD6K2yqtweuuf0IB7nowSuc3dyV8lwgkqdMITKS6pwn5n +KRL5ZJbCy88q+d/oIv4EjKfhdtoXPINnIMbxAjncYUaj9WvNlmiu2cUWpdZOWJmNxUx 9IkkK+jIxbeZHVuZOInyBw0fJdtzrNxqDV8W8xmkmTyuh4R8nkjj8xZnOHIqJwfKTtB0 zaxw== X-Gm-Message-State: AIVw1136nKbdMgW21TfCboyJzwtx2LmKCzMmmUeNvZUwb1R220hbZi+Y Lqxs4rG5Jqz49xDQ X-Received: by 10.84.241.76 with SMTP id u12mr2631863plm.196.1501849949696; Fri, 04 Aug 2017 05:32:29 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id f88sm3354579pff.74.2017.08.04.05.32.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Aug 2017 05:32:29 -0700 (PDT) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Date: Fri, 04 Aug 2017 21:32:24 +0900 Message-ID: <8760e3zf6v.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Severity: wishlist Tag: patch X-Debbugs-CC: Stefan Monnier These functions are almost identical; archive-int-to-mode has a FIXME suggesting merging it with tar-grind-file-mode. --8<-----------------------------cut here---------------start------------->8--- commit c6d36b04de7f6442653af7e4699bdad44ee57201 Author: Tino Calancha Date: Fri Aug 4 21:25:44 2017 +0900 Combine archive-int-to-mode and tar-grind-file-mode These functions are almost identical. Add a new function file-modes-number-to-symbolic; use it to define the other two. * lisp/files.el (file-modes-number-to-symbolic-1) (file-modes-number-to-symbolic): New defuns. * lisp/arc-mode.el (archive-int-to-mode): Define as a alias of file-modes-number-to-symbolic. * lisp/tar-mode.el (tar-grind-file-mode): Fix docstring. Use file-modes-number-to-symbolic. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index bd7548b704..8f3691b337 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -549,26 +549,7 @@ archive-l-e (aref str (- len i))))) result)) -(defun archive-int-to-mode (mode) - "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------." - ;; FIXME: merge with tar-grind-file-mode. - (string - (if (zerop (logand 8192 mode)) - (if (zerop (logand 16384 mode)) ?- ?d) - ?c) ; completeness - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (if (zerop (logand 64 mode)) - (if (zerop (logand 1024 mode)) ?- ?S) - (if (zerop (logand 1024 mode)) ?x ?s)) - (if (zerop (logand 32 mode)) ?- ?r) - (if (zerop (logand 16 mode)) ?- ?w) - (if (zerop (logand 8 mode)) - (if (zerop (logand 2048 mode)) ?- ?S) - (if (zerop (logand 2048 mode)) ?x ?s)) - (if (zerop (logand 4 mode)) ?- ?r) - (if (zerop (logand 2 mode)) ?- ?w) - (if (zerop (logand 1 mode)) ?- ?x))) +(defalias 'archive-int-to-mode 'file-modes-number-to-symbolic) (defun archive-calc-mode (oldmode newmode &optional error) "From the integer OLDMODE and the string NEWMODE calculate a new file mode. diff --git a/lisp/files.el b/lisp/files.el index 89f6f9f44d..e776b00b91 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7188,6 +7188,65 @@ file-modes-symbolic-to-number (error "Parse error in modes near `%s'" (substring modes 0)))) num-modes))) +(defun file-modes-number-to-symbolic-1 (mode) + (string + (if (zerop (logand 8192 mode)) + (if (zerop (logand 16384 mode)) ?- ?d) + ?c) ; completeness + (if (zerop (logand 256 mode)) ?- ?r) + (if (zerop (logand 128 mode)) ?- ?w) + (if (zerop (logand 64 mode)) + (if (zerop (logand 1024 mode)) ?- ?S) + (if (zerop (logand 1024 mode)) ?x ?s)) + (if (zerop (logand 32 mode)) ?- ?r) + (if (zerop (logand 16 mode)) ?- ?w) + (if (zerop (logand 8 mode)) + (if (zerop (logand 2048 mode)) ?- ?S) + (if (zerop (logand 2048 mode)) ?x ?s)) + (if (zerop (logand 4 mode)) ?- ?r) + (if (zerop (logand 2 mode)) ?- ?w) + (if (zerop (logand 1 mode)) ?- ?x))) + +(defun file-modes-number-to-symbolic (mode &optional detailed from) + "Turn an integer like 0700 (i.e., 448) into a mode string like -rwx------. +If optional arg DETAILED is non-nil, then use the format 'u=rwx,g=,o='. +If optional argument FROM is non-nil, then it's the original file mode + to compare with MODE. FROM is ignored unless DETAILED is non-nil. + +For instance, if MODE is 448, DETAILED is non-nil, and FROM is 400, +the output is 'u+x,g-w'." + (let ((mode (file-modes-number-to-symbolic-1 mode)) + (from (and from (substring (file-modes-number-to-symbolic-1 from) 1)))) + (if (not detailed) + mode + (setq mode (substring mode 1)) + (cond (from + (let ((res "u")) + (dotimes (i (length mode)) + (let ((x (aref mode i)) + (y (aref from i))) + (when (= i 3) (setq res (concat res ",g"))) + (when (= i 6) (setq res (concat res ",o"))) + (setq res (concat res + (cond ((eq x y) "") + ((eq x ?-) (string ?- y)) + ((eq y ?-) (string ?+ x))))))) + (replace-regexp-in-string + ",\\'" "" + (replace-regexp-in-string + "u," "" + (replace-regexp-in-string + "g," "" + (replace-regexp-in-string + "o\\'" "" res)))))) + (t + (replace-regexp-in-string + "-" "" + (format "u=%s,g=%s,o=%s" + (substring mode 0 3) + (substring mode 3 6) + (substring mode 6)))))))) + (defun read-file-modes (&optional prompt orig-file) "Read file modes in octal or symbolic notation and return its numeric value. PROMPT is used as the prompt, default to \"File modes (octal or symbolic): \". diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 1d453d2980..f41cc25532 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -469,24 +469,12 @@ tar-clip-time-string (concat " " (substring str 4 16) (format-time-string " %Y" time)))) (defun tar-grind-file-mode (mode) - "Construct a `-rw--r--r--' string indicating MODE. + "Construct a `rw-r--r--' string indicating MODE. MODE should be an integer which is a file mode value." - (string - (if (zerop (logand 256 mode)) ?- ?r) - (if (zerop (logand 128 mode)) ?- ?w) - (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 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 512 mode)) - (if (zerop (logand 1 mode)) ?- ?x) - (if (zerop (logand 1 mode)) ?T ?t)))) + (let ((str (substring (file-modes-number-to-symbolic mode) 1))) + (unless (zerop (logand 512 mode)) + (aset mode 8 (if (zerop (logand 1 mode)) ?T ?t))) + str)) (defun tar-header-block-summarize (tar-hblock &optional mod-p) "Return a line similar to the output of `tar -vtf'." --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-08-04 Repository revision: db5d38ddb0de83d8f920b7a128fe3fd5156fdf85 ------------=_1589474882-4135-1-- From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 27952@debbugs.gnu.org Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.15894770428242 (code B ref 27952); Thu, 14 May 2020 17:25:01 +0000 Received: (at 27952) by debbugs.gnu.org; 14 May 2020 17:24:02 +0000 Received: from localhost ([127.0.0.1]:34686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHaT-00028j-Ns for submit@debbugs.gnu.org; Thu, 14 May 2020 13:24:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZHaS-00028P-Pg for 27952@debbugs.gnu.org; Thu, 14 May 2020 13:24:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38365) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZHaJ-0004JX-SS; Thu, 14 May 2020 13:23:55 -0400 Received: from [176.228.60.248] (port=3233 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jZHaG-00060a-7T; Thu, 14 May 2020 13:23:48 -0400 Date: Thu, 14 May 2020 20:23:34 +0300 Message-Id: <83y2pu4ei1.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> (message from Tino Calancha on Thu, 14 May 2020 18:47:34 +0200) References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Tino Calancha > Date: Thu, 14 May 2020 18:47:34 +0200 > > Stefan Monnier writes: > > > LGTM. > > Fixed in master branch as commit > 'Combine archive-int-to-mode and tar-grind-file-mode' > (3a284e578625e617fdc6085ae11da2b4e41bb59b) The fix triggers compilation warnings: In archive--summarize-descs: arc-mode.el:1509:45: Warning: `archive-int-to-mode' is an obsolete function (as of 28.1); use `file-modes-number-to-symbolic' instead. arc-mode.el:1574:70: Warning: `archive-int-to-mode' is an obsolete function (as of 28.1); use `file-modes-number-to-symbolic' instead. Would it be possible to eliminate these warnings, please? Thanks. From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 20:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 27952@debbugs.gnu.org, Tino Calancha Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.158948692612128 (code B ref 27952); Thu, 14 May 2020 20:09:02 +0000 Received: (at 27952) by debbugs.gnu.org; 14 May 2020 20:08:46 +0000 Received: from localhost ([127.0.0.1]:34977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZK9t-00039X-Tw for submit@debbugs.gnu.org; Thu, 14 May 2020 16:08:46 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:40816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZK9s-00039G-An for 27952@debbugs.gnu.org; Thu, 14 May 2020 16:08:44 -0400 Received: by mail-wm1-f47.google.com with SMTP id u16so34601088wmc.5 for <27952@debbugs.gnu.org>; Thu, 14 May 2020 13:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=HBULydA0iouTHMlJ/yNjByoniWSKmqzTYSA9Hg5GAjk=; b=vHYRwxJJqUFAYvTv+oQe4N2R/KueFmz5Tcpdx5hqhTe9rbezN+1MJWZw679eywM11U OS39f5N6xm7ekplyts25srsuL9fEfz0gzN67Y8Vn8x8cmi9NBkjotmO+gwsPg9JyEeGt j3v5LTCkOapqDELu8zEkGPQJd50VV5Y6OV43IcjLIHn8dMtv3D2y4JLtmH0p/drvkQ3L x6AP4jYZSgxq2wVlVvi+vOda0E6LsIpZbLg4LAJBKS7yaI/pq/ug7dBn5mhSAbpzebVF fZtBXwi6v9txUkemTfrclA7uUVih4gjJ+8VZXGtqW7wU6/QD6GaEgCDPiY+8EKkfUk2x Z/6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=HBULydA0iouTHMlJ/yNjByoniWSKmqzTYSA9Hg5GAjk=; b=TAuf8OyouWrZehr2mLj8kPLTflxRTbYBFvfN5a2T5HfdCUdgHYW9SVdL1PCt3EJzij LaVs35uY8q4Cd1B3RzCttAUoGyVIwYSjZvy/vx7pc1c4ONOdVbKlA+O1zNSGnmzwbYVX zzY3Q+V+8JWpjgphp3rlFGSy0lINRgHuFVhreVOAzdQWEVilwpgpr4fP1Tji+l0fC0L3 4CHrsDQ3gX/n/gsOf//rv/ZQI6GVP3ra9QrGFNEiAADO2kPxBom/pMiSfBjVNET4z4tR WuXX0522p1dRmJJPoDkgkiGYdVnCvpW3Zl+rwzAJYVBVZxOVvGuKn9mZbCo9DebmWz6k CJqw== X-Gm-Message-State: AOAM530GgNdSYyXMl92sfICZiB7To9H60EmNyl1Wy9dZ/SVm4PnvE9Jo L2dZLJMn6a5gSydqnuxb66A= X-Google-Smtp-Source: ABdhPJyKBsGGVy1LgdyJlkqNUwWMPp2kJaH57qTC314i8o3JPIKsCAX1PgLMgGgHbs14MNfI3jYFRg== X-Received: by 2002:a1c:a142:: with SMTP id k63mr37372wme.77.1589486918470; Thu, 14 May 2020 13:08:38 -0700 (PDT) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id v5sm14609wrr.93.2020.05.14.13.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 13:08:37 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Thu, 14 May 2020 22:08:36 +0200 (CEST) X-X-Sender: calancha@calancha-pc.dy.bbexcite.jp In-Reply-To: <83y2pu4ei1.fsf@gnu.org> Message-ID: References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> <83y2pu4ei1.fsf@gnu.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, 14 May 2020, Eli Zaretskii wrote: > The fix triggers compilation warnings: > > In archive--summarize-descs: > arc-mode.el:1509:45: Warning: `archive-int-to-mode' is an obsolete function > (as of 28.1); use `file-modes-number-to-symbolic' instead. > arc-mode.el:1574:70: Warning: `archive-int-to-mode' is an obsolete function > (as of 28.1); use `file-modes-number-to-symbolic' instead. > > Would it be possible to eliminate these warnings, please? Sorry, I missed that. Pushed a fix (065f6a1d8b5c7dc8f1bf758e22f2e9a7d17b47d4) Thank you. From unknown Fri Sep 05 20:55:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27952: 26.0.50; Combine archive-int-to-mode and tar-grind-file-mode Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 May 2020 06:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tino Calancha Cc: 27952@debbugs.gnu.org Received: via spool by 27952-submit@debbugs.gnu.org id=B27952.158952377224170 (code B ref 27952); Fri, 15 May 2020 06:23:02 +0000 Received: (at 27952) by debbugs.gnu.org; 15 May 2020 06:22:52 +0000 Received: from localhost ([127.0.0.1]:35700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZTkC-0006Hk-Cf for submit@debbugs.gnu.org; Fri, 15 May 2020 02:22:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZTkA-0006HY-Bj for 27952@debbugs.gnu.org; Fri, 15 May 2020 02:22:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51972) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZTk4-0007fE-Fx; Fri, 15 May 2020 02:22:44 -0400 Received: from [176.228.60.248] (port=3248 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jZTk3-0005Wz-Jd; Fri, 15 May 2020 02:22:44 -0400 Date: Fri, 15 May 2020 09:22:30 +0300 Message-Id: <835zcx4t09.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Tino Calancha on Thu, 14 May 2020 22:08:36 +0200 (CEST)) References: <8760e3zf6v.fsf@calancha-pc> <87h83bqfem.fsf@marxist.se> <871rnzzzgd.fsf@stefankangas.se> <87d076piop.fsf@calancha-pc.dy.bbexcite.jp> <83y2pu4ei1.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Tino Calancha > Date: Thu, 14 May 2020 22:08:36 +0200 (CEST) > cc: Tino Calancha , 27952@debbugs.gnu.org > > > In archive--summarize-descs: > > arc-mode.el:1509:45: Warning: `archive-int-to-mode' is an obsolete function > > (as of 28.1); use `file-modes-number-to-symbolic' instead. > > arc-mode.el:1574:70: Warning: `archive-int-to-mode' is an obsolete function > > (as of 28.1); use `file-modes-number-to-symbolic' instead. > > > > Would it be possible to eliminate these warnings, please? > Sorry, I missed that. Pushed a fix > (065f6a1d8b5c7dc8f1bf758e22f2e9a7d17b47d4) Thanks, compiles cleanly now.