GNU bug report logs -
#39024
28.0.50; Unable to compress or uncompress files in Emacs on Windows 10
Previous Next
Reported by: Raoul Comninos <revcomninos <at> gmail.com>
Date: Tue, 7 Jan 2020 23:15:02 UTC
Severity: normal
Found in version 28.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 39024-done <at> debbugs.gnu.org (full text, mbox):
> From: Raoul Comninos <revcomninos <at> gmail.com>
> 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)))
This bug report was last modified 5 years and 128 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.