File becomes directory after rpm extraction using rpm2cpio

655 Views Asked by At

I am extracting a rpm package on RHEL-6.4. I am using rpm2cpio command as below:

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

The above command runs in fakeroot v1.12.4 environment. (cpio (GNU cpio) 2.10) After execution of above command if I check file tpye using file command it shows file as Directory.

I checked content of rpm using

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.

LD_LIBRARY_PATH is set to

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

why file is marked as directory when LD_LIBRARY_PATH is set ?

1

There are 1 best solutions below

4
On

Well, the rpm2cpio extract the archive including directory structure. So /usr/bin/foo from archive becomes:

d /usr
d   /bin/
f      foo 

So usr is indeed directory. But /usr/bin/foo is file (and it indeed is file on my workstation). 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. 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. It is more comfortable.

Note 2: I do not see anything like --queryformat perms in supported options, but you can you -qlpv.