all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70987: 29.2; Zip nested in tar, members do not open
@ 2024-05-16 16:26 Benjamin Riefenstahl
  2024-05-18 18:23 ` Andrea Corallo
  2024-05-19 13:22 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Benjamin Riefenstahl @ 2024-05-16 16:26 UTC (permalink / raw)
  To: 70987

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





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-16 16:26 bug#70987: 29.2; Zip nested in tar, members do not open Benjamin Riefenstahl
@ 2024-05-18 18:23 ` Andrea Corallo
  2024-05-19 13:22 ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Andrea Corallo @ 2024-05-18 18:23 UTC (permalink / raw)
  To: Benjamin Riefenstahl; +Cc: 70987

Benjamin Riefenstahl <b.riefenstahl@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





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-16 16:26 bug#70987: 29.2; Zip nested in tar, members do not open Benjamin Riefenstahl
  2024-05-18 18:23 ` Andrea Corallo
@ 2024-05-19 13:22 ` Eli Zaretskii
  2024-05-20  6:22   ` Juri Linkov
  2024-05-20  9:50   ` Benjamin Riefenstahl
  1 sibling, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-05-19 13:22 UTC (permalink / raw)
  To: Benjamin Riefenstahl; +Cc: 70987

> From: Benjamin Riefenstahl <b.riefenstahl@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)





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-19 13:22 ` Eli Zaretskii
@ 2024-05-20  6:22   ` Juri Linkov
  2024-05-20 11:52     ` Eli Zaretskii
  2024-05-20  9:50   ` Benjamin Riefenstahl
  1 sibling, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2024-05-20  6:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Benjamin Riefenstahl, 70987

>> 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.





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-19 13:22 ` Eli Zaretskii
  2024-05-20  6:22   ` Juri Linkov
@ 2024-05-20  9:50   ` Benjamin Riefenstahl
  2024-05-20 12:30     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Benjamin Riefenstahl @ 2024-05-20  9:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70987

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





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-20  6:22   ` Juri Linkov
@ 2024-05-20 11:52     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-05-20 11:52 UTC (permalink / raw)
  To: Juri Linkov; +Cc: b.riefenstahl, 70987

> From: Juri Linkov <juri@linkov.net>
> Cc: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>,
>   70987@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.





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

* bug#70987: 29.2; Zip nested in tar, members do not open
  2024-05-20  9:50   ` Benjamin Riefenstahl
@ 2024-05-20 12:30     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-05-20 12:30 UTC (permalink / raw)
  To: Benjamin Riefenstahl; +Cc: 70987-done

> From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
> Cc: 70987@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.





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

end of thread, other threads:[~2024-05-20 12:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16 16:26 bug#70987: 29.2; Zip nested in tar, members do not open Benjamin Riefenstahl
2024-05-18 18:23 ` Andrea Corallo
2024-05-19 13:22 ` Eli Zaretskii
2024-05-20  6:22   ` Juri Linkov
2024-05-20 11:52     ` Eli Zaretskii
2024-05-20  9:50   ` Benjamin Riefenstahl
2024-05-20 12:30     ` Eli Zaretskii

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.