Subject: bug#13136: 24.2; tar-ball packages created on windows do not work

From: "Fidler, Matt" <[email-masked]>
Date: Mon, 10 Dec 2012 16:27:56 +0000

Any tar-ball package created with 7zip or with bsdtar includes the

directory structure of a package as follows:

org-readme-0.11

org-readme-0.11\org-readme-pkg.el

org-readme-0.11\dir

org-readme-0.11\org-readme.info

org-readme-0.11\org-readme.el

However when created on Linux (and possibly OSX) the directory structure

in the tar package follows the following convention

org-readme-0.11\

org-readme-0.11\org-readme-pkg.el

org-readme-0.11\dir

org-readme-0.11\org-readme.info

org-readme-0.11\org-readme.el

Packages created on windows in this fashion will not install properly

for emacs at all.  This is because of the function package-untar-buffer

(defun package-untar-buffer (dir)

  "Untar the current buffer.

This uses `tar-untar-buffer' from Tar mode.  All files should

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) "/")))

    (dolist (tar-data tar-parse-info)

      (unless (string-match regexp (aref tar-data 2))

            (error "Package does not untar cleanly into directory %s/" dir))))

  (tar-untar-buffer))

It assumes even the directory has a trailing backslash.  This can easily

be fixed by adjusting the regular expression as follows:

(defun package-untar-buffer (dir)

  "Untar the current buffer.

This uses `tar-untar-buffer' from Tar mode.  All files should

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) "\\(/\\|\\'\\)")))

    (dolist (tar-data tar-parse-info)

      (unless (string-match regexp (aref tar-data 2))

            (error "Package does not untar cleanly into directory %s/" dir))))

  (tar-untar-buffer))

or something similar.  Can this be applied to the emacs lisp tree?

Matt.

In GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600)

of 2012-08-28 on MARVIN

Windowing system distributor `Microsoft Corp.', version 5.1.2600

Configured using:

`configure --with-gcc (4.6) --cflags

-ID:/devel/emacs/libs/libXpm-3.5.8/include

-ID:/devel/emacs/libs/libXpm-3.5.8/src

-ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include

-ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include

-ID:/devel/emacs/libs/giflib-4.1.4-1/include

-ID:/devel/emacs/libs/jpeg-6b-4/include

-ID:/devel/emacs/libs/tiff-3.8.2-1/include

-ID:/devel/emacs/libs/gnutls-3.0.9/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: en

  value of $XMODIFIERS: nil

  locale-coding-system: cp1252

  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:

  helm-match-plugin-mode: t

  projectile-mode: t

  projectile-global-mode: t

  tabbar-mwheel-mode: t

  tabbar-mode: t

  savehist-mode: t

  show-paren-mode: t

  global-linum-mode: t

  global-subword-mode: t

  subword-mode: t

  eldoc-mode: t

  yas-global-mode: t

  yas-minor-mode: t

  ido-ubiquitous-mode: t

  global-auto-complete-mode: t

  auto-complete-mode: t

  auto-indent-global-mode: t

  auto-indent-minor-mode: t

  autopair-mode: t

  autopair-global-mode: t

  ergoemacs-mode: t

  cua-mode: t

  ido-everywhere: t

  flyspell-mode: t

  shell-dirtrack-mode: t

  recentf-mode: t

  tooltip-mode: t

  mouse-wheel-mode: t

  file-name-shadow-mode: t

  global-font-lock-mode: t

  font-lock-mode: t

  blink-cursor-mode: t

  auto-composition-mode: t

  auto-encryption-mode: t

  auto-compression-mode: t

  column-number-mode: t

  line-number-mode: t

  transient-mark-mode: t

Recent input:

<switch-frame> <switch-frame> <help-echo> <help-echo>

<help-echo> <lwindow> <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <help-echo> <down-mouse-1>

<mouse-1> <help-echo> C-o <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <down-mouse-1>

<drag-mouse-1> c : / m s / 0 0 1 0 <return> <help-echo>

<help-echo> <down-mouse-1> <mouse-1> <double-down-mouse-1>

<double-mouse-1> R <return> m <return> <down-mouse-1>

<mouse-1> <down-mouse-1> <mouse-1> C-a C-c <timeout>

<down-mouse-1> <mouse-1> C-a C-c <timeout> <down-mouse-1>

<mouse-1> C-o e d <return> C-a C-c <timeout> <down-mouse-3>

<drag-mouse-3> <down-mouse-1> <mouse-1> <help-echo>

<down-mouse-1> <mouse-1> M-3 C-w C-w <down-mouse-1>

<mouse-1> M-o C-g C-w C-w C-w C-w C-w C-w C-w C-w C-w

C-w C-w <down-mouse-1> <mouse-1> <help-echo> <help-echo>

<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>

<mouse-1> <help-echo> <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>

<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu>

<send-emacs-bug-report>

Recent messages:

Saving file u:/EmacsPortable.App/Data/saves/ido-last-USFTW00PBEV464...

Loading vc-git...done

Wrote u:/EmacsPortable.App/Data/saves/ido-last-USFTW00PBEV464

Saving file U:/EmacsPortable.App/Data/start/EmacsMate/custom.el...

Wrote U:/EmacsPortable.App/Data/start/EmacsMate/custom.el [2 times]

Wrote u:/EMACSP~1.APP/Data/saves/places-USFTW00PBEV464

Saving file u:/EmacsPortable.App/Data/saves/recent-files-USFTW00PBEV464...

Wrote u:/EmacsPortable.App/Data/saves/recent-files-USFTW00PBEV464

Back to top level.

When done with this frame, type M-x delete-frame

Load-path shadows:

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/ess-20121104.2332/.dir-locals hides u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/magit-20121030.2025/.dir-locals

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/solarized-theme-20121201.14/solarized-light-theme hides u:/EMACSP~1.APP/Data/src/emacs-color-theme-solarized/solarized-light-theme

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/solarized-theme-20121201.14/solarized-dark-theme hides u:/EMACSP~1.APP/Data/src/emacs-color-theme-solarized/solarized-dark-theme

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/org-readme-20120918.847/org-readme hides u:/EMACSP~1.APP/Data/src/org-readme/org-readme

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/org-readme-20120918.847/org-readme-pkg hides u:/EMACSP~1.APP/Data/src/org-readme/org-readme-20121207.1715/org-readme-pkg

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/org-readme-20120918.847/org-readme hides u:/EMACSP~1.APP/Data/src/org-readme/org-readme-20121207.1715/org-readme

u:/EMACSP~1.APP/Data/src/Emacs-Speaks-NONMEM/etc/build/esn-nm-vars-7 hides u:/EMACSP~1.APP/Data/src/Emacs-Speaks-NONMEM/etc/cookies/esn-nm-vars-7

u:/EMACSP~1.APP/Data/start/EmacsMate/custom hides u:/EMACSP~1.APP/App/eps/../emacs-24.2/lisp/custom

u:/EMACSP~1.APP/Data/start/EmacsMate/elpa/ess-20121104.2332/.dir-locals hides u:/EMACSP~1.APP/App/emacs-24.2/lisp/gnus/.dir-locals

Features:

(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode

mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader

sendmail rfc2047 rfc2045 ietf-drums mail-utils cus-edit vc-git pp

helm-misc helm-files image-dired helm-tags helm-bookmark helm-adaptative

helm-info helm-net xml helm-plugin helm-locate helm-help

helm-match-plugin helm-external helm-buffers helm-grep helm-regexp grep

helm-elscreen helm-utils helm imenu ess-eldoc ess-toolbar ess-mouse

mouseme browse-url ess-menu ess-swv ess-noweb ess-noweb-font-lock-mode

ess-bugs-l essd-els ess-sas-d ess-sas-l ess-sas-a ess-arc-d ess-vst-d

ess-xls-d ess-lsp-l ess-sta-d ess-sta-l cc-vars cc-defs make-regexp

ess-sp6w-d ess-sp4-d ess-sp3-d ess-julia ess-r-d compile ess-tracebug

ess-roxy hideshow ess-help ess-developer ess-r-args ess-s-l ess ess-inf

newcomment ess-mode ess-noweb-mode ess-utils ess-custom executable

ess-compat ess-site debug melpa projectile s tabbar-ruler ruler-mode

mule-util tabbar savehist paren linum-off linum subword dired+ dired-x

dired-aux dired em-unix em-term term ehelp electric em-script em-prompt

em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic esh-opt em-banner

em-alias esh-var esh-io esh-cmd esh-ext esh-proc esh-arg eldoc

esh-groups eshell esh-module esh-mode esh-util iimage ob-ditaa

ob-clojure ob-haskell ob-js ob-python ob-ruby ob-perl ob-plantuml ob-R

ob-sh org-id org-clock org-exp ob-exp org-exp-blocks find-func

org-outlook org-protocol org-habit org-agenda textmate-to-yas

texmate-to-yas textmate-import texmate-import url url-proxy url-privacy

url-expand url-methods url-history url-cookie url-util url-parse

url-vars mailcap yasnippet help-mode view ido-ubiquitous pos-tip

auto-complete-config auto-complete popup auto-indent-mode autopair

org-cua-dwim multiple-cursors rectangular-region-mode mc-mark-more

thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core rect

expand-region text-mode-expansions org-mode-expansions

expand-region-custom expand-region-core zenburn-theme ergoemacs-mode

edmacro kmacro delsel cua-base cus-start cus-load ess-R-object-tooltip

auto-complete-autoloads auto-indent-mode-autoloads autopair-autoloads

bm-autoloads dired+-autoloads ergoemacs-mode-autoloads

expand-region-autoloads helm-autoloads htmlize-autoloads

ido-ubiquitous-autoloads info+-autoloads linum-off-autoloads

magit-autoloads melpa-autoloads multiple-cursors-autoloads

muse-autoloads info nsis-mode-autoloads ntcmd-autoloads

org-cua-dwim-autoloads org-outlook-autoloads org-readme-autoloads

lib-requires-autoloads header2-autoloads http-post-simple-autoloads

org-table-comment-autoloads plantuml-mode-autoloads popup-autoloads

pos-tip-autoloads projectile-autoloads s-autoloads smex-autoloads

solarized-theme-autoloads ssh-autoloads tabbar-ruler-autoloads

tabbar-autoloads textmate-to-yas-autoloads yaoddmuse-autoloads

yasnippet-autoloads zenburn-theme-autoloads uniquify ffap saveplace

package derived tabulated-list ido flyspell rw-hunspell rw-ispell ispell

rw-language-and-country-codes server tramp-cache tramp-sh tramp

tramp-compat auth-source eieio assoc gnus-util mm-util mail-prsvr

password-cache shell tramp-loaddefs recentf tree-widget wid-edit org

byte-opt warnings bytecomp byte-compile cconv macroexp advice help-fns

advice-preload ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table

org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete

pcomplete comint ansi-color ring org-list org-faces org-compat

org-entities org-macs noutline outline easy-mmode format-spec regexp-opt

cal-menu easymenu calendar cal-loaddefs org-install cl time-date 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 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 minibuffer loaddefs

button faces cus-face files text-properties overlay sha1 md5 base64

format env code-pages mule custom widget hashtable-print-readable

backquote make-network-process multi-tty emacs)