Skip to content

Fix #365 producing huge packages because of hard links #623

Closed
wants to merge 1 commit into from

2 participants

@v-yarotsky

Following the discussion in #365, here is the implementation of tracking source device and inode numbers to preserve hard links. I was finally able to build git package with fpm :metal:.

Vladimir Yarotsky Fix #365 producing huge packages because of hard links f0524fe
@v-yarotsky

Turned out to break some things, will investigate in a short while.

@jordansissel jordansissel commented on the diff Mar 7, 2014
lib/fpm/util.rb
@@ -155,7 +155,19 @@ def copy_entry(src, dst)
when 'directory'
FileUtils.mkdir(dst) unless File.exists? dst
else
- FileUtils.copy_entry(src, dst)
+ # if the file with the same dev and inode has been copied already -
+ # hard link it's copy to `dst`, otherwise make an actual copy
+ st = File.stat(src)
@jordansissel
Owner
jordansissel added a note Mar 7, 2014

I wonder if File.lstat() is more correct here (otherwise we're following a symlink which may not be waht we want to do)

I'll fiddle with this post-merge and try to write a test for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jordansissel
Owner

testing now! :)

@jordansissel jordansissel added a commit that referenced this pull request Mar 7, 2014
@jordansissel Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
3b7de22
@jordansissel jordansissel added a commit that referenced this pull request Mar 7, 2014
@jordansissel Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
4958b8f
@jordansissel
Owner

I made some small changes to this PR in #659 and merged it.

This is now merged and has tests. Thank you! :)

@prof-milki prof-milki pushed a commit to prof-milki/xpm that referenced this pull request Dec 18, 2014
jls Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
06efc94
@prof-milki prof-milki pushed a commit to prof-milki/xpm that referenced this pull request Dec 27, 2014
@jordansissel Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
af5eeb4
@jordansissel jordansissel added a commit that referenced this pull request Apr 24, 2015
@jordansissel Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
4da466b
@jordansissel jordansissel added a commit that referenced this pull request Jun 20, 2016
@jordansissel Build on #623 adding todos and some code style changes
Also added a test to cover hardlink support for FPM::Util.copy_entry
d42f302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.