Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for inspecting tar{,?z,bz2} and zip files #600

Open
dsommers opened this issue Nov 3, 2023 · 4 comments · May be fixed by #797
Open

feat: Add support for inspecting tar{,?z,bz2} and zip files #600

dsommers opened this issue Nov 3, 2023 · 4 comments · May be fixed by #797

Comments

@dsommers
Copy link

dsommers commented Nov 3, 2023

This might be considered out-of-scope for eza, which is totally fine ... but I believe it would be a nice feature to be able to list the contents of tarballs, zip files and similar archive files.

An example of how this could work:

$ eza ${MY_OPTS} -l openvpn3-session-watcher-3.tar.xz
.rw-r-----@ 3,6k user  3 Nov 09:39 -N  openvpn3-session-watcher-3.tar.xz
$ eza ${MY_OPTS} -l session-watcher.tar.xz/
.rw-r-----@  192 user 30 Oct 11:18 -I  Makefile
.rwxr-xr-x@  12k user  3 Nov 09:35 -N  openvpn3-desktop-session-watcher
.rw-r-----@  198 user 30 Oct 11:13 -N  openvpn3-desktop-session-watcher.service
$

Thoughts?

@cafkafk
Copy link
Member

cafkafk commented Nov 3, 2023

I'd be open to such a thing, could be super useful, but if a potential implementation is too heavy, we probably should consider feature gating this.

@cafkafk
Copy link
Member

cafkafk commented Nov 3, 2023

(could also support bzip3, although this is probably considerably harder)

@johnsonjh
Copy link

johnsonjh commented Nov 22, 2023

@cafkafk

This would be a neat extension because this has, in fact, been something available historically on other systems.

IBM AIX, since at least AIX version 3 (and optionally in AIX 2 and 1.3), has shipped li, which is an extended ls program, which has supported various features including treating archives as quasi-directories. It is unfortunately old and crusty now, so it doesn't properly visually disambiguate everything, and shows negative block counts, but I still use it all the time. It's part of the bos.compat.cmds package in current AIX.

In IBM AIX, an AIX/XCOFF .a archive will contain multiple versions of shared libraries and can also hold both 32-bit and 64-bit versions of them (sort of a FAT binary), for example:

$ li -lv -Rq /opt/freeware/lib/libgmp.a 
?rwxr-xr-x    1 sa       staff      725260  Nov 23 2021  <libgmp.so.10>
?rwxr-xr-x    1 sa       staff      785444  Nov 23 2021  <libgmp.so.10>
?rwxr-xr-x    1 sa       staff      478616  Nov 23 2021  <libgmp.so.3>
?rwxr-xr-x    1 sa       staff      555016  Nov 23 2021  <libgmp.so.3>
grand total -121 blocks

The ar interface is a bit clunkier, needing a flag to show 64-bit versions, and not doing name lookups, etc.:

$ ar -tv /opt/freeware/lib/libgmp.a
rwxr-xr-x   208/1     725260 Nov 23 18:17 2021 libgmp.so.10
rwxr-xr-x   208/1     478616 Nov 23 18:17 2021 libgmp.so.3

$ ar -X64 -tv /opt/freeware/lib/libgmp.a
rwxr-xr-x   208/1     785443 Nov 23 18:17 2021 libgmp.so.10
rwxr-xr-x   208/1     555016 Nov 23 18:17 2021 libgmp.so.3

If you tell li to recursively list directories, adding -Rq (recurse quasi) also recurses through the archives as well, just as if they were directories.

Since AIX has Rust now, supporting XCOFF archives would be great, but some kind of generic support (a, tar, cpio, zip) even without compression would be neat. Compression would be a bit tricky, you'd have to worry about some major slowdowns, "zip bombs", etc...

It sure would be nice for at least one replacement tool to catch up with what IBM had back in the 1980s.

@taminob
Copy link
Contributor

taminob commented Jan 22, 2024

I'd like to look into this issue since this sounds pretty useful.
I will probably only look into the support of one or maybe two archive formats for the first PR, but this can hopefully provide a foundation on which additional formats can then be added.

@taminob taminob linked a pull request Jan 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants