鹦鹉螺 7z 压缩

Aru*_*run 5 nautilus 7zip

我知道p7zip在 Ubuntu 18.04 上默认没有安装软件包。仍然Nautilus能够创建7z档案。这怎么可能?

N0r*_*ert 5

Nautilus 更改了存档压缩机制。

ldd $(which nautilus)可执行文件的动态库列表证实了这一点。
这里最重要的一行如下:

$ ldd /usr/bin/nautilus
...
    libarchive.so.13 => /usr/lib/x86_64-linux-gnu/libarchive.so.13
...
Run Code Online (Sandbox Code Playgroud)

它的包叫什么名字?

$ dpkg -S /usr/lib/x86_64-linux-gnu/libarchive.so.13
libarchive13:amd64: /usr/lib/x86_64-linux-gnu/libarchive.so.13
Run Code Online (Sandbox Code Playgroud)

这个包 ( libarchive13) 提供了什么功能?

$ apt-cache show libarchive13
Package: libarchive13
...
Description-en: Multi-format archive and compression library (shared library)
Archive formats supported are:
 .
    * tar (read and write, including GNU extensions)
...
    * zip (read only, with some limitations, uses zlib)
...
    * 7zip (read and write, with some limitations)
Run Code Online (Sandbox Code Playgroud)

此外,作为进一步的证明——如果我们尝试删除这个包,它将从 GNOME 中删除许多核心应用程序(Nautilus、File Roller、Evince、GNOME Con​​trol Center 和其他):

$ sudo apt-get purge libarchive13 --simulate
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  evince* file-roller* fwupd* gir1.2-rb-3.0* gir1.2-totem-1.0* 
  gir1.2-totemplparser-1.0* gnome-control-center* gnome-software*
  gnome-software-plugin-snap* grilo-plugins-0.3-base* gvfs-backends* 
  libappstream-glib8* libarchive13* libevdocument3-4* libevview3-3*
  libgnome-autoar-0-0* libgrilo-0.3-0* libgxps2* librhythmbox-core10* 
  libtotem-plparser18* libtotem0* nautilus* rhythmbox*
  rhythmbox-plugin-alternative-toolbar* rhythmbox-plugins* totem* 
  totem-plugins* ubuntu-desktop* ubuntu-software*
0 upgraded, 0 newly installed, 29 to remove and 53 not upgraded.
Run Code Online (Sandbox Code Playgroud)

所以答案是:Ubuntu 18.04 LTS 中的 Nautilus 3.26 不使用p7zip,它使用libarchive13包中的函数。