简体   繁体   English

使用rpm2cpio在rpm提取后,文件成为目录

[英]File becomes directory after rpm extraction using rpm2cpio

I am extracting a rpm package on RHEL-6.4. 我正在RHEL-6.4上提取rpm软件包。 I am using rpm2cpio command as below: 我使用rpm2cpio命令如下:

rpm2cpio package-name.rpm | cpio -u -i -d ---quiet 2>&1

The above command runs in fakeroot v1.12.4 environment. 上面的命令在fakeroot v1.12.4环境中运行。 (cpio (GNU cpio) 2.10) After execution of above command if I check file tpye using file command it shows file as Directory. (cpio(GNU cpio)2.10)执行以上命令后,如果我使用file命令检查文件tpye,则它将文件显示为Directory。

I checked content of rpm using 我检查了rpm的内容

rpm -qlpv package-name.rpm

It shows all files as file and directory as directory. 它将所有文件显示为文件和目录作为目录。

However, I noticed if i unset LD_LIBRARY_PATH and then check filetype using file command, it shows all data same as rpm -qlp . 但是,我注意到如果我未unset LD_LIBRARY_PATH ,然后使用file命令检查文件类型,它会显示与rpm -qlp相同的所有数据。

LD_LIBRARY_PATH is set to LD_LIBRARY_PATH设置为

/opt/tools/wh/dtd/RHE-5/fakeroot/1.12.4/lib64/libfakeroot

why file is marked as directory when LD_LIBRARY_PATH is set ? 为何在设置LD_LIBRARY_PATH时将文件标记为目录?

Well, the rpm2cpio extract the archive including directory structure. 好了,rpm2cpio提取包含目录结构的存档。 So /usr/bin/foo from archive becomes: 所以来自存档的/ usr / bin / foo变为:

d /usr
d   /bin/
f      foo 

So usr is indeed directory. 所以usr确实是目录。 But /usr/bin/foo is file (and it indeed is file on my workstation). 但/ usr / bin / foo是文件(它确实是我工作站上的文件)。 Of course if you have LD_LIBRARY_PATH set something (and you did not shared to what) then it can point to directory which modify ANY system libraries and ANY system call. 当然,如果你有LD_LIBRARY_PATH设置的东西(你没有共享什么),那么它可以指向修改任何系统库和任何系统调用的目录。 So the result can be ANYTHING. 因此结果可能是任何事情。 And it is hard to tell without knowing you local setup. 如果不了解本地设置,很难说清楚。

Note 1: you can call rpmdev-extract from rpmdevtools package. 注意1:您可以从rpmdevtools包中调用rpmdev-extract。 It is more comfortable. 它更舒服。

Note 2: I do not see anything like --queryformat perms in supported options, but you can you -qlpv . 注意2:我在支持的选项--queryformat perms不到类似--queryformat perms ,但你可以使用-qlpv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM