GNU bug report logs - #70987
29.2; Zip nested in tar, members do not open

Previous Next

Package: emacs;

Reported by: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>

Date: Thu, 16 May 2024 16:29:02 UTC

Severity: normal

Tags: confirmed

Found in version 29.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70987 in the body.
You can then email your comments to 70987 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Thu, 16 May 2024 16:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 16 May 2024 16:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.2; Zip nested in tar, members do not open  
Date: Thu, 16 May 2024 18:26:19 +0200
Create a zip file wrapped in a tar file.  E.g. in a shell do:

  $ zip -j zipped /etc/passwd
  $ tar cvzf tarred.tar.gz zipped.zip

In Emacs

  * C-x C-f tarred.tar.gz RET
  * RET on zipped.zip
  * RET on passwd
  * Error: unzip:  cannot find or open tarred.tar.gz!./zipped.zip, ...

Note that tars nested in tars or zips nested in zips do work.

----

In GNU Emacs 29.2 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2024-02-11 built on arrian
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-native-compilation=yes'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  shell-dirtrack-mode: t
  desktop-save-mode: t
  display-time-mode: t
  server-mode: t
  xclip-mode: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  comint-fontify-input-mode: t
  cua-mode: t
  display-battery-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/Projects/ttf-mode/arc-mode-compat hides ~/emacs/arc-mode-compat
/home/benny/.emacs.d/elpa/transient-20231019.1421/transient hides /usr/local/share/emacs/29.2/lisp/transient
/home/benny/.emacs.d/elpa/soap-client-3.2.3/soap-client hides /usr/local/share/emacs/29.2/lisp/net/soap-client
/home/benny/.emacs.d/elpa/soap-client-3.2.3/soap-inspect hides /usr/local/share/emacs/29.2/lisp/net/soap-inspect
/home/benny/.emacs.d/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.2/lisp/net/dictionary

Features:
(shadow emacsbug tabify help-fns pulse xref cl-print edebug debug
backtrace checkdoc flymake-proc flymake project display-line-numbers
pcmpl-gnu pcmpl-unix sh-script smie treesit executable benny-images
dirtrack files-x shell tar-mode ttf-glyphs rng-xsd xsd-regexp rng-cmpct
rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt
rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode
facemenu nxml-util nxml-enc xmltok ttf-mode arc-mode-compat arc-mode
archive-mode dired-aux binhex nndoc org-element org-persist org-id
org-refile avl-tree generator oc-basic ol-eww ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect ol-docview doc-view filenotify image-mode exif
ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete
pcomplete org-list org-footnote org-faces org-entities noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold
org-fold-core org-keys oc org-loaddefs find-func org-version org-compat
org-macs smerge-mode diff gnus-kill misearch multi-isearch benny-nitter
eww xdg url-queue thingatpt man flow-fill sort smiley gnus-cite
shr-color color mail-extr textsec uni-scripts idna-mapping ucs-normalize
uni-confusable textsec-check gnus-async gnus-bcklg gnus-dup gnus-ml pp
gnus-topic jka-compr mm-archive url-http url-gw url-cache url-auth qp
nndraft nnmh nnfolder network-stream nsm gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig nntp gnus-cache gnus-sum shr pixel-fill kinsoku
url-file svg pop3 gnus-group gnus-undo nnrss dom mm-url bbdb-com crm
bbdb bbdb-site timezone gnus-start gnus-dbus gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
message sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util time-date mail-utils range mm-util mail-prsvr
wid-edit comp comp-cstr warnings icons rx imenu view mule-util desktop
frameset highline benny-calendar-cfg ange-ftp generic-x autoinsert
cc-mode cc-fonts cc-guess cc-menus cc-styles cc-align cc-cmds cc-engine
cc-vars cc-defs ps-print ps-print-loaddefs lpr advice cl-extra help-mode
dired dired-loaddefs derived benny-x-clipboard disp-table time server
protbuf xclip term/xterm xterm xt-mouse cal-china lunar solar cal-dst
cal-bahai cal-islam cal-hebrew holidays holiday-loaddefs vc-git
diff-mode easy-mmode vc-dispatcher diary-lib diary-loaddefs cal-menu
calendar cal-loaddefs delsel grep compile text-property-search comint
ansi-osc ansi-color ring cua-base cus-load format-spec battery dbus xml
.loaddefs benny-tools autoload loaddefs-gen radix-tree lisp-mnt
bbdb-autoloads crontab-mode-autoloads csv-mode-autoloads
debbugs-autoloads elpher-autoloads enwc-autoloads graphql-autoloads
graphql-mode-autoloads jsonian-autoloads lsp-java-autoloads
dap-mode-autoloads lsp-docker-autoloads lsp-treemacs-autoloads
lsp-ui-autoloads lsp-mode-autoloads f-autoloads magit-autoloads pcase
git-commit-autoloads magit-section-autoloads
markdown-preview-mode-autoloads markdown-mode-autoloads monky-autoloads
nov-autoloads esxml-autoloads osm-autoloads request-autoloads
sly-autoloads soap-client-autoloads sql-indent-autoloads
sqlup-mode-autoloads telega-autoloads transient-autoloads
treemacs-autoloads cfrs-autoloads posframe-autoloads ht-autoloads
hydra-autoloads pfuture-autoloads ace-window-autoloads avy-autoloads
s-autoloads dash-autoloads vc-fossil-autoloads
visual-fill-column-autoloads websocket-autoloads with-editor-autoloads
x509-mode-autoloads info compat-autoloads xclip-autoloads yaml-autoloads
yaml-imenu-autoloads yaml-mode-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 979719 119466)
 (symbols 48 38017 5)
 (strings 32 290034 14510)
 (string-bytes 1 9105078)
 (vectors 16 171263)
 (vector-slots 8 2565530 106611)
 (floats 8 1369 814)
 (intervals 56 99986 511)
 (buffers 976 40))




