tar 无法 mkdir:没有这样的文件

tar 无法 mkdir:没有这样的文件

运行以下命令时出现错误,抱怨 Cannot mkdir: No such file or directory。我认为这与路径名中的\有关。如何解决这个问题?

我在 Centos 上运行这个。

tar xf dpdk-17.02.tar.xz
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0: Cannot mkdir: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0: Cannot mkdir: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0/class: Cannot open: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0: Cannot mkdir: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0/config: Cannot open: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0: Cannot mkdir: No such file or directory
tar: dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000\:01\:00.0/consistent_dma_mask_bits: Cannot open: No such file or directory

我尝试 strace 来获取更多详细信息,这是其中一个错误的输出:

mkdirat(AT_FDCWD, "dpdk-17.02", 0755)   = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs/bus", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs/bus/pci", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices", 0755) = -1 EEXIST (File exists)
mkdirat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000:01:00.0", 0755) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "dpdk-17.02/app/test/test_pci_sysfs/bus/pci/devices/0000:01:00.0", 0x7ffe85312de0, 0) = -1 ENOENT (No such file or directory)
write(2, "tar: ", 5)                    = 5
write(2, "dpdk-17.02/app/test/test_pci_sys"..., 79) = 79
write(2, ": No such file or directory", 27) = 27
write(2, "\n", 1)                       = 1
write(2, "tar: ", 5)                    = 5
write(2, "dpdk-17.02/app/test/test_pci_sys"..., 85) = 85

答案1

这可能是由于符号链接造成的。可能值得看看 tar 通过 'strace' 正在做什么(只需在 tar 命令前面加上 前缀strace)。

您应该从 strace 输出中看到 tar 正在尝试执行的操作以及失败的操作。

答案2

我正在对位于 CIFS 上的主目录执行 tar,该目录遵循 Windows 文件名规则和限制。 CIFS (Windows) 中不允许使用冒号。我在本地分区上重新做了同样的事情,没有问题。

相关内容