* Error opening an APK file
@ 2019-09-18 8:52 Pascal Quesseveur
2019-09-18 12:35 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Pascal Quesseveur @ 2019-09-18 8:52 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I am opening an Android apk file in order to use archive-mode on it
and I get an error:
Parsing archive file...
File mode specification error: (args-out-of-range Test.apk 8029861 8029865)
I checked with version 26 on Linux and version 24 on Windows. Result
is the same. Result of (point-max) in the buffer is 7731777, which is
strange because file size is 8031399 bytes.
--
Pascal Quesseveur
pquessev@gmail.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 8:52 Error opening an APK file Pascal Quesseveur
@ 2019-09-18 12:35 ` Eli Zaretskii
2019-09-18 14:20 ` Pascal Quesseveur
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-18 12:35 UTC (permalink / raw)
To: help-gnu-emacs
> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Wed, 18 Sep 2019 10:52:44 +0200
>
> I am opening an Android apk file in order to use archive-mode on it
> and I get an error:
>
> Parsing archive file...
> File mode specification error: (args-out-of-range Test.apk 8029861 8029865)
Details, please. How did you try to open that file? Does the problem
happen in "emacs -Q"?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 12:35 ` Eli Zaretskii
@ 2019-09-18 14:20 ` Pascal Quesseveur
2019-09-18 14:29 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Pascal Quesseveur @ 2019-09-18 14:20 UTC (permalink / raw)
To: help-gnu-emacs
>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> Details, please. How did you try to open that file? Does the problem
EZ> happen in "emacs -Q"?
Thank you. The problem doesn't happen with "emacs -Q". It appears I
have a call to modify-coding-system-alist to force utf-8-unix encoding
on my home dir. If I remove that call, everything is OK. I can keep
the call to modify-coding-system-alist and add a new one for apk files
with no-conversion.
How does it make that I do not have any problems with zip or jar
files?
--
Pascal Quesseveur
pquessev@gmail.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 14:20 ` Pascal Quesseveur
@ 2019-09-18 14:29 ` Eli Zaretskii
2019-09-18 15:11 ` Pascal Quesseveur
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-18 14:29 UTC (permalink / raw)
To: help-gnu-emacs
> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Wed, 18 Sep 2019 16:20:15 +0200
>
> Thank you. The problem doesn't happen with "emacs -Q". It appears I
> have a call to modify-coding-system-alist to force utf-8-unix encoding
> on my home dir. If I remove that call, everything is OK. I can keep
> the call to modify-coding-system-alist and add a new one for apk files
> with no-conversion.
>
> How does it make that I do not have any problems with zip or jar
> files?
I think it's the contents of the files, not their extension, that
matters.
How did you "force utf-8-unix encoding" on your home directory, and
why did you need that?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 14:29 ` Eli Zaretskii
@ 2019-09-18 15:11 ` Pascal Quesseveur
2019-09-18 15:27 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Pascal Quesseveur @ 2019-09-18 15:11 UTC (permalink / raw)
To: help-gnu-emacs
>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> I think it's the contents of the files, not their extension,
EZ> that matters.
But the apk files are zip files.
EZ> How did you "force utf-8-unix encoding" on your home directory,
Something like:
(modify-coding-system-alist 'file "quessev" 'utf-8-unix)
EZ> why did you need that?
Because I wanted to always have this encoding when I access my files
through a Windows system.
--
Pascal Quesseveur
pquessev@gmail.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 15:11 ` Pascal Quesseveur
@ 2019-09-18 15:27 ` Eli Zaretskii
2019-09-18 16:48 ` Pascal Quesseveur
2019-09-19 7:15 ` Pascal Quesseveur
0 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-18 15:27 UTC (permalink / raw)
To: help-gnu-emacs
> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Wed, 18 Sep 2019 17:11:58 +0200
>
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
> EZ> I think it's the contents of the files, not their extension,
> EZ> that matters.
>
> But the apk files are zip files.
Are you saying that just renaming a .apk file to .zip solves the
problem?
> EZ> How did you "force utf-8-unix encoding" on your home directory,
>
> Something like:
>
> (modify-coding-system-alist 'file "quessev" 'utf-8-unix)
>
> EZ> why did you need that?
>
> Because I wanted to always have this encoding when I access my files
> through a Windows system.
(prefer-coding-system 'utf-8-unix) should have done that better, and
probably would avoid this problem.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 15:27 ` Eli Zaretskii
@ 2019-09-18 16:48 ` Pascal Quesseveur
2019-09-19 7:15 ` Pascal Quesseveur
1 sibling, 0 replies; 19+ messages in thread
From: Pascal Quesseveur @ 2019-09-18 16:48 UTC (permalink / raw)
To: help-gnu-emacs
>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> Are you saying that just renaming a .apk file to .zip solves the
EZ> problem?
I was not saying that. But I checked and it works.
EZ> (prefer-coding-system 'utf-8-unix) should have done that better, and
EZ> probably would avoid this problem.
Yes, it works.
--
Pascal Quesseveur
pquessev@gmail.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-18 15:27 ` Eli Zaretskii
2019-09-18 16:48 ` Pascal Quesseveur
@ 2019-09-19 7:15 ` Pascal Quesseveur
2019-09-20 7:26 ` Eli Zaretskii
1 sibling, 1 reply; 19+ messages in thread
From: Pascal Quesseveur @ 2019-09-19 7:15 UTC (permalink / raw)
To: help-gnu-emacs
>"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
EZ> Are you saying that just renaming a .apk file to .zip solves the
EZ> problem?
Yes. In files.el auto-mode-alist associates archive-mode for archive
file extensions: arc, zip, ... The comment says:
;; The list of archive file extensions should be in sync with
;; `auto-coding-alist' with `no-conversion' coding system.
In fact, auto-coding-alist in mule.el associates archive file
extensions with no-conversion-multibyte.
--
Pascal Quesseveur
pquessev@gmail.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-19 7:15 ` Pascal Quesseveur
@ 2019-09-20 7:26 ` Eli Zaretskii
2019-09-20 12:14 ` Stefan Monnier
0 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-20 7:26 UTC (permalink / raw)
To: help-gnu-emacs
> From: Pascal Quesseveur <pquessev@gmail.com>
> Date: Thu, 19 Sep 2019 09:15:00 +0200
>
> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
> EZ> Are you saying that just renaming a .apk file to .zip solves the
> EZ> problem?
>
> Yes. In files.el auto-mode-alist associates archive-mode for archive
> file extensions: arc, zip, ... The comment says:
>
> ;; The list of archive file extensions should be in sync with
> ;; `auto-coding-alist' with `no-conversion' coding system.
>
> In fact, auto-coding-alist in mule.el associates archive file
> extensions with no-conversion-multibyte.
And if you add apk to auto-coding-alist, the problem goes away?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 7:26 ` Eli Zaretskii
@ 2019-09-20 12:14 ` Stefan Monnier
2019-09-20 12:23 ` Robert Pluim
2019-09-20 14:37 ` Eli Zaretskii
0 siblings, 2 replies; 19+ messages in thread
From: Stefan Monnier @ 2019-09-20 12:14 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii [2019-09-20 10:26:31] wrote:
>> From: Pascal Quesseveur <pquessev@gmail.com>
>> Date: Thu, 19 Sep 2019 09:15:00 +0200
>>
>> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>>
>> EZ> Are you saying that just renaming a .apk file to .zip solves the
>> EZ> problem?
>>
>> Yes. In files.el auto-mode-alist associates archive-mode for archive
>> file extensions: arc, zip, ... The comment says:
>>
>> ;; The list of archive file extensions should be in sync with
>> ;; `auto-coding-alist' with `no-conversion' coding system.
>>
>> In fact, auto-coding-alist in mule.el associates archive file
>> extensions with no-conversion-multibyte.
>
> And if you add apk to auto-coding-alist, the problem goes away?
How 'bout a patch along the lines of the one below?
Stefan
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index ec6f647688..c570caa993 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1844,12 +1843,9 @@ auto-coding-alist
;; .exe and .EXE are added to support archive-mode looking at DOS
;; self-extracting exe archives.
(mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
- '(("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
- . no-conversion-multibyte)
+ '((archive-mode . no-conversion)
("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
- ("\\.\\(sx[dmicw]\\|odt\\|tar\\|t[bg]z\\)\\'" . no-conversion)
+ (tar-mode . no-conversion)
("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion)
("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion)
("\\.pdf\\'" . no-conversion)
@@ -1936,13 +1932,27 @@ auto-coding-alist-lookup
"Return the coding system specified by `auto-coding-alist' for FILENAME."
(let ((alist auto-coding-alist)
(case-fold-search (file-name-case-insensitive-p filename))
+ (mmode nil)
coding-system)
(while (and alist (not coding-system))
- (if (string-match (car (car alist)) filename)
+ (if (if (stringp (car (car alist)))
+ (string-match (car (car alist)) filename)
+ (unless (or mmode (not (boundp 'auto-mode-alist)))
+ (setq mmode (or (assoc-default filename auto-mode-alist
+ #'string-match)
+ t)))
+ (eq mmode (caar alist)))
(setq coding-system (cdr (car alist)))
(setq alist (cdr alist))))
coding-system))
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:14 ` Stefan Monnier
@ 2019-09-20 12:23 ` Robert Pluim
2019-09-20 12:40 ` Stefan Monnier
2019-09-20 13:01 ` Eli Zaretskii
2019-09-20 14:37 ` Eli Zaretskii
1 sibling, 2 replies; 19+ messages in thread
From: Robert Pluim @ 2019-09-20 12:23 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> On Fri, 20 Sep 2019 08:14:37 -0400, Stefan Monnier <monnier@iro.umontreal.ca> said:
Stefan> Eli Zaretskii [2019-09-20 10:26:31] wrote:
>>> From: Pascal Quesseveur <pquessev@gmail.com>
>>> Date: Thu, 19 Sep 2019 09:15:00 +0200
>>>
>>> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>>>
EZ> Are you saying that just renaming a .apk file to .zip solves the
EZ> problem?
>>>
>>> Yes. In files.el auto-mode-alist associates archive-mode for archive
>>> file extensions: arc, zip, ... The comment says:
>>>
>>> ;; The list of archive file extensions should be in sync with
>>> ;; `auto-coding-alist' with `no-conversion' coding system.
>>>
>>> In fact, auto-coding-alist in mule.el associates archive file
>>> extensions with no-conversion-multibyte.
>>
>> And if you add apk to auto-coding-alist, the problem goes away?
Stefan> How 'bout a patch along the lines of the one below?
Stefan> Stefan
Stefan> diff --git a/lisp/international/mule.el b/lisp/international/mule.el
Stefan> index ec6f647688..c570caa993 100644
Stefan> --- a/lisp/international/mule.el
Stefan> +++ b/lisp/international/mule.el
Stefan> @@ -1844,12 +1843,9 @@ auto-coding-alist
Stefan> ;; .exe and .EXE are added to support archive-mode looking at DOS
Stefan> ;; self-extracting exe archives.
Stefan> (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
Stefan> - '(("\\.\\(\
Stefan> -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
Stefan> -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
Why upcase the extensions? My .zip files are named .zip, and I have a
case-sensitive file system.
Robert
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:23 ` Robert Pluim
@ 2019-09-20 12:40 ` Stefan Monnier
2019-09-20 12:47 ` Robert Pluim
2019-09-20 14:35 ` Eli Zaretskii
2019-09-20 13:01 ` Eli Zaretskii
1 sibling, 2 replies; 19+ messages in thread
From: Stefan Monnier @ 2019-09-20 12:40 UTC (permalink / raw)
To: help-gnu-emacs
> Stefan> -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
> Stefan> -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
>
> Why upcase the extensions?
Don't ask me: that's part of the code my patch *removes*.
Stefan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:40 ` Stefan Monnier
@ 2019-09-20 12:47 ` Robert Pluim
2019-09-20 14:35 ` Eli Zaretskii
1 sibling, 0 replies; 19+ messages in thread
From: Robert Pluim @ 2019-09-20 12:47 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
>>>>> On Fri, 20 Sep 2019 08:40:42 -0400, Stefan Monnier <monnier@iro.umontreal.ca> said:
Stefan> -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
Stefan> -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
>>
>> Why upcase the extensions?
Stefan> Don't ask me: that's part of the code my patch *removes*.
I really should drink more coffee before reading diffs.
Robert
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:23 ` Robert Pluim
2019-09-20 12:40 ` Stefan Monnier
@ 2019-09-20 13:01 ` Eli Zaretskii
2019-09-20 13:17 ` Robert Pluim
1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-20 13:01 UTC (permalink / raw)
To: help-gnu-emacs
> From: Robert Pluim <rpluim@gmail.com>
> Date: Fri, 20 Sep 2019 14:23:39 +0200
>
> Why upcase the extensions?
You never worked with files that came from MS-DOS, did you?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 13:01 ` Eli Zaretskii
@ 2019-09-20 13:17 ` Robert Pluim
0 siblings, 0 replies; 19+ messages in thread
From: Robert Pluim @ 2019-09-20 13:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
>>>>> On Fri, 20 Sep 2019 16:01:43 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Date: Fri, 20 Sep 2019 14:23:39 +0200
>>
>> Why upcase the extensions?
Eli> You never worked with files that came from MS-DOS, did you?
Thankfully not in several decades. Or if I did, I never noticed.
Robert
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:40 ` Stefan Monnier
2019-09-20 12:47 ` Robert Pluim
@ 2019-09-20 14:35 ` Eli Zaretskii
2019-09-20 15:13 ` Stefan Monnier
1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-20 14:35 UTC (permalink / raw)
To: help-gnu-emacs
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 20 Sep 2019 08:40:42 -0400
>
> > Stefan> -arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
> > Stefan> -ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
> >
> > Why upcase the extensions?
>
> Don't ask me: that's part of the code my patch *removes*.
The question is still valid because the same extensions appear in
auto-mode-alist (on which you rely in your proposed patch).
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 12:14 ` Stefan Monnier
2019-09-20 12:23 ` Robert Pluim
@ 2019-09-20 14:37 ` Eli Zaretskii
1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-20 14:37 UTC (permalink / raw)
To: help-gnu-emacs
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 20 Sep 2019 08:14:37 -0400
>
> > And if you add apk to auto-coding-alist, the problem goes away?
>
> How 'bout a patch along the lines of the one below?
Why remove the extensions? that makes the change backward-incompatible
for no good reason, AFAIU.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 14:35 ` Eli Zaretskii
@ 2019-09-20 15:13 ` Stefan Monnier
2019-09-20 16:02 ` Eli Zaretskii
0 siblings, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2019-09-20 15:13 UTC (permalink / raw)
To: help-gnu-emacs
> Why remove the extensions? that makes the change backward-incompatible
> for no good reason, AFAIU.
AFAIK they're redundant with those in auto-mode-alist.
> The question is still valid because the same extensions appear in
> auto-mode-alist (on which you rely in your proposed patch).
[ I just sent the code I have around, which I wrote many
years ago (and that I've been using ever since).
No intention to use it as-is, I just wanted to illustrate the idea.
The case-sensitivity should obey auto-mode-case-fold, of course
(apparently I wrote that code before auto-mode-case-fold was added to
Emacs ;-). ]
The question is definitely valid. I guess rather than deflect it,
I should have answered it, to avoid the follow up reactions.
So while I didn't write that code, I can explain: even on
a case-insensitive filesystem, a file can have name
foo.APK or foo.apk or foo.ApK (and those are *different* names), so
since *we* do the comparison (instead of the filesystem, which would do
the comparison in a case-insensitive way) in a case-sensitive way in or
current code, we need the regexp to have those "redundant" upper case
variants (tho they don't catch foo.ApK).
Stefan
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Error opening an APK file
2019-09-20 15:13 ` Stefan Monnier
@ 2019-09-20 16:02 ` Eli Zaretskii
0 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2019-09-20 16:02 UTC (permalink / raw)
To: help-gnu-emacs
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 20 Sep 2019 11:13:36 -0400
>
> > Why remove the extensions? that makes the change backward-incompatible
> > for no good reason, AFAIU.
>
> AFAIK they're redundant with those in auto-mode-alist.
Only if you assume the default value of auto-mode-alist.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2019-09-20 16:02 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-18 8:52 Error opening an APK file Pascal Quesseveur
2019-09-18 12:35 ` Eli Zaretskii
2019-09-18 14:20 ` Pascal Quesseveur
2019-09-18 14:29 ` Eli Zaretskii
2019-09-18 15:11 ` Pascal Quesseveur
2019-09-18 15:27 ` Eli Zaretskii
2019-09-18 16:48 ` Pascal Quesseveur
2019-09-19 7:15 ` Pascal Quesseveur
2019-09-20 7:26 ` Eli Zaretskii
2019-09-20 12:14 ` Stefan Monnier
2019-09-20 12:23 ` Robert Pluim
2019-09-20 12:40 ` Stefan Monnier
2019-09-20 12:47 ` Robert Pluim
2019-09-20 14:35 ` Eli Zaretskii
2019-09-20 15:13 ` Stefan Monnier
2019-09-20 16:02 ` Eli Zaretskii
2019-09-20 13:01 ` Eli Zaretskii
2019-09-20 13:17 ` Robert Pluim
2019-09-20 14:37 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.