jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.13k stars 1.07k forks source link

having /tmp on a different FS than source leads to probems #1080

Open vcunat opened 8 years ago

vcunat commented 8 years ago

I wanted to use -s dir -C /root/of/some/read-only/hierarchy /=/usr, but it would fail with .../fpm-1.4.0/lib/fpm/package/dir.rb:192:inlink': Permission denied @ rb_file_s_link - (./bin/foo, /tmp/nix-build-foo.drv-0/package-dir-staging20160320-47-17u2o4t/usr/./bin/foo) (Errno::EACCES)``

hatt commented 8 years ago

Is your source hierarchy on a different filesystem to the FPM staging directory somehow? Errno::EACCES only really happens when a hard link can't be created, and that only happens (afaik) when the source and target are on different filesystems. The reason you get an exception is that this is a super rare event and so isn't handled in the main FPM error capturing of Package::Dir. If this was a permissions error, we'd be seeing Errno::EPERM, but this error is the system saying the FS itself doesn't allow the operation. I'm not really sure how to replicate or fix this though...

vcunat commented 8 years ago

Ah, yes, my /tmp is a tmpfs.

copumpkin commented 8 years ago

I'm getting the same issue 😦

copumpkin commented 8 years ago

@hatt seems odd to assume that they'll be on the same filesystem, with no fallback for cases in which they're not. Would there any downsides to adding "try to hard link, but if that fails, copy" logic?

vcunat commented 8 years ago

cp --reflink=auto comes to my mind, but still, support for reflinks seems still not very common.

hatt commented 8 years ago

@copumpkin sorry for the slow reply, I've been offline for two weeks. It's not so much an assumption that things will be on the same filesystem as the edge case never came up before. Generally /tmp being on the main FS is pretty common (default in all distributions I can think of) so it seemed safe enough. This seems simple enough to fix, just not sure on the right approach. The only downside that I can think of for trying a hard link and then falling back to copy is that it would rely on the exception being caught properly, and is also much slower. There may be other times these errors come up that I can't think of. I can spin up a branch with a patch if you want to test it?