Closed xfzv closed 2 weeks ago
Yazi uses 7zip
instead of tar
to extract tar.gz
files to avoid adding new dependencies. I did a quick search, and it seems like there's no switch to preserve this information during extraction, which likely means that 7zip
doesn't support it. Let me know if I'm wrong!
Indeed, 7zip
cannot preserve permissions. Quoting Wikipedia 7z page - Limitations:
The 7z format does not store filesystem permissions (such as UNIX owner/group permissions or NTFS ACLs), and hence can be inappropriate for backup/archival purposes.
I guess this also applies when extracting tar.gz
archives, hence the issue.
Yazi uses
7zip
instead oftar
to extracttar.gz
files to avoid adding new dependencies.
tar
is installed by default on pretty much any Linux distro and also on macOS. It seems that it's also available in recent Microsoft Windows versions so I guess it wouldn't hurt using it over 7zip
for all tar
archives?
What about using tar
if available and 7zip
as fallback if it's not?
My main concern about doing this is that they're not interchangeable alternatives; tar
and 7zip
don't behave the same way, which adds more uncertainty and confusion.
For example, when users report a problem with tar.gz
files, we'd have to ask them every time which one they used. Or when users use Yazi on a new system, they might forget to install tar
and fall back to 7zip
, only to be surprised by the inconsistent behavior.
Plus, since I plan to eventually implement my own extraction tool to replace 7zip
(along with the feature of "open archives as directories" listed in feature requests) and right now 7zip
is just a temporary solution, I'm not too keen on spending too much time adding new features, especially if those features are just for something that will eventually be discarded.
Plus, since I plan to eventually implement my own extraction tool to replace 7zip and right now 7zip is just a temporary solution, I'm not too keen on spending too much time adding new features, especially if those features are just for something that will eventually be discarded.
I didn't know about that upcoming extraction tool, I completely agree with you in this case. I assume it will handle permissions correctly.
Feel free to close this. In the meantime, I'll just extract manually with tar
.
Thanks!
OK close for now. If I still don't have enough time to finish my own extraction tool this year, I'll reconsider the idea of using tar
What system are you running Yazi on?
Linux X11
What terminal are you running Yazi in?
kitty 0.36.4
yazi --debug
outputDescribe the bug
When extracting a
.tar.gz
archive, directories and files permissions from the archive aren't preserved. After extraction, directories all have700
permissions and files all have644
permissions.This could be avoided by using
tar
-p, --preserve-permissions
option.Minimal reproducer
755
permissions) and any other kind of file with600
permissions to atar.gz
archive<Enter>
700
permissions instead of755
; all files have644
permissionstar
-p, --preserve-permissions
option:tar -pxvzf
or withArk
Anything else?
No response
Validations
yazi --debug
) input box to the nightly that I triedmv ~/.config/yazi ~/.config/yazi-backup
)