hard-linked files handling by rpm

2014-01-21 Thread Rajul Bhavsar
Hi,

In my build root directory, I have created a file (say temp.txt) and then I
created a hard-link to it (say temp1.txt). After this, I created rpm out of
build root directory. On installing this rpm I see that i-node numbers of
both files are same; that means rpm is aware of this hard-link and creating
the same on rpm installation.

But, I am not able to understand how rpm has treated this hard-link with a
.rpm file.
For example, I have a file with 5k size. On duplicating it, rpm size
increased by ~2.5k but with hard-link it increased by 1.9k. What is this
1.9k? Is this totally a metadata about hard-link or something else?

Please help me in understanding this hard-link handling.

Thanks,
Rajul


Re: hard-linked files handling by rpm

2014-01-21 Thread Jeffrey Johnson

On Jan 21, 2014, at 3:03 AM, Rajul Bhavsar rajulbhav...@gmail.com wrote:

 Hi,
 
 In my build root directory, I have created a file (say temp.txt) and then I 
 created a hard-link to it (say temp1.txt). After this, I created rpm out of 
 build root directory. On installing this rpm I see that i-node numbers of 
 both files are same; that means rpm is aware of this hard-link and creating 
 the same on rpm installation. 
 
 But, I am not able to understand how rpm has treated this hard-link with a 
 .rpm file.
 For example, I have a file with 5k size. On duplicating it, rpm size 
 increased by ~2.5k but with hard-link it increased by 1.9k. What is this 
 1.9k? Is this totally a metadata about hard-link or something else?
 
 Please help me in understanding this hard-link handling.
 

The size change is likely in the cpio payload in a *.rpm package because
rpm doesn’t track hard links directly, uses the inode info to infer hard links.

You can see all metadata with
rpm -qp —yaml  somepackage.rpm
There is also —xml if you prefer the eye-scratchy angle bracket syntax.

hth

73 de Jeff
 Thanks,
 Rajul 

__
RPM Package Managerhttp://rpm5.org
User Communication List rpm-users@rpm5.org


Re: hard-linked files handling by rpm

2014-01-21 Thread Rajul Bhavsar
On Tue, Jan 21, 2014 at 10:23 PM, Jeffrey Johnson n3...@me.com wrote:


 On Jan 21, 2014, at 3:03 AM, Rajul Bhavsar rajulbhav...@gmail.com wrote:

  Hi,
 
  In my build root directory, I have created a file (say temp.txt) and
 then I created a hard-link to it (say temp1.txt). After this, I created rpm
 out of build root directory. On installing this rpm I see that i-node
 numbers of both files are same; that means rpm is aware of this hard-link
 and creating the same on rpm installation.
 
  But, I am not able to understand how rpm has treated this hard-link with
 a .rpm file.
  For example, I have a file with 5k size. On duplicating it, rpm size
 increased by ~2.5k but with hard-link it increased by 1.9k. What is this
 1.9k? Is this totally a metadata about hard-link or something else?
 
  Please help me in understanding this hard-link handling.
 

 The size change is likely in the cpio payload in a *.rpm package because
 rpm doesn’t track hard links directly, uses the inode info to infer hard
 links.
  If hard-links are treated as just another files (for inclusion in
 .rpm) then why difference in size of payload - when same file is duplicated
 and hard-linked?



 You can see all metadata with
 rpm -qp —yaml  somepackage.rpm
 There is also —xml if you prefer the eye-scratchy angle bracket syntax.

 hth

 73 de Jeff
  Thanks,
  Rajul

 __
 RPM Package Managerhttp://rpm5.org
 User Communication List rpm-users@rpm5.org



Re: hard-linked files handling by rpm

2014-01-21 Thread Jeffrey Johnson

On Jan 21, 2014, at 9:49 PM, Rajul Bhavsar rajulbhav...@gmail.com wrote:

 
 
 
 On Tue, Jan 21, 2014 at 10:23 PM, Jeffrey Johnson n3...@me.com wrote:
 
  If hard-links are treated as just another files (for inclusion in .rpm) 
  then why difference in size of payload - when same file is duplicated and 
  hard-linked?

Read about cpio headers: there needs to be some way to specify
what foe path to link to, a search across a file system for a specific
inode is quite performance intensive, so the path to the file to be linked
to is included in the cpio payload.

  
 You can see all metadata with
 rpm -qp —yaml  somepackage.rpm
 There is also —xml if you prefer the eye-scratchy angle bracket syntax.
 

Or compare the metadata with and without the hardline using —yaml. All the
metadata is displayed with —yaml.

You asked to understand why the *.rpm package was larger. One (or both)
of the above answers should provide an answer to you.

73 de Jeff