Skip to content

Commit 0d4431c

Browse files
pbogdanvcunat
authored andcommittedJun 17, 2017
fakeroot: apply patch to ignore EINVAL errors as well
Fixes #25901 the nixos.ova job. See the referred links.
1 parent 05547db commit 0d4431c

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed
 

‎pkgs/tools/system/fakeroot/default.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ stdenv.mkDerivation rec {
99
sha256 = "0313xb2j6a4wihrw9gfd4rnyqw7zzv6wf3rfh2gglgnv356ic2kw";
1010
};
1111

12+
patches = stdenv.lib.optional stdenv.isLinux ./einval.patch
1213
# patchset from brew
13-
patches = stdenv.lib.optionals stdenv.isDarwin [
14+
++ stdenv.lib.optionals stdenv.isDarwin [
1415
(fetchpatch {
1516
name = "0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch";
1617
url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch;att=1;bug=766649";
@@ -26,7 +27,7 @@ stdenv.mkDerivation rec {
2627
url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=766649;filename=fakeroot-always-pass-mode.patch;msg=20";
2728
sha256 = "0i3zaca1v449dm9m1cq6wq4dy6hc2y04l05m9gg8d4y4swld637p";
2829
})
29-
];
30+
];
3031

3132
buildInputs = [ getopt ]
3233
++ stdenv.lib.optional (!stdenv.isDarwin) libcap
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Ignore EINVAL errors. This matters within user namespaces.
2+
3+
See:
4+
https://github.com/NixOS/nixpkgs/issues/25901
5+
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802612
6+
https://github.com/NixOS/nixpkgs/issues/10496
7+
8+
diff --git a/libfakeroot.c b/libfakeroot.c
9+
index 68a95fb..70da8bc 100644
10+
--- a/libfakeroot.c
11+
+++ b/libfakeroot.c
12+
@@ -792,7 +792,7 @@ int chown(const char *path, uid_t owner, gid_t group){
13+
r=next_lchown(path,owner,group);
14+
else
15+
r=0;
16+
- if(r&&(errno==EPERM))
17+
+ if(r&&(errno==EPERM||errno==EINVAL))
18+
r=0;
19+
20+
return r;
21+
@@ -819,7 +819,7 @@ int lchown(const char *path, uid_t owner, gid_t group){
22+
r=next_lchown(path,owner,group);
23+
else
24+
r=0;
25+
- if(r&&(errno==EPERM))
26+
+ if(r&&(errno==EPERM||errno==EINVAL))
27+
r=0;
28+
29+
return r;
30+
@@ -843,7 +843,7 @@ int fchown(int fd, uid_t owner, gid_t group){
31+
else
32+
r=0;
33+
34+
- if(r&&(errno==EPERM))
35+
+ if(r&&(errno==EPERM||errno==EINVAL))
36+
r=0;
37+
38+
return r;
39+
@@ -870,7 +870,7 @@ int fchownat(int dir_fd, const char *path, uid_t owner, gid_t group, int flags)
40+
else
41+
r=0;
42+
43+
- if(r&&(errno==EPERM))
44+
+ if(r&&(errno==EPERM||errno==EINVAL))
45+
r=0;
46+
47+
return r;

0 commit comments

Comments
 (0)
Please sign in to comment.