diff options
author | Glenn Morris <rgm@gnu.org> | 2012-12-30 10:09:01 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2012-12-30 10:09:01 -0800 |
commit | d5e5e7b41166815a843148f2081d19bc14b628b2 (patch) | |
tree | 6afd575b3a741ce26e5ec1e2665d45dfab8cbb52 /lisp/emacs-lisp | |
parent | 4f752957f174b5ab95ef6b9428669b1b1ecf0bab (diff) | |
parent | 5c560880659048888420389c02e20d6867ec81df (diff) | |
download | emacs-d5e5e7b41166815a843148f2081d19bc14b628b2.tar.gz emacs-d5e5e7b41166815a843148f2081d19bc14b628b2.tar.bz2 emacs-d5e5e7b41166815a843148f2081d19bc14b628b2.zip |
Merge from emacs-24; up to 2012-12-05T00:13:56Z!yamaoka@jpl.org
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6629410a1f1..96435e52f11 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -596,6 +596,8 @@ EXTRA-PROPERTIES is currently unused." (defvar tar-parse-info) (declare-function tar-untar-buffer "tar-mode" ()) +(declare-function tar-header-name "tar-mode" (tar-header)) +(declare-function tar-header-link-type "tar-mode" (tar-header)) (defun package-untar-buffer (dir) "Untar the current buffer. @@ -604,10 +606,16 @@ untar into a directory named DIR; otherwise, signal an error." (require 'tar-mode) (tar-mode) ;; Make sure everything extracts into DIR. - (let ((regexp (concat "\\`" (regexp-quote dir) "/"))) + (let ((regexp (concat "\\`" (regexp-quote (expand-file-name dir)) "/")) + (case-fold-search (memq system-type '(windows-nt ms-dos cygwin)))) (dolist (tar-data tar-parse-info) - (unless (string-match regexp (aref tar-data 2)) - (error "Package does not untar cleanly into directory %s/" dir)))) + (let ((name (expand-file-name (tar-header-name tar-data)))) + (or (string-match regexp name) + ;; Tarballs created by some utilities don't list + ;; directories with a trailing slash (Bug#13136). + (and (string-equal dir name) + (eq (tar-header-link-type tar-data) 5)) + (error "Package does not untar cleanly into directory %s/" dir))))) (tar-untar-buffer)) (defun package-unpack (package version) |