Added tag(s) confirmed. Request was from Andrea Corallo <acorallo <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 18 May 2024 18:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Sat, 18 May 2024 18:24:02 GMT) Full text and rfc822 format available.

Message #10 received at 70987 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
Cc: 70987 <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open  
Date: Sat, 18 May 2024 14:23:22 -0400
Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net> writes:

> Create a zip file wrapped in a tar file.  E.g. in a shell do:
>
>   $ zip -j zipped /etc/passwd
>   $ tar cvzf tarred.tar.gz zipped.zip
>
> In Emacs
>
>   * C-x C-f tarred.tar.gz RET
>   * RET on zipped.zip
>   * RET on passwd
>   * Error: unzip:  cannot find or open tarred.tar.gz!./zipped.zip, ...
>
> Note that tars nested in tars or zips nested in zips do work.

I can reproduce this on current master as well.

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Sun, 19 May 2024 13:23:02 GMT) Full text and rfc822 format available.

Message #13 received at 70987 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
Cc: 70987 <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open
Date: Sun, 19 May 2024 16:22:37 +0300
> From: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
> Date: Thu, 16 May 2024 18:26:19 +0200
> 
> Create a zip file wrapped in a tar file.  E.g. in a shell do:
> 
>   $ zip -j zipped /etc/passwd
>   $ tar cvzf tarred.tar.gz zipped.zip
> 
> In Emacs
> 
>   * C-x C-f tarred.tar.gz RET
>   * RET on zipped.zip
>   * RET on passwd
>   * Error: unzip:  cannot find or open tarred.tar.gz!./zipped.zip, ...

Does the patch below give good results?

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 9a8dd66..bf9def6 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -563,6 +563,8 @@ archive-file-name-coding-system
 (defvar-local archive-files nil
   "Vector of `archive--file-desc' objects.")
 
+(defvar tar-archive-from-tar nil)
+
 ;; -------------------------------------------------------------------------
 ;;; Section: Support functions.
 
