From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#46913: dired-do-compress doesn't work on files in inserted subdirectories Date: Tue, 21 Sep 2021 12:22:52 +0300 Message-ID: <83mto6z3ir.fsf@gnu.org> References: <87h7eeqqaa.fsf@cnu407c2zx.nsn-intra.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37017"; mail-complaints-to="usenet@ciao.gmane.io" Cc: okamsn@protonmail.com, 46913@debbugs.gnu.org To: "Michalis V." Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 21 11:24:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSc0Y-0009OH-0B for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 11:24:10 +0200 Original-Received: from localhost ([::1]:55896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSc0W-00070W-07 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Sep 2021 05:24:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSc0Q-0006zq-9E for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 05:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSc0Q-0004D1-19 for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 05:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mSc0P-00029G-Pm for bug-gnu-emacs@gnu.org; Tue, 21 Sep 2021 05:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Sep 2021 09:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46913 X-GNU-PR-Package: emacs Original-Received: via spool by 46913-submit@debbugs.gnu.org id=B46913.16322161848177 (code B ref 46913); Tue, 21 Sep 2021 09:24:01 +0000 Original-Received: (at 46913) by debbugs.gnu.org; 21 Sep 2021 09:23:04 +0000 Original-Received: from localhost ([127.0.0.1]:44908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSbzU-00027p-Cz for submit@debbugs.gnu.org; Tue, 21 Sep 2021 05:23:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSbzS-000271-VC for 46913@debbugs.gnu.org; Tue, 21 Sep 2021 05:23:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39536) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSbzN-0003M9-PN; Tue, 21 Sep 2021 05:22:57 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2964 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSbzN-00046U-Cs; Tue, 21 Sep 2021 05:22:57 -0400 In-Reply-To: <87h7eeqqaa.fsf@cnu407c2zx.nsn-intra.net> (mvar.40k@gmail.com) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214935 Archived-At: > From: "Michalis V." > Date: Tue, 21 Sep 2021 11:35:57 +0300 > Cc: 46913@debbugs.gnu.org > > when (zerop > (dired-shell-command > (format-spec (cdr rule) > `((?o . ,(shell-quote-argument out-file)) > (?i . ,(mapconcat > (lambda (in-file) > (shell-quote-argument > (file-name-nondirectory in-file))) > in-files " ")))))) > > > in-files is a list with all marked files including their full path, > e.g. ("/home/mvar/m/a" "/home/mvar/m/b" "/home/mvar/m/n/c") > > file-name-nondirectory will strip the whole path and leave just the > filenames and the final command for dired-shell-command will be > something like this: > > tar -cf - a b c | gzip -c9 > /home/varagoul/m/a.tar.gz > > and since dired-shell-command is executed from within the parent > dired-directory (/home/mvar/m in this case), file c won't be found so it > won't be included in the resulting archive. A workaround for this is to > include the whole path, i.e. > > (lambda (in-file) > (shell-quote-argument > (expand-file-name in-file))) > > > but if you untar the file later, the files will be extracted with the > full path (in our example under home/mvar/m) > and i don't think we want the full path in there. Yes, absolute file names in archives should be avoided at all costs. > So another solution which is a bit more hackish is the following > (and also attached as a patch) Why not use file-relative-name instead? Btw, please don't use "path" for anything that is not PATH-style directory lists: the GNU Coding Standards frown on such uses. We use "file name" or "absolute file name" or "leading directories" instead, as appropriate for the context. Thanks.