【问题标题】:Tar not preserving extended attributes of 'trusted' namespaceTar 不保留“受信任”命名空间的扩展属性
【发布时间】:2017-02-23 11:32:34
【问题描述】:

说明

我正在使用 tar 创建包含文件夹的存档,其中一些文件具有扩展属性。

包括这些:

  • trusted.size=5
  • trusted.test

我以这种方式创建和提取档案:

sudo tar --xattrs --xattrs-include='trused\.' -cf file.tar archive_folder .
sudo tar --xattrs --xattrs-include='trused\.' -xvf file.tar -C extracted_folder

问题

提取文件后,我尝试查看属性:

sudo getfattr -n trusted.size file

但属性总是缺失。如何保留这些属性?

【问题讨论】:

    标签: tar xattr


    【解决方案1】:

    在玩了一下 tar 创建和提取行之后,我发现 tar --xattrs --xattrs-include=* 必须使用才能保存和提取 xattributes

    【讨论】:

    • 感谢您,手册页明确表示“默认情况下它们都已存储”,但实际上您必须包含 --xattrs-include=* 才能使其按预期工作。 :-/
    • 你确定吗?我使用的是 gnu tar 1.30,在创建 tarball 时我只需要设置--xattrs,但在提取它时,我需要--xattrs --xattrs-include='*'。你能确认一下吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    • 2014-09-18
    • 1970-01-01
    • 2017-12-16
    • 2017-10-14
    • 2011-06-28
    相关资源
    最近更新 更多