@@ -754,7 +756,8 @@ archive-mode
 	;; on local filesystem.  Treat such archives as remote.
 	(or archive-remote
 	    (setq archive-remote
-		  (or (string-match archive-remote-regexp (buffer-file-name))
+		  (or tar-archive-from-tar ; was included in a tar archive
+                      (string-match archive-remote-regexp (buffer-file-name))
 		      (string-match file-name-invalid-regexp
 				    (buffer-file-name)))))
 
@@ -920,6 +923,9 @@ archive-unique-fname
 If FNAME is something our underlying filesystem can't grok, or if another
 file by that name already exists in DIR, a unique new name is generated
 using `make-temp-file', and the generated name is returned."
+  (if (file-name-absolute-p fname)
+      ;; We need a file name relative to the filesystem root.
+      (setq fname (substring fname (1+ (string-search "/" fname)))))
   (let ((fullname (expand-file-name fname dir))
 	(alien (string-match file-name-invalid-regexp fname))
 	(tmpfile
@@ -1179,6 +1185,9 @@ archive-extract
          (buffer (get-buffer bufname))
          (just-created nil)
 	 (file-name-coding archive-file-name-coding-system))
+      (or archive-remote
+          (and (local-variable-p 'tar-archive-from-tar)
+               (setq archive-remote tar-archive-from-tar)))
       (if (and buffer
 	       (string= (buffer-file-name buffer) arcfilename))
           nil
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 375191a..7278bee 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -135,6 +135,10 @@ tar-file-name-coding-system
 (put 'tar-superior-buffer 'permanent-local t)
 (put 'tar-superior-descriptor 'permanent-local t)
 
+(defvar tar-archive-from-tar nil
+  "Non-nil if an arc-mode archive file is a member of a tar archive.")
+(put tar-archive-from-tar 'permanent-local t)
+
 ;; The Tar data is made up of bytes and better manipulated as bytes
 ;; and can be very large, so insert/delete can be costly.  The summary we
 ;; want to display may contain non-ascii chars, of course, so we'd like it
@@ -1124,6 +1128,8 @@ tar-extract
                 default-directory))
         (set-buffer-modified-p nil)
         (normal-mode)                   ; pick a mode.
+        (when (derived-mode-p 'archive-mode)
+          (setq-local tar-archive-from-tar t))
         (setq-local tar-superior-buffer tar-buffer)
         (setq-local tar-superior-descriptor descriptor)
         (setq buffer-read-only read-only-p)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Mon, 20 May 2024 06:26:02 GMT) Full text and rfc822 format available.

Message #16 received at 70987 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>,
 70987 <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open
Date: Mon, 20 May 2024 09:22:57 +0300
>> Create a zip file wrapped in a tar file.  E.g. in a shell do:
>> 
>>   $ zip -j zipped /etc/passwd
>>   $ tar cvzf tarred.tar.gz zipped.zip
>> 
>> In Emacs
>> 
>>   * C-x C-f tarred.tar.gz RET
>>   * RET on zipped.zip
>>   * RET on passwd
>>   * Error: unzip:  cannot find or open tarred.tar.gz!./zipped.zip, ...
>
> Does the patch below give good results?

I added new tests in arc-mode-tests.el and tar-mode-tests.el
to cover this case, and with your patch these tests are passed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Mon, 20 May 2024 09:53:01 GMT) Full text and rfc822 format available.

Message #19 received at 70987 <at> debbugs.gnu.org (full text, mbox):

From: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70987 <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open
Date: Mon, 20 May 2024 11:50:00 +0200
Hi Eli, Andrea,

Eli Zaretskii writes:
> Does the patch below give good results?

Yes, that works for the testcase and also for my orginal use case.  Just
for fun I also tried with more nesting and that worked, too.

Thank you very much,
benny




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70987; Package emacs. (Mon, 20 May 2024 11:53:01 GMT) Full text and rfc822 format available.

Message #22 received at 70987 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: b.riefenstahl <at> turtle-trading.net, 70987 <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open
Date: Mon, 20 May 2024 14:52:35 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>,
>   70987 <at> debbugs.gnu.org
> Date: Mon, 20 May 2024 09:22:57 +0300
> 
> >> Create a zip file wrapped in a tar file.  E.g. in a shell do:
> >> 
> >>   $ zip -j zipped /etc/passwd
> >>   $ tar cvzf tarred.tar.gz zipped.zip
> >> 
> >> In Emacs
> >> 
> >>   * C-x C-f tarred.tar.gz RET
> >>   * RET on zipped.zip
> >>   * RET on passwd
> >>   * Error: unzip:  cannot find or open tarred.tar.gz!./zipped.zip, ...
> >
> > Does the patch below give good results?
> 
> I added new tests in arc-mode-tests.el and tar-mode-tests.el
> to cover this case, and with your patch these tests are passed.

Thanks for testing the patch.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 20 May 2024 12:34:01 GMT) Full text and rfc822 format available.

Notification sent to Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>:
bug acknowledged by developer. (Mon, 20 May 2024 12:34:02 GMT) Full text and rfc822 format available.

Message #27 received at 70987-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
Cc: 70987-done <at> debbugs.gnu.org
Subject: Re: bug#70987: 29.2; Zip nested in tar, members do not open
Date: Mon, 20 May 2024 15:30:53 +0300
> From: Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net>
> Cc: 70987 <at> debbugs.gnu.org
> Date: Mon, 20 May 2024 11:50:00 +0200
> 
> Hi Eli, Andrea,
> 
> Eli Zaretskii writes:
> > Does the patch below give good results?
> 
> Yes, that works for the testcase and also for my orginal use case.  Just
> for fun I also tried with more nesting and that worked, too.
> 
> Thank you very much,

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Jun 2024 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.