From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39024: 28.0.50; Unable to compress or uncompress files in Emacs on Windows 10 Date: Wed, 08 Jan 2020 18:26:42 +0200 Message-ID: <83lfqhc3st.fsf@gnu.org> References: Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="207860"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 39024-done@debbugs.gnu.org To: Raoul Comninos Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 08 17:27:41 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ipEAp-000h75-KZ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2020 17:27:11 +0100 Original-Received: from localhost ([::1]:46384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipEAo-00067W-DA for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2020 11:27:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50501) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipEAh-00061I-EG for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 11:27:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipEAg-0005FY-9h for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 11:27:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45233) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipEAg-0005FT-6T for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 11:27:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ipEAg-0002cD-3E for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2020 11:27:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jan 2020 16:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 39024 X-GNU-PR-Package: emacs Mail-Followup-To: 39024@debbugs.gnu.org, eliz@gnu.org, revcomninos@gmail.com Original-Received: via spool by 39024-done@debbugs.gnu.org id=D39024.157850080010015 (code D ref 39024); Wed, 08 Jan 2020 16:27:01 +0000 Original-Received: (at 39024-done) by debbugs.gnu.org; 8 Jan 2020 16:26:40 +0000 Original-Received: from localhost ([127.0.0.1]:51205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipEAJ-0002bS-71 for submit@debbugs.gnu.org; Wed, 08 Jan 2020 11:26:40 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41131) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipEAH-0002bF-0Z for 39024-done@debbugs.gnu.org; Wed, 08 Jan 2020 11:26:37 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ipEAB-00053u-QU; Wed, 08 Jan 2020 11:26:31 -0500 Original-Received: from [176.228.60.248] (port=2876 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ipEA9-0000TR-0n; Wed, 08 Jan 2020 11:26:31 -0500 In-reply-to: (message from Raoul Comninos on Wed, 8 Jan 2020 00:54:45 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org gmane.emacs.bugs:174364 Archived-At: > From: Raoul Comninos > Date: Wed, 8 Jan 2020 00:54:45 +0200 > > When I try to compress a file in Dired in Emacs on Windows 10 I get the following error message: > > ls-lisp-insert-directory: Reading directory: Directory doesn't exist or is inaccessible, c.tar.gz > > If I try in Emacs -Q I get a different error message: > > /usr/bin/bash: c.tar.gz/: Is a directory > > tar: Removing leading \c:/' from member names` Thanks. Compressing directories in Dired on Windows was botched ever since it was introduced, and on platforms other than Windows it could fail as well, for the same reasons, in some rare cases. I've now fixed it for the upcoming Emacs 27.1. In case you want to patch your Emacs without waiting for the next release, the patch is below. And with that, I'm closing the bug report. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 59d389d..0069c17 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -992,7 +992,14 @@ dired-compress (ignore-errors (dired-remove-entry new-file)) (goto-char start) ;; Now replace the current line with an entry for NEW-FILE. - (dired-update-file-line new-file) nil) + ;; But don't remove the current line if either FROM-FILE or + ;; NEW-FILE is a directory, because compressing/uncompressing + ;; directories doesn't remove the original. + (if (or (file-directory-p from-file) + (file-directory-p new-file)) + (dired-add-entry new-file nil t) + (dired-update-file-line new-file)) + nil) (dired-log (concat "Failed to (un)compress " from-file)) from-file))) @@ -1020,8 +1027,9 @@ dired-compress-file-suffixes ("\\.7z\\'" "" "7z x -aoa -o%o %i") ;; This item controls naming for compression. ("\\.tar\\'" ".tgz" nil) - ;; This item controls the compression of directories - (":" ".tar.gz" "tar -cf - %i | gzip -c9 > %o")) + ;; This item controls the compression of directories. Its REGEXP + ;; element should never match any valid file name. + ("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o")) "Control changes in file name suffixes for compression and uncompression. Each element specifies one transformation rule, and has the form: (REGEXP NEW-SUFFIX PROGRAM) @@ -1145,7 +1153,7 @@ dired-compress-file (condition-case nil (if (file-directory-p file) (progn - (setq suffix (cdr (assoc ":" dired-compress-file-suffixes))) + (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes))) (when suffix (let ((out-name (concat file (car suffix))) (default-directory (file-name-directory file)))