GNU bug report logs -
#13006
recognizing compressed files with arbitrary names
Previous Next
To reply to this bug, email your comments to 13006 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13006
; Package
emacs
.
(Tue, 27 Nov 2012 01:34:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
karl <at> freefriends.org (Karl Berry)
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 27 Nov 2012 01:34:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
As the documentation says
(http://www.gnu.org/software/emacs/manual/html_node/emacs/Compressed-Files.html)
"Emacs recognizes compressed files by their file names."
But compressed files don't always have the expected names. For
instance, using the autobackup feature of Emacs or many other programs
will result in names ending in, say, .~1~ ... Example for concreteness:
$ echo foo | gzip >/tmp/foo.gz.~1~
$ emacs --no-site-file --no-init /tmp/foo.gz.~1~
And observe binary junk instead of text. (This is with 24.2.)
Another implication is problems using M-x grep on such files. After
changing the program to zgrep from grep, matches in the *grep* buffer
are displayed as usual, but then when one visits the file in Emacs,
it's junk.
It would be nice to at least have an easy way to manually tell Emacs
"this is a compressed file, despite its weird name". If there's a way
to do that now, I'd like to know (and it should presumably be in the
manual). I looked at jka-compr.el but could not find it.
Of course, a more robust solution would be to use magic numbers instead
of filenames to recognize file types. I see there was a long thread
about that several years ago, starting at
http://lists.gnu.org/archive/html/emacs-devel/2009-08/msg01023.html. I
know it's been discussed at other times, too, but I can't see any way to
accomplish it (short of using crypt++, which doesn't work well with
Emacs 23 or later, which is why I stopped using it ... anyway).
Thanks,
karl
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13006
; Package
emacs
.
(Tue, 27 Nov 2012 08:53:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13006 <at> debbugs.gnu.org (full text, mbox):
karl <at> freefriends.org (Karl Berry) writes:
> $ echo foo | gzip >/tmp/foo.gz.~1~
> $ emacs --no-site-file --no-init /tmp/foo.gz.~1~
>
> And observe binary junk instead of text. (This is with 24.2.)
This is a regression from Emacs 23. It should disregard the backup
suffix when matching the extension.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Severity set to 'important' from 'normal'
Request was from
Chong Yidong <cyd <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 27 Nov 2012 10:09:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13006
; Package
emacs
.
(Tue, 27 Nov 2012 18:44:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 13006 <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab wrote:
> This is a regression from Emacs 23. It should disregard the backup
> suffix when matching the extension.
Presumably the 2010-12-08 change to jka-compr-compression-info-list.
(There is a comment above jka-compr-compression-info-list which was
ignored and no longer applies. Also the :version was not bumped.)
Anyway, this seems to fix the immediate problem:
*** lisp/jka-cmpr-hook.el 2012-01-29 17:41:43 +0000
--- lisp/jka-cmpr-hook.el 2012-11-27 18:35:37 +0000
***************
*** 109,114 ****
--- 109,115 ----
"Return information about the compression scheme of FILENAME.
The determination as to which compression scheme, if any, to use is
based on the filename itself and `jka-compr-compression-info-list'."
+ (setq filename (file-name-sans-versions filename))
(catch 'compression-info
(let ((case-fold-search nil))
(dolist (x jka-compr-compression-info-list)
There's a separate question of handling arbitrarily named compressed
files via magic-fallback-mode-alist or somesuch.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13006
; Package
emacs
.
(Tue, 27 Nov 2012 23:07:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 13006 <at> debbugs.gnu.org (full text, mbox):
+ (setq filename (file-name-sans-versions filename))
Thanks.
There's a separate question of handling arbitrarily named compressed
files via magic-fallback-mode-alist or somesuch.
Right. The backup versions was just an example of problematic names.
Though it's certainly good to have that fixed.
There's also the (potentially related) question of making it possible
for users to tell Emacs "this is a compressed file". Regardless of the
method(s) used to detect compression, this seems like it would be
useful. I have plenty of times been forced to decompress files outside
of Emacs and then visit the plain file. Clearly it's not the end of the
world to do that, but ...
If you want me to send separate reports for either or both of those
things, let me know.
Thanks,
k
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13006
; Package
emacs
.
(Wed, 28 Nov 2012 08:42:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 13006 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris wrote:
> + (setq filename (file-name-sans-versions filename))
Applied for 24.2.91.
Leaving this open as a wishlist for:
a) detecting compressed files by magic bytes
b) explicit command to open a file using a given compression
Severity set to 'wishlist' from 'important'
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 28 Nov 2012 08:42:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 144 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.