all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6144: 23.2; unzip arguments quoting
@ 2010-05-09  1:10 Dmitry Gutov
  2010-05-09 21:13 ` Lennart Borgman
       [not found] ` <mailman.2.1273440410.17813.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Gutov @ 2010-05-09  1:10 UTC (permalink / raw
  To: 6144

When I tried to open any zip or jar archive in dired and view contents 
of any file
inside, Emacs just writes "caution: filename not matched: "<internal path>".
An investigation with Process Explorer Monitor has led me to believe 
that Emacs
launches the unzip executable with parameters -qq -c "<filename>"
"\"<internal path>\"", and the extra escaped quotes in the last 
parameter are
the source of the problem.

Replacing

"(if (equal (car archive-zip-extract) "unzip")
      (shell-quote-argument name)
        name)"

with "name"

in arc-mode.el and recompiling the file solved the problem.


In GNU Emacs 23.2.1 (i386-mingw-nt6.1.7600)
  of 2010-05-08 on G41R2F1
Windowing system distributor `Microsoft Corp.', version 6.1.7600
configured using `configure --with-gcc (3.4) --no-opt --cflags 
-Ic:/xpm/include'

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: RUS
   value of $XMODIFIERS: nil
   locale-coding-system: cp1251
   default enable-multibyte-characters: t

Major mode: Text

Minor modes in effect:
   tooltip-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
M-x d i r e d <return> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> g : \ d o w n <tab> m i r a
n <tab> <tab> <return> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <return>
<down> <down> <up> <up> <down> <return> <help-echo>
<help-echo> <help-echo> C-x C-s a s d C-x C-s a s d
a s d C-x C-c <down-mouse-1> <mouse-1> <help-echo>
<help-echo> <help-echo> C-g M-x r e p o r t - e m a
c s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Parsing archive file...done.
(No changes need to be saved)
Saving file g:/Downloads/Miranda 
IM/historyppbn.zip:docs/hpp_changelog.txt...
Updating archive...
apply: Searching for program: no such file or directory, zip
Type C-h for help. [2 times]
Quit

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1
hex-util hashcash mail-utils emacsbug arc-mode archive-mode help-mode
easymenu view dired regexp-opt tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)








^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6144: 23.2; unzip arguments quoting
  2010-05-09  1:10 bug#6144: 23.2; unzip arguments quoting Dmitry Gutov
@ 2010-05-09 21:13 ` Lennart Borgman
  2010-05-09 23:09   ` Dmitry Gutov
       [not found] ` <mailman.2.1273440410.17813.bug-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Lennart Borgman @ 2010-05-09 21:13 UTC (permalink / raw
  To: Dmitry Gutov; +Cc: 6144

On Sun, May 9, 2010 at 3:10 AM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> When I tried to open any zip or jar archive in dired and view contents of
> any file
> inside, Emacs just writes "caution: filename not matched: "<internal path>".
> An investigation with Process Explorer Monitor has led me to believe that
> Emacs
> launches the unzip executable with parameters -qq -c "<filename>"
> "\"<internal path>\"", and the extra escaped quotes in the last parameter
> are
> the source of the problem.
>
> Replacing
>
> "(if (equal (car archive-zip-extract) "unzip")
>     (shell-quote-argument name)
>       name)"
>
> with "name"
>
> in arc-mode.el and recompiling the file solved the problem.

Thanks for the bug report, Dmitry. However the current code seems to
work well with the unzip program from gnuwin32:

  UnZip 5.51 of 22 May 2004, by Info-ZIP.

What unzip program are you using?






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6144: 23.2; unzip arguments quoting
  2010-05-09 21:13 ` Lennart Borgman
@ 2010-05-09 23:09   ` Dmitry Gutov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2010-05-09 23:09 UTC (permalink / raw
  To: Lennart Borgman; +Cc: 6144

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On 10.05.2010 1:13, Lennart Borgman wrote:
> Thanks for the bug report, Dmitry. However the current code seems to
> work well with the unzip program from gnuwin32:
>
>    UnZip 5.51 of 22 May 2004, by Info-ZIP.
>
> What unzip program are you using?
>    

The same program and version, although it reports modification date of 
14 Feb 2005.
I've just now verified that emacs 23.1 doesn't exhibit this bug, with 
the same unzip.exe, init.el, etc.

If you compare the sources of archive-zip-extract in arc-mode.el between 
versions 23.1 and 23.2, the addition of (shell-quote-argument name) for 
"unzip" is the main change. It seems that this argument is quoted again 
by 'call-process, see attached callstack.txt and procmon.png.


[-- Attachment #2: callstack.txt --]
[-- Type: text/plain, Size: 4339 bytes --]

Debugger entered: nil
  archive-extract-by-stdout("g:/Downloads/Prog/reflector.zip" "\"License.txt\"" ("unzip" "-qq" "-c"))
  (if (member-ignore-case (car archive-zip-extract) (quote ...)) (archive-*-extract archive name archive-zip-extract) (archive-extract-by-stdout archive (if ... ... name) archive-zip-extract))
  archive-zip-extract("g:/Downloads/Prog/reflector.zip" "License.txt")
  funcall(archive-zip-extract "g:/Downloads/Prog/reflector.zip" "License.txt")
  (if (fboundp extractor) (funcall extractor archive ename) (archive-*-extract archive ename (symbol-value extractor)))
  (condition-case err (if (fboundp extractor) (funcall extractor archive ename) (archive-*-extract archive ename ...)) (error (ding ...) nil))
  (let ((coding-system-for-write ...) (coding-system-for-read ...)) (condition-case err (if ... ... ...) (error ... nil)))
  (null (let (... ...) (condition-case err ... ...)))
  (and (null (let ... ...)) just-created)
  (if (and (null ...) just-created) (progn (set-buffer-modified-p nil) (kill-buffer buffer)) (archive-try-jka-compr) (archive-set-buffer-as-visiting-file ename) (goto-char (point-min)) (rename-buffer bufname) (setq buffer-read-only read-only-p) (setq buffer-undo-list nil) (set-buffer-modified-p nil) (setq buffer-saved-size (buffer-size)) (normal-mode) (when (derived-mode-p ...) (setq archive-remote t) (if read-only-p ...) (remove-hook ... ... t)) (run-hooks (quote archive-extract-hooks)) (if archive-read-only (message "Note: altering this archive is not implemented.")))
  (save-current-buffer (set-buffer buffer) (setq buffer-file-name arcfilename) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) (setq default-directory arcdir) (make-local-variable (quote archive-superior-buffer)) (setq archive-superior-buffer archive-buffer) (add-hook (quote write-file-functions) (quote archive-write-file-member) nil t) (setq archive-subfile-mode descr) (setq archive-file-name-coding-system file-name-coding) (if (and ... just-created) (progn ... ...) (archive-try-jka-compr) (archive-set-buffer-as-visiting-file ename) (goto-char ...) (rename-buffer bufname) (setq buffer-read-only read-only-p) (setq buffer-undo-list nil) (set-buffer-modified-p nil) (setq buffer-saved-size ...) (normal-mode) (when ... ... ... ...) (run-hooks ...) (if archive-read-only ...)))
  (with-current-buffer buffer (setq buffer-file-name arcfilename) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) (setq default-directory arcdir) (make-local-variable (quote archive-superior-buffer)) (setq archive-superior-buffer archive-buffer) (add-hook (quote write-file-functions) (quote archive-write-file-member) nil t) (setq archive-subfile-mode descr) (setq archive-file-name-coding-system file-name-coding) (if (and ... just-created) (progn ... ...) (archive-try-jka-compr) (archive-set-buffer-as-visiting-file ename) (goto-char ...) (rename-buffer bufname) (setq buffer-read-only read-only-p) (setq buffer-undo-list nil) (set-buffer-modified-p nil) (setq buffer-saved-size ...) (normal-mode) (when ... ... ... ...) (run-hooks ...) (if archive-read-only ...)))
  (if (and buffer (string= ... arcfilename)) nil (setq archive (archive-maybe-copy archive)) (setq bufname (generate-new-buffer-name bufname)) (setq buffer (get-buffer-create bufname)) (setq just-created t) (with-current-buffer buffer (setq buffer-file-name arcfilename) (setq buffer-file-truename ...) (setq default-directory arcdir) (make-local-variable ...) (setq archive-superior-buffer archive-buffer) (add-hook ... ... nil t) (setq archive-subfile-mode descr) (setq archive-file-name-coding-system file-name-coding) (if ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) (archive-maybe-update t))
  (let* ((view-p ...) (descr ...) (ename ...) (iname ...) (archive-buffer ...) (arcdir default-directory) (archive ...) (arcname ...) (bufname ...) (extractor ...) (read-only-p ...) (arcfilename ...) (buffer ...) (just-created nil) (file-name-coding archive-file-name-coding-system)) (if (and buffer ...) nil (setq archive ...) (setq bufname ...) (setq buffer ...) (setq just-created t) (with-current-buffer buffer ... ... ... ... ... ... ... ... ...) (archive-maybe-update t)) (or (not ...) (cond ... ... ... ...)))
  archive-extract(nil return)
  call-interactively(archive-extract nil nil)

[-- Attachment #3: procmon.png --]
[-- Type: image/png, Size: 44929 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bug#6144: 23.2; unzip arguments quoting
       [not found]   ` <yz6vdam4cgi.fsf@sas.com>
@ 2010-05-18 11:22     ` hm
  0 siblings, 0 replies; 4+ messages in thread
From: hm @ 2010-05-18 11:22 UTC (permalink / raw
  To: bug-gnu-emacs

I also had this problem. Following the lead of Dmitry I solved it by
changing archive-zip-extract in arc-mode.el to:

(defun archive-zip-extract (archive name)
  (if (member-ignore-case (car archive-zip-extract) '("pkunzip"
"pkzip"))
      (archive-*-extract archive name archive-zip-extract)
    (archive-extract-by-stdout
     archive
     ;; unzip expands wildcards in NAME, so we need to quote it.
     ;; FIXME: Does pkunzip need similar treatment?
     (if (and (not w32-quote-process-args) ;; <----
              (equal (car archive-zip-extract) "unzip")
              )
	 (shell-quote-argument name)
       name)
     archive-zip-extract)))




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-18 11:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-09  1:10 bug#6144: 23.2; unzip arguments quoting Dmitry Gutov
2010-05-09 21:13 ` Lennart Borgman
2010-05-09 23:09   ` Dmitry Gutov
     [not found] ` <mailman.2.1273440410.17813.bug-gnu-emacs@gnu.org>
     [not found]   ` <yz6vdam4cgi.fsf@sas.com>
2010-05-18 11:22     ` hm

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.