* bug#5475: Archives with filenames with square brackets
@ 2010-01-25 17:48 Juri Linkov
2010-01-26 21:05 ` Chong Yidong
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-01-25 17:48 UTC (permalink / raw)
To: 5475
When a zip archive contains a file with square brackets in its name
(e.g. "file[name].txt") then visiting this file displays an error:
caution: filename not matched: file[name].txt
For more details please see
http://lists.gnu.org/archive/html/emacs-devel/2010-01/msg01161.html
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-25 17:48 bug#5475: Archives with filenames with square brackets Juri Linkov
@ 2010-01-26 21:05 ` Chong Yidong
2010-01-26 21:47 ` Eli Zaretskii
0 siblings, 1 reply; 36+ messages in thread
From: Chong Yidong @ 2010-01-26 21:05 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475
> When a zip archive contains a file with square brackets in its name
> (e.g. "file[name].txt") then visiting this file displays an error:
>
> caution: filename not matched: file[name].txt
I assume this is a specific quirk of unzip that it handles square
brackets specially (characters like * seem to be handled literally).
How about this patch?
*** lisp/arc-mode.el 2010-01-13 08:35:10 +0000
--- lisp/arc-mode.el 2010-01-26 21:03:54 +0000
***************
*** 1782,1787 ****
--- 1782,1791 ----
(apply 'vector (nreverse files))))
(defun archive-zip-extract (archive name)
+ (when (string-match "[][]" name)
+ (require 'comint)
+ (let ((comint-file-name-quote-list '(?\] ?\[)))
+ (setq name (comint-quote-filename name))))
(if (equal (car archive-zip-extract) "pkzip")
(archive-*-extract archive name archive-zip-extract)
(archive-extract-by-stdout archive name archive-zip-extract)))
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-26 21:05 ` Chong Yidong
@ 2010-01-26 21:47 ` Eli Zaretskii
2010-01-27 16:57 ` Chong Yidong
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-26 21:47 UTC (permalink / raw)
To: Chong Yidong; +Cc: 5475
> From: Chong Yidong <cyd@stupidchicken.com>
> Date: Tue, 26 Jan 2010 16:05:20 -0500
> Cc: 5475@debbugs.gnu.org
>
> > When a zip archive contains a file with square brackets in its name
> > (e.g. "file[name].txt") then visiting this file displays an error:
> >
> > caution: filename not matched: file[name].txt
>
> I assume this is a specific quirk of unzip that it handles square
> brackets specially (characters like * seem to be handled literally).
I think it treats all wildcard characters the same. A `*' may not
cause a warning because a file whose name is literally foo*, matches
the wildcard foo*.
> How about this patch?
>
> *** lisp/arc-mode.el 2010-01-13 08:35:10 +0000
> --- lisp/arc-mode.el 2010-01-26 21:03:54 +0000
> ***************
> *** 1782,1787 ****
> --- 1782,1791 ----
> (apply 'vector (nreverse files))))
>
> (defun archive-zip-extract (archive name)
> + (when (string-match "[][]" name)
> + (require 'comint)
> + (let ((comint-file-name-quote-list '(?\] ?\[)))
> + (setq name (comint-quote-filename name))))
> (if (equal (car archive-zip-extract) "pkzip")
> (archive-*-extract archive name archive-zip-extract)
> (archive-extract-by-stdout archive name archive-zip-extract)))
First, why not use shell-quote-argument, instead of requiring comint?
Second, could someone please see if pkzip also expands wildcards
internally? If it does not, the quoting will need to be done only in
the non-pkzip branch. We also need to test this on MS-Windows.
But most importantly, this patch is not clean, IMO: it hardcodes into
archive-zip-extract (the function) some knowledge of what can be the
possible values of archive-zip-extract the defcustom. What if
tomorrow there will be a 3rd possibility, in addition to pkzip and
unzip?
That is why I thought about some less trivial patch: add to the data
structures that are values of these defcustom's a flag to indicate
whether the file name needs to be quoted or not.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-26 21:47 ` Eli Zaretskii
@ 2010-01-27 16:57 ` Chong Yidong
2010-01-27 17:35 ` Eli Zaretskii
0 siblings, 1 reply; 36+ messages in thread
From: Chong Yidong @ 2010-01-27 16:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475
Eli Zaretskii <eliz@gnu.org> writes:
> First, why not use shell-quote-argument, instead of requiring comint?
I wasn't sure whether it was only [] that was handled specially, or the
usual shell wildcards. But I see now that it is the latter, as you say.
So shell-quote-argument is indeed the correct thing.
> Second, could someone please see if pkzip also expands wildcards
> internally? If it does not, the quoting will need to be done only in
> the non-pkzip branch. We also need to test this on MS-Windows.
I have no way to check this. Looks like pkzip is Windows-only.
> But most importantly, this patch is not clean, IMO: it hardcodes into
> archive-zip-extract (the function) some knowledge of what can be the
> possible values of archive-zip-extract the defcustom. What if
> tomorrow there will be a 3rd possibility, in addition to pkzip and
> unzip?
>
> That is why I thought about some less trivial patch: add to the data
> structures that are values of these defcustom's a flag to indicate
> whether the file name needs to be quoted or not.
Well, archive-zip-extract already branches for pkzip/unzip, so whatever
uncleanliness that's associated with is already present...
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-27 16:57 ` Chong Yidong
@ 2010-01-27 17:35 ` Eli Zaretskii
2010-01-28 20:07 ` Chong Yidong
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-27 17:35 UTC (permalink / raw)
To: Chong Yidong; +Cc: 5475
> From: Chong Yidong <cyd@stupidchicken.com>
> Cc: juri@jurta.org, 5475@debbugs.gnu.org
> Date: Wed, 27 Jan 2010 11:57:46 -0500
>
> > But most importantly, this patch is not clean, IMO: it hardcodes into
> > archive-zip-extract (the function) some knowledge of what can be the
> > possible values of archive-zip-extract the defcustom. What if
> > tomorrow there will be a 3rd possibility, in addition to pkzip and
> > unzip?
> >
> > That is why I thought about some less trivial patch: add to the data
> > structures that are values of these defcustom's a flag to indicate
> > whether the file name needs to be quoted or not.
>
> Well, archive-zip-extract already branches for pkzip/unzip
Yes, but it does that by a user option, not by some hidden knowledge.
I won't mind introducing a similar option that would tell arc-mode to
quote the file arguments.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-27 17:35 ` Eli Zaretskii
@ 2010-01-28 20:07 ` Chong Yidong
2010-01-28 21:05 ` Eli Zaretskii
0 siblings, 1 reply; 36+ messages in thread
From: Chong Yidong @ 2010-01-28 20:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475
Eli Zaretskii <eliz@gnu.org> writes:
>> Well, archive-zip-extract already branches for pkzip/unzip
>
> Yes, but it does that by a user option, not by some hidden knowledge.
> I won't mind introducing a similar option that would tell arc-mode to
> quote the file arguments.
Right, but once the user tells arc-mode to use unzip, we can
automagically shell-quote the filename; there seems to be no reason not
to.
It doesn't seem like anyone's going to test PKzip anytime soon. In the
meantime, I have checked in the change to use shell-quote-argument for
unzip.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-28 20:07 ` Chong Yidong
@ 2010-01-28 21:05 ` Eli Zaretskii
2010-01-28 21:24 ` Lennart Borgman
2010-01-30 22:59 ` Juri Linkov
0 siblings, 2 replies; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-28 21:05 UTC (permalink / raw)
To: Chong Yidong; +Cc: 5475
> From: Chong Yidong <cyd@stupidchicken.com>
> Cc: juri@jurta.org, 5475@debbugs.gnu.org
> Date: Thu, 28 Jan 2010 15:07:09 -0500
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> Well, archive-zip-extract already branches for pkzip/unzip
> >
> > Yes, but it does that by a user option, not by some hidden knowledge.
> > I won't mind introducing a similar option that would tell arc-mode to
> > quote the file arguments.
>
> Right, but once the user tells arc-mode to use unzip, we can
> automagically shell-quote the filename; there seems to be no reason not
> to.
If you want to glean the need for quoting from the value of
archive-zip-extract (i.e. its car being "unzip"), I'm fine with that
as well. But as your patch is written, it imposes that on any unzip
command, regardless of whether it was "unzip" or something else, like
p7zip, for example. That doesn't seem right to me.
> It doesn't seem like anyone's going to test PKzip anytime soon. In the
> meantime, I have checked in the change to use shell-quote-argument for
> unzip.
My "soon" is once a week. You only waited 2 days. :-(
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-28 21:05 ` Eli Zaretskii
@ 2010-01-28 21:24 ` Lennart Borgman
2010-01-28 22:00 ` Eli Zaretskii
2010-01-30 22:59 ` Juri Linkov
1 sibling, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-01-28 21:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, Chong Yidong
On Thu, Jan 28, 2010 at 10:05 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Chong Yidong <cyd@stupidchicken.com>
>> Cc: juri@jurta.org, 5475@debbugs.gnu.org
>> Date: Thu, 28 Jan 2010 15:07:09 -0500
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> Well, archive-zip-extract already branches for pkzip/unzip
>> >
>> > Yes, but it does that by a user option, not by some hidden knowledge.
>> > I won't mind introducing a similar option that would tell arc-mode to
>> > quote the file arguments.
>>
>> Right, but once the user tells arc-mode to use unzip, we can
>> automagically shell-quote the filename; there seems to be no reason not
>> to.
Excuse me, I did not follow this thread at all, but I get curious.
What does shell-quote have to do with the arc-mode library? Does it
use a shell at all?
> If you want to glean the need for quoting from the value of
> archive-zip-extract (i.e. its car being "unzip"), I'm fine with that
> as well. But as your patch is written, it imposes that on any unzip
> command, regardless of whether it was "unzip" or something else, like
> p7zip, for example. That doesn't seem right to me.
Now that 7-zip is available on GNU/Linux too wouldn't it be very good
to include support for it?
>> It doesn't seem like anyone's going to test PKzip anytime soon. In the
>> meantime, I have checked in the change to use shell-quote-argument for
>> unzip.
>
> My "soon" is once a week. You only waited 2 days. :-(
>
>
>
>
>
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-28 21:24 ` Lennart Borgman
@ 2010-01-28 22:00 ` Eli Zaretskii
0 siblings, 0 replies; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-28 22:00 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475, cyd
> From: Lennart Borgman <lennart.borgman@gmail.com>
> Date: Thu, 28 Jan 2010 22:24:50 +0100
> Cc: Chong Yidong <cyd@stupidchicken.com>, 5475@debbugs.gnu.org
>
> On Thu, Jan 28, 2010 at 10:05 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> From: Chong Yidong <cyd@stupidchicken.com>
> >> Cc: juri@jurta.org, 5475@debbugs.gnu.org
> >> Date: Thu, 28 Jan 2010 15:07:09 -0500
> >>
> >> Eli Zaretskii <eliz@gnu.org> writes:
> >>
> >> >> Well, archive-zip-extract already branches for pkzip/unzip
> >> >
> >> > Yes, but it does that by a user option, not by some hidden knowledge.
> >> > I won't mind introducing a similar option that would tell arc-mode to
> >> > quote the file arguments.
> >>
> >> Right, but once the user tells arc-mode to use unzip, we can
> >> automagically shell-quote the filename; there seems to be no reason not
> >> to.
>
>
> Excuse me, I did not follow this thread at all, but I get curious.
> What does shell-quote have to do with the arc-mode library? Does it
> use a shell at all?
No, it doesn't use the shell. But "unzip" expands wildcards
internally, so wildcard characters need to be quoted if a file
includes them literally.
> Now that 7-zip is available on GNU/Linux too wouldn't it be very good
> to include support for it?
Patches are always welcome.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-28 21:05 ` Eli Zaretskii
2010-01-28 21:24 ` Lennart Borgman
@ 2010-01-30 22:59 ` Juri Linkov
2010-01-31 4:18 ` Eli Zaretskii
1 sibling, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-01-30 22:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, Chong Yidong
>> >> Well, archive-zip-extract already branches for pkzip/unzip
>> >
>> > Yes, but it does that by a user option, not by some hidden knowledge.
>> > I won't mind introducing a similar option that would tell arc-mode to
>> > quote the file arguments.
>>
>> Right, but once the user tells arc-mode to use unzip, we can
>> automagically shell-quote the filename; there seems to be no reason not
>> to.
>
> If you want to glean the need for quoting from the value of
> archive-zip-extract (i.e. its car being "unzip"), I'm fine with that
> as well. But as your patch is written, it imposes that on any unzip
> command, regardless of whether it was "unzip" or something else, like
> p7zip, for example. That doesn't seem right to me.
I don't understand how this was supposed to work at all?
The default value of `archive-zip-extract' can be either "unzip" or
"pkunzip" (depending on the presence of the executable in `exec-path'),
but the function `archive-zip-extract' compares with the value "pkzip".
So the pkzip/pkunzip branch is never executed.
It seems the intention of the change revno#45347 (2002-05-19) was
to compare with "pkunzip" instead of "pkzip", but I currently can't
confirm that since I can't find pkunzip for GNU/Linux.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-30 22:59 ` Juri Linkov
@ 2010-01-31 4:18 ` Eli Zaretskii
2010-01-31 10:56 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-31 4:18 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
> From: Juri Linkov <juri@jurta.org>
> Cc: Chong Yidong <cyd@stupidchicken.com>, 5475@debbugs.gnu.org
> Date: Sun, 31 Jan 2010 00:59:12 +0200
>
> The default value of `archive-zip-extract' can be either "unzip" or
> "pkunzip" (depending on the presence of the executable in `exec-path'),
> but the function `archive-zip-extract' compares with the value "pkzip".
> So the pkzip/pkunzip branch is never executed.
>
> It seems the intention of the change revno#45347 (2002-05-19) was
> to compare with "pkunzip" instead of "pkzip"
Right, looks like a bug.
Btw, I looked into 7z, and it doesn't have the same problem as unzip.
So we probably should only quote with unzip.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-31 4:18 ` Eli Zaretskii
@ 2010-01-31 10:56 ` Juri Linkov
2010-01-31 18:04 ` Eli Zaretskii
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-01-31 10:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
>> The default value of `archive-zip-extract' can be either "unzip" or
>> "pkunzip" (depending on the presence of the executable in `exec-path'),
>> but the function `archive-zip-extract' compares with the value "pkzip".
>> So the pkzip/pkunzip branch is never executed.
>>
>> It seems the intention of the change revno#45347 (2002-05-19) was
>> to compare with "pkunzip" instead of "pkzip"
>
> Right, looks like a bug.
>
> Btw, I looked into 7z, and it doesn't have the same problem as unzip.
> So we probably should only quote with unzip.
Does the following patch look right? At least, it fixes a bug, and
after feature freeze we could add more data structures to defcustom to
indicate whether the file name needs to be quoted.
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el 2010-01-31 10:55:14 +0000
@@ -1782,12 +1782,13 @@ (defun archive-zip-summarize ()
(apply 'vector (nreverse files))))
(defun archive-zip-extract (archive name)
- (if (equal (car archive-zip-extract) "pkzip")
- (archive-*-extract archive name archive-zip-extract)
- ;; unzip expands wildcards in NAME, so we need to quote it.
- ;; FIXME: Does pkzip need similar treatment?
- (archive-extract-by-stdout archive (shell-quote-argument name)
- archive-zip-extract)))
+ (if (equal (car archive-zip-extract) "unzip")
+ ;; unzip expands wildcards in NAME, so we need to quote it.
+ ;; FIXME: Does pkzip need similar treatment?
+ ;; (7z doesn't need to quote wildcards)
+ (archive-extract-by-stdout archive (shell-quote-argument name)
+ archive-zip-extract)
+ (archive-*-extract archive name archive-zip-extract)))
(defun archive-zip-write-file-member (archive descr)
(archive-*-write-file-member
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-31 10:56 ` Juri Linkov
@ 2010-01-31 18:04 ` Eli Zaretskii
2010-01-31 21:59 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-01-31 18:04 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
> From: Juri Linkov <juri@jurta.org>
> Cc: cyd@stupidchicken.com, 5475@debbugs.gnu.org
> Date: Sun, 31 Jan 2010 12:56:19 +0200
>
> >> The default value of `archive-zip-extract' can be either "unzip" or
> >> "pkunzip" (depending on the presence of the executable in `exec-path'),
> >> but the function `archive-zip-extract' compares with the value "pkzip".
> >> So the pkzip/pkunzip branch is never executed.
> >>
> >> It seems the intention of the change revno#45347 (2002-05-19) was
> >> to compare with "pkunzip" instead of "pkzip"
> >
> > Right, looks like a bug.
> >
> > Btw, I looked into 7z, and it doesn't have the same problem as unzip.
> > So we probably should only quote with unzip.
>
> Does the following patch look right? At least, it fixes a bug, and
> after feature freeze we could add more data structures to defcustom to
> indicate whether the file name needs to be quoted.
Looks okay to me, except that perhaps compare strings
case-insensitively instead of just with `equal'.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-31 18:04 ` Eli Zaretskii
@ 2010-01-31 21:59 ` Juri Linkov
2010-02-01 4:15 ` Eli Zaretskii
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-01-31 21:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
>> > Right, looks like a bug.
>> >
>> > Btw, I looked into 7z, and it doesn't have the same problem as unzip.
>> > So we probably should only quote with unzip.
>>
>> Does the following patch look right? At least, it fixes a bug, and
>> after feature freeze we could add more data structures to defcustom to
>> indicate whether the file name needs to be quoted.
>
> Looks okay to me, except that perhaps compare strings
> case-insensitively instead of just with `equal'.
There are more problems.
When I try to set `archive-zip-extract' to ("7z" "x" "-so") it puts some
unnecessary information (header lines, progress indication, etc.) to
the output buffer, because it outputs this to stderr. With the following
change, stderr goes to /dev/null, but there is no chance to see possible errors
(this patch is for demonstration only, not to be installed):
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el 2010-01-31 21:48:51 +0000
@@ -1080,7 +1080,7 @@ (defun archive-extract-by-stdout (archiv
(apply 'call-process
(car command)
nil
- t
+ '(t nil)
nil
(append (cdr command) (list archive name))))
To process 7z in the correct branch, the following patch is needed,
where any values other than pkunzip/pkzip are processed by
archive-extract-by-stdout instead of archive-*-extract,
where "unzip" needs to quote its filenames.
So I propose to install the following patch, and add more
changes for 7z processing after feature freeze.
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el 2010-01-31 21:48:51 +0000
@@ -1782,12 +1782,17 @@ (defun archive-zip-summarize ()
(apply 'vector (nreverse files))))
(defun archive-zip-extract (archive name)
- (if (equal (car archive-zip-extract) "pkzip")
+ (if (member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
(archive-*-extract archive name archive-zip-extract)
;; unzip expands wildcards in NAME, so we need to quote it.
- ;; FIXME: Does pkzip need similar treatment?
- (archive-extract-by-stdout archive (shell-quote-argument name)
- archive-zip-extract)))
+ ;; FIXME: Does pkunzip need similar treatment?
+ ;; (7z doesn't need to quote wildcards)
+ (archive-extract-by-stdout
+ archive
+ (if (equal (car archive-zip-extract) "unzip")
+ (shell-quote-argument name)
+ name)
+ archive-zip-extract)))
(defun archive-zip-write-file-member (archive descr)
(archive-*-write-file-member
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-01-31 21:59 ` Juri Linkov
@ 2010-02-01 4:15 ` Eli Zaretskii
2010-02-01 10:34 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-02-01 4:15 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
> From: Juri Linkov <juri@jurta.org>
> Cc: cyd@stupidchicken.com, 5475@debbugs.gnu.org
> Date: Sun, 31 Jan 2010 23:59:40 +0200
>
> When I try to set `archive-zip-extract' to ("7z" "x" "-so") it puts some
> unnecessary information (header lines, progress indication, etc.) to
> the output buffer, because it outputs this to stderr. With the following
> change, stderr goes to /dev/null, but there is no chance to see possible errors
> (this patch is for demonstration only, not to be installed):
>
> === modified file 'lisp/arc-mode.el'
> --- lisp/arc-mode.el 2010-01-28 20:06:36 +0000
> +++ lisp/arc-mode.el 2010-01-31 21:48:51 +0000
> @@ -1080,7 +1080,7 @@ (defun archive-extract-by-stdout (archiv
> (apply 'call-process
> (car command)
> nil
> - t
> + '(t nil)
> nil
> (append (cdr command) (list archive name))))
>
> To process 7z in the correct branch, the following patch is needed,
> where any values other than pkunzip/pkzip are processed by
> archive-extract-by-stdout instead of archive-*-extract,
> where "unzip" needs to quote its filenames.
>
> So I propose to install the following patch, and add more
> changes for 7z processing after feature freeze.
Thanks. I'm not sure we need to support 7z, I just tried it to see if
other unzip programs expand wildcards by default like "unzip" does.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 4:15 ` Eli Zaretskii
@ 2010-02-01 10:34 ` Juri Linkov
2010-02-01 11:48 ` Lennart Borgman
` (2 more replies)
0 siblings, 3 replies; 36+ messages in thread
From: Juri Linkov @ 2010-02-01 10:34 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
> Thanks. I'm not sure we need to support 7z, I just tried it to see if
> other unzip programs expand wildcards by default like "unzip" does.
Do you mean we don't need to support 7z in 23.2 or at all?
Are there some problems with 7z that makes undesirable to support it
(maybe, it is not free software, or has an unsuitable license?)
Even though it's quite rarely used format, sometimes when I try to visit
a 7z archive in Emacs, I see only binary data. At least, nowadays the
need to visit a 7z archive arises more often than for obsolete formats
like arc/lzh/zoo still supported by arc-mode.el.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 10:34 ` Juri Linkov
@ 2010-02-01 11:48 ` Lennart Borgman
2010-02-01 15:43 ` Stefan Monnier
2010-02-01 19:49 ` Eli Zaretskii
2 siblings, 0 replies; 36+ messages in thread
From: Lennart Borgman @ 2010-02-01 11:48 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
On Mon, Feb 1, 2010 at 11:34 AM, Juri Linkov <juri@jurta.org> wrote:
>
> Even though it's quite rarely used format, sometimes when I try to visit
> a 7z archive in Emacs, I see only binary data. At least, nowadays the
> need to visit a 7z archive arises more often than for obsolete formats
> like arc/lzh/zoo still supported by arc-mode.el.
7zip also supports most other compression formats, including password
protection.
When I first started using 7zip it was the only free software that did
this. I am not sure whether there is something else now.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 10:34 ` Juri Linkov
2010-02-01 11:48 ` Lennart Borgman
@ 2010-02-01 15:43 ` Stefan Monnier
2010-02-01 21:55 ` Juri Linkov
2010-02-01 19:49 ` Eli Zaretskii
2 siblings, 1 reply; 36+ messages in thread
From: Stefan Monnier @ 2010-02-01 15:43 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
> Do you mean we don't need to support 7z in 23.2 or at all?
> Are there some problems with 7z that makes undesirable to support it
> (maybe, it is not free software, or has an unsuitable license?)
AFAIK 7zip is Free Software, but adding 7z support would be a new
feature, so we would probably be better off insalling it into the
`pending' branch.
Stefan
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 10:34 ` Juri Linkov
2010-02-01 11:48 ` Lennart Borgman
2010-02-01 15:43 ` Stefan Monnier
@ 2010-02-01 19:49 ` Eli Zaretskii
2010-02-01 21:21 ` Drew Adams
` (2 more replies)
2 siblings, 3 replies; 36+ messages in thread
From: Eli Zaretskii @ 2010-02-01 19:49 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
> From: Juri Linkov <juri@jurta.org>
> Cc: cyd@stupidchicken.com, 5475@debbugs.gnu.org
> Date: Mon, 01 Feb 2010 12:34:47 +0200
>
> > Thanks. I'm not sure we need to support 7z, I just tried it to see if
> > other unzip programs expand wildcards by default like "unzip" does.
>
> Do you mean we don't need to support 7z in 23.2 or at all?
At all, for .zip files.
> Are there some problems with 7z that makes undesirable to support it
> (maybe, it is not free software, or has an unsuitable license?)
Its support for zip archives is sporadic at best. On one GNU/Linux
system I tried it, it insisted that a .zip file format was
unsupported, although its Windows version that was older unzipped it
with no trouble at all. Go figure. And the fact that it doesn't have
a switch to make it silent, and you need to throw away its stderr
(which means you cannot display error messages) is yet another
nuisance.
> Even though it's quite rarely used format, sometimes when I try to visit
> a 7z archive in Emacs, I see only binary data. At least, nowadays the
> need to visit a 7z archive arises more often than for obsolete formats
> like arc/lzh/zoo still supported by arc-mode.el.
I have nothing against adding support for 7z archives, although that
would be a new feature.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 19:49 ` Eli Zaretskii
@ 2010-02-01 21:21 ` Drew Adams
2010-02-01 21:52 ` Eli Zaretskii
2010-02-01 22:39 ` Juri Linkov
2010-02-01 22:41 ` Lennart Borgman
2 siblings, 1 reply; 36+ messages in thread
From: Drew Adams @ 2010-02-01 21:21 UTC (permalink / raw)
To: 'Eli Zaretskii', 'Juri Linkov'; +Cc: 5475, cyd
> > Do you mean we don't need to support 7z in 23.2 or at all?
>
> At all, for .zip files.
...
> > Even though it's quite rarely used format... At least,
> > nowadays the need to visit a 7z archive arises more often
> > than for obsolete formats...still supported by arc-mode.el.
>
> I have nothing against adding support for 7z archives, although that
> would be a new feature.
I have no opinion about this or more generally about this bug.
I just want to mention that my company, which is a large software company, asked
_everyone_ a few months back to install 7zip and get rid of Winzip from our work
computers. I believe the reason was to save money somehow.
Just thought I'd mention it, in case it's relevant. If this experience is at all
typical or becomes so, then more people could be using 7zip. (I have no idea how
widespread its use is now or might become.)
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 21:21 ` Drew Adams
@ 2010-02-01 21:52 ` Eli Zaretskii
2010-02-01 22:04 ` Drew Adams
0 siblings, 1 reply; 36+ messages in thread
From: Eli Zaretskii @ 2010-02-01 21:52 UTC (permalink / raw)
To: Drew Adams; +Cc: 5475, cyd
> From: "Drew Adams" <drew.adams@oracle.com>
> Cc: <5475@debbugs.gnu.org>, <cyd@stupidchicken.com>
> Date: Mon, 1 Feb 2010 13:21:42 -0800
>
> I just want to mention that my company, which is a large software company, asked
> _everyone_ a few months back to install 7zip and get rid of Winzip from our work
> computers. I believe the reason was to save money somehow.
We support "unzip", not WinZip.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 15:43 ` Stefan Monnier
@ 2010-02-01 21:55 ` Juri Linkov
2010-02-02 0:11 ` Lennart Borgman
` (2 more replies)
0 siblings, 3 replies; 36+ messages in thread
From: Juri Linkov @ 2010-02-01 21:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 5475
> AFAIK 7zip is Free Software, but adding 7z support would be a new
> feature, so we would probably be better off insalling it into the
> `pending' branch.
Below is minimal support for the 7z format for the `pending' branch.
Fortunately, 7z provides so-called "technical" mode for the list
command (-slt) that outputs file information in a simple fixed format,
so we could rely on it. In `archive-7z-extract' stderr is thrown away
because 7z doesn't have a switch to make it silent.
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el 2010-02-01 21:48:09 +0000
@@ -52,17 +52,17 @@
;; ARCHIVE TYPES: Currently only the archives below are handled, but the
;; structure for handling just about anything is in place.
;;
-;; Arc Lzh Zip Zoo Rar
-;; ----------------------------------------
-;; View listing Intern Intern Intern Intern Y
-;; Extract member Y Y Y Y Y
-;; Save changed member Y Y Y Y N
-;; Add new member N N N N N
-;; Delete member Y Y Y Y N
-;; Rename member Y Y N N N
-;; Chmod - Y Y - N
-;; Chown - Y - - N
-;; Chgrp - Y - - N
+;; Arc Lzh Zip Zoo Rar 7z
+;; --------------------------------------------
+;; View listing Intern Intern Intern Intern Y Y
+;; Extract member Y Y Y Y Y Y
+;; Save changed member Y Y Y Y N N
+;; Add new member N N N N N N
+;; Delete member Y Y Y Y N N
+;; Rename member Y Y N N N N
+;; Chmod - Y Y - N N
+;; Chown - Y - - N N
+;; Chgrp - Y - - N N
;;
;; Special thanks to Bill Brodie <wbrodie@panix.com> for very useful tips
;; on the first released version of this package.
@@ -315,6 +315,20 @@ (defcustom archive-zoo-write-file-member
:inline t
(string :format "%v")))
:group 'archive-zoo)
+;; ------------------------------
+;; 7z archive configuration
+
+(defcustom archive-7z-extract
+ '("7z" "x" "-so")
+ "Program and its options to run in order to extract a 7z file member.
+Extraction should happen to standard output. Archive and member name will
+be added."
+ :type '(list (string :tag "Program")
+ (repeat :tag "Options"
+ :inline t
+ (string :format "%v")))
+ :group 'archive-7z)
+
;; -------------------------------------------------------------------------
;;; Section: Variables
@@ -732,6 +746,7 @@ (defun archive-find-type ()
((and (looking-at "MZ")
(re-search-forward "Rar!" (+ (point) 100000) t))
'rar-exe)
+ ((looking-at "7z\274\257\047\034") '7z)
(t (error "Buffer format not recognized")))))
;; -------------------------------------------------------------------------
@@ -1084,6 +1099,14 @@ (defun archive-extract-by-stdout (archiv
nil
(append (cdr command) (list archive name))))
+(defun archive-extract-by-stdout-without-stderr (archive name command)
+ (apply 'call-process
+ (car command)
+ nil
+ '(t nil)
+ nil
+ (append (cdr command) (list archive name))))
+
(defun archive-extract-other-window ()
"In archive mode, find this member in another window."
(interactive)
@@ -1995,7 +2023,57 @@ (defun archive-rar-exe-extract (archive
(if tmpbuf (kill-buffer tmpbuf))
(delete-file tmpfile))))
+;; -------------------------------------------------------------------------
+;;; Section: 7z Archives
+
+(defun archive-7z-summarize ()
+ (let ((maxname 10)
+ (maxsize 5)
+ (file buffer-file-name)
+ (files ()))
+ (with-temp-buffer
+ (call-process "7z" nil t nil "l" "-slt" file)
+ (goto-char (point-min))
+ (re-search-forward "^-+\n")
+ (while (re-search-forward "^Path = \\(.*\\)\n" nil t)
+ (goto-char (match-end 0))
+ (let ((name (match-string 1))
+ (size (save-excursion
+ (and (re-search-forward "^Size = \\(.*\\)\n")
+ (match-string 1))))
+ (time (save-excursion
+ (and (re-search-forward "^Modified = \\(.*\\)\n")
+ (match-string 1)))))
+ (if (> (length name) maxname) (setq maxname (length name)))
+ (if (> (length size) maxsize) (setq maxsize (length size)))
+ (push (vector name name nil nil time nil nil size)
+ files))))
+ (setq files (nreverse files))
+ (goto-char (point-min))
+ (let* ((format (format " %%%ds %%s %%s" maxsize))
+ (sep (format format (make-string maxsize ?-) "-------------------" ""))
+ (column (length sep)))
+ (insert (format format "Size " "Date Time " " Filename") "\n")
+ (insert sep (make-string maxname ?-) "\n")
+ (archive-summarize-files (mapcar (lambda (desc)
+ (let ((text
+ (format format
+ (aref desc 7)
+ (aref desc 4)
+ (aref desc 1))))
+ (vector text
+ column
+ (length text))))
+ files))
+ (insert sep (make-string maxname ?-) "\n")
+ (apply 'vector files))))
+
+(defun archive-7z-extract (archive name)
+ ;; Throw away stderr because 7z doesn't have a switch to make it silent.
+ (archive-extract-by-stdout-without-stderr
+ archive name archive-7z-extract))
+;; -------------------------------------------------------------------------
;;; Section `ar' archives.
;; TODO: we currently only handle the basic format of ar archives,
=== modified file 'lisp/files.el'
--- lisp/files.el 2010-01-27 03:36:36 +0000
+++ lisp/files.el 2010-02-01 21:45:39 +0000
@@ -2252,8 +2252,8 @@ (defvar auto-mode-alist
;; The list of archive file extensions should be in sync with
;; `auto-coding-alist' with `no-conversion' coding system.
("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode)
+arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
+ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode)
("\\.\\(sx[dmicw]\\|od[fgpst]\\|oxt\\)\\'" . archive-mode) ;OpenOffice.org
("\\.\\(deb\\|[oi]pk\\)\\'" . archive-mode) ; Debian/Opkg packages.
;; Mailer puts message to be edited in
=== modified file 'lisp/international/mule.el'
--- lisp/international/mule.el 2010-01-13 08:35:10 +0000
+++ lisp/international/mule.el 2010-02-01 21:43:42 +0000
@@ -1626,8 +1626,8 @@ (defcustom auto-coding-alist
;; .exe and .EXE are added to support archive-mode looking at DOS
;; self-extracting exe archives.
(purecopy '(("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'"
+arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
+ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7z\\)\\'"
. no-conversion-multibyte)
("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion)
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 21:52 ` Eli Zaretskii
@ 2010-02-01 22:04 ` Drew Adams
0 siblings, 0 replies; 36+ messages in thread
From: Drew Adams @ 2010-02-01 22:04 UTC (permalink / raw)
To: 'Eli Zaretskii'; +Cc: 5475, cyd
> > I just want to mention that my company, which is a large
> > software company, asked _everyone_ a few months back to
> > install 7zip and get rid of Winzip from our work
> > computers. I believe the reason was to save money somehow.
>
> We support "unzip", not WinZip.
My point was not about WinZip; it was about 7zip: it might be that more people
will use 7zip than has been true in the past.
That's all. HTH.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 19:49 ` Eli Zaretskii
2010-02-01 21:21 ` Drew Adams
@ 2010-02-01 22:39 ` Juri Linkov
2010-02-01 22:41 ` Lennart Borgman
2 siblings, 0 replies; 36+ messages in thread
From: Juri Linkov @ 2010-02-01 22:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
>> Do you mean we don't need to support 7z in 23.2 or at all?
>
> At all, for .zip files.
Ah, I see. So I installed only a fix for pkzip/pkunzip
without mentioning 7z.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 19:49 ` Eli Zaretskii
2010-02-01 21:21 ` Drew Adams
2010-02-01 22:39 ` Juri Linkov
@ 2010-02-01 22:41 ` Lennart Borgman
2010-02-02 0:10 ` Lennart Borgman
2 siblings, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-02-01 22:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
On Mon, Feb 1, 2010 at 8:49 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Are there some problems with 7z that makes undesirable to support it
>> (maybe, it is not free software, or has an unsuitable license?)
>
> Its support for zip archives is sporadic at best. On one GNU/Linux
> system I tried it, it insisted that a .zip file format was
> unsupported, although its Windows version that was older unzipped it
> with no trouble at all.
My impression of 7-zip and the author Igor Pavlov is very positive.
Some years ago I followed the discussion in the support forum a bit. I
found good reasoning from the author. And things got fixed.
I would be surprised if the GNU/Linux support will not be very good too.
> Go figure. And the fact that it doesn't have
> a switch to make it silent, and you need to throw away its stderr
> (which means you cannot display error messages) is yet another
> nuisance.
I think this is a kind of thing you can ask for on the support lists.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 22:41 ` Lennart Borgman
@ 2010-02-02 0:10 ` Lennart Borgman
2010-02-02 0:42 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-02-02 0:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 5475, cyd
On Mon, Feb 1, 2010 at 11:41 PM, Lennart Borgman
<lennart.borgman@gmail.com> wrote:
>
>> And the fact that it doesn't have
>> a switch to make it silent, and you need to throw away its stderr
>> (which means you cannot display error messages) is yet another
>> nuisance.
>
>
> I think this is a kind of thing you can ask for on the support lists.
There is already a feature request for this in the 7-zip tracker at sourceforge.
Eli, if you could specify exactly what would be useful for Emacs then
I could add it to the feature request.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 21:55 ` Juri Linkov
@ 2010-02-02 0:11 ` Lennart Borgman
2010-02-02 0:46 ` Juri Linkov
2010-02-02 4:03 ` Eli Zaretskii
2010-04-18 23:14 ` Juri Linkov
2 siblings, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-02-02 0:11 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475
On Mon, Feb 1, 2010 at 10:55 PM, Juri Linkov <juri@jurta.org> wrote:
>> AFAIK 7zip is Free Software, but adding 7z support would be a new
>> feature, so we would probably be better off insalling it into the
>> `pending' branch.
>
> Below is minimal support for the 7z format for the `pending' branch.
I think it would be very useful (at least on w32) to allow 7-zip to
handle all compressed libraries.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-02 0:10 ` Lennart Borgman
@ 2010-02-02 0:42 ` Juri Linkov
2010-02-02 1:30 ` Lennart Borgman
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-02-02 0:42 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475, cyd
>>> And the fact that it doesn't have a switch to make it silent, and
>>> you need to throw away its stderr (which means you cannot display
>>> error messages) is yet another nuisance.
>>
>> I think this is a kind of thing you can ask for on the support lists.
>
> There is already a feature request for this in the 7-zip tracker at sourceforge.
>
> Eli, if you could specify exactly what would be useful for Emacs then
> I could add it to the feature request.
I can answer this question. All major file compressors except 7-zip
have such an option.
man bzip2:
-q --quiet
Suppress non-essential warning messages. Messages pertaining
to I/O errors and other critical events will not be suppressed.
man gzip:
-q --quiet
Suppress all warnings.
man unzip:
-q perform operations quietly (-qq = even quieter). Ordinarily unzip
prints the names of the files it’s extracting or testing, the
extraction methods, any file or zipfile comments that may be
stored in the archive, and possibly a summary when finished with
each archive. The -q[q] options suppress the printing of some or
all of these messages.
man unrar:
-inul Disable all messages.
(the latter switch name is quite ugly)
There are many ignored requests to add such option to 7-zip:
http://sourceforge.net/projects/sevenzip/forums/forum/45797/topic/3376726?message=7580176
http://sourceforge.net/projects/p7zip/forums/forum/383044/topic/1270756
http://bugs.gentoo.org/show_bug.cgi?id=135134
http://osdir.com/ml/debian-bugs-dist/2009-05/msg03287.html
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6643529
If you want add a new request, please ask for -q --quiet at sourceforge.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-02 0:11 ` Lennart Borgman
@ 2010-02-02 0:46 ` Juri Linkov
0 siblings, 0 replies; 36+ messages in thread
From: Juri Linkov @ 2010-02-02 0:46 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475
> I think it would be very useful (at least on w32) to allow 7-zip to
> handle all compressed libraries.
To handle all compressed libraries, we need a new option -q --quiet
because we don't need unnecessary messages in stderr, but we can't ignore
stderr because it may contain error messages.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-02 0:42 ` Juri Linkov
@ 2010-02-02 1:30 ` Lennart Borgman
2010-02-02 10:03 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-02-02 1:30 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475, cyd
On Tue, Feb 2, 2010 at 1:42 AM, Juri Linkov <juri@jurta.org> wrote:
>>>> And the fact that it doesn't have a switch to make it silent, and
>>>> you need to throw away its stderr (which means you cannot display
>>>> error messages) is yet another nuisance.
>>>
>>> I think this is a kind of thing you can ask for on the support lists.
>>
>> There is already a feature request for this in the 7-zip tracker at sourceforge.
>>
>> Eli, if you could specify exactly what would be useful for Emacs then
>> I could add it to the feature request.
>
> I can answer this question. All major file compressors except 7-zip
> have such an option.
>
> man bzip2:
>
> -q --quiet
>
> Suppress non-essential warning messages. Messages pertaining
> to I/O errors and other critical events will not be suppressed.
>
> man gzip:
>
> -q --quiet
> Suppress all warnings.
>
> If you want add a new request, please ask for -q --quiet at sourceforge.
Which version, the bzip2 or the gzip?
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 21:55 ` Juri Linkov
2010-02-02 0:11 ` Lennart Borgman
@ 2010-02-02 4:03 ` Eli Zaretskii
2010-04-18 23:14 ` Juri Linkov
2 siblings, 0 replies; 36+ messages in thread
From: Eli Zaretskii @ 2010-02-02 4:03 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475
> From: Juri Linkov <juri@jurta.org>
> Date: Mon, 01 Feb 2010 23:55:35 +0200
> Cc: 5475@debbugs.gnu.org
>
> > AFAIK 7zip is Free Software, but adding 7z support would be a new
> > feature, so we would probably be better off insalling it into the
> > `pending' branch.
>
> Below is minimal support for the 7z format for the `pending' branch.
Thanks. Please don't forget a NEWS entry.
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-02 1:30 ` Lennart Borgman
@ 2010-02-02 10:03 ` Juri Linkov
2010-02-03 0:17 ` Lennart Borgman
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-02-02 10:03 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475
>> man bzip2:
>>
>> -q --quiet
>>
>> Suppress non-essential warning messages. Messages pertaining
>> to I/O errors and other critical events will not be suppressed.
>>
>> man gzip:
>>
>> -q --quiet
>> Suppress all warnings.
>>
>> If you want add a new request, please ask for -q --quiet at sourceforge.
>
> Which version, the bzip2 or the gzip?
Whatever. The main point is that with -q --quiet it should output only
critical error messages.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-02 10:03 ` Juri Linkov
@ 2010-02-03 0:17 ` Lennart Borgman
2010-02-03 0:35 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Lennart Borgman @ 2010-02-03 0:17 UTC (permalink / raw)
To: Juri Linkov; +Cc: 5475
On Tue, Feb 2, 2010 at 11:03 AM, Juri Linkov <juri@jurta.org> wrote:
>
> Whatever. The main point is that with -q --quiet it should output only
> critical error messages.
I have added our comments to this feature request for 7-zip:
https://sourceforge.net/tracker/index.php?func=detail&aid=2813266&group_id=14481&atid=364481
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-03 0:17 ` Lennart Borgman
@ 2010-02-03 0:35 ` Juri Linkov
2010-02-03 23:54 ` Juri Linkov
0 siblings, 1 reply; 36+ messages in thread
From: Juri Linkov @ 2010-02-03 0:35 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475
>> Whatever. The main point is that with -q --quiet it should output only
>> critical error messages.
>
> I have added our comments to this feature request for 7-zip:
>
> https://sourceforge.net/tracker/index.php?func=detail&aid=2813266&group_id=14481&atid=364481
Thanks.
Until this option is implemented we should ignore stderr.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-03 0:35 ` Juri Linkov
@ 2010-02-03 23:54 ` Juri Linkov
0 siblings, 0 replies; 36+ messages in thread
From: Juri Linkov @ 2010-02-03 23:54 UTC (permalink / raw)
To: Lennart Borgman; +Cc: 5475
> Until this option is implemented we should ignore stderr.
Hmm, discarding stderr is too bad. Better would be to redirect stderr
to a temporary file and display it when it contains error messages
(a pending patch):
=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el 2010-02-01 22:35:04 +0000
+++ lisp/arc-mode.el 2010-02-03 23:54:00 +0000
@@ -1076,11 +1099,11 @@ (defun archive-*-extract (archive name c
(archive-delete-local tmpfile)
success))
-(defun archive-extract-by-stdout (archive name command)
+(defun archive-extract-by-stdout (archive name command &optional stderr-file)
(apply 'call-process
(car command)
nil
- t
+ (if stderr-file (list t stderr-file) t)
nil
(append (cdr command) (list archive name))))
@@ -1999,7 +2022,65 @@ (defun archive-rar-exe-extract (archive
(if tmpbuf (kill-buffer tmpbuf))
(delete-file tmpfile))))
+(defun archive-7z-extract (archive name)
+ (let ((tmpfile (make-temp-file "7z-stderr")))
+ ;; 7z doesn't provide a `quiet' option to suppress non-essential
+ ;; stderr messages. So redirect stderr to a temp file and display it
+ ;; in the echo area when it contains error messages.
+ (prog1 (archive-extract-by-stdout
+ archive name archive-7z-extract tmpfile)
+ (with-temp-buffer
+ (insert-file-contents tmpfile)
+ (unless (search-forward "Everything is Ok" nil t)
+ (message (buffer-string)))
+ (delete-file tmpfile)))))
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
* bug#5475: Archives with filenames with square brackets
2010-02-01 21:55 ` Juri Linkov
2010-02-02 0:11 ` Lennart Borgman
2010-02-02 4:03 ` Eli Zaretskii
@ 2010-04-18 23:14 ` Juri Linkov
2 siblings, 0 replies; 36+ messages in thread
From: Juri Linkov @ 2010-04-18 23:14 UTC (permalink / raw)
To: 5475-done
> Below is minimal support for the 7z format
Patch installed to the trunk, bug closed.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2010-04-18 23:14 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 17:48 bug#5475: Archives with filenames with square brackets Juri Linkov
2010-01-26 21:05 ` Chong Yidong
2010-01-26 21:47 ` Eli Zaretskii
2010-01-27 16:57 ` Chong Yidong
2010-01-27 17:35 ` Eli Zaretskii
2010-01-28 20:07 ` Chong Yidong
2010-01-28 21:05 ` Eli Zaretskii
2010-01-28 21:24 ` Lennart Borgman
2010-01-28 22:00 ` Eli Zaretskii
2010-01-30 22:59 ` Juri Linkov
2010-01-31 4:18 ` Eli Zaretskii
2010-01-31 10:56 ` Juri Linkov
2010-01-31 18:04 ` Eli Zaretskii
2010-01-31 21:59 ` Juri Linkov
2010-02-01 4:15 ` Eli Zaretskii
2010-02-01 10:34 ` Juri Linkov
2010-02-01 11:48 ` Lennart Borgman
2010-02-01 15:43 ` Stefan Monnier
2010-02-01 21:55 ` Juri Linkov
2010-02-02 0:11 ` Lennart Borgman
2010-02-02 0:46 ` Juri Linkov
2010-02-02 4:03 ` Eli Zaretskii
2010-04-18 23:14 ` Juri Linkov
2010-02-01 19:49 ` Eli Zaretskii
2010-02-01 21:21 ` Drew Adams
2010-02-01 21:52 ` Eli Zaretskii
2010-02-01 22:04 ` Drew Adams
2010-02-01 22:39 ` Juri Linkov
2010-02-01 22:41 ` Lennart Borgman
2010-02-02 0:10 ` Lennart Borgman
2010-02-02 0:42 ` Juri Linkov
2010-02-02 1:30 ` Lennart Borgman
2010-02-02 10:03 ` Juri Linkov
2010-02-03 0:17 ` Lennart Borgman
2010-02-03 0:35 ` Juri Linkov
2010-02-03 23:54 ` Juri Linkov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).