tag 618782 + patch thanks On Mon, Mar 28, 2011 at 06:00:42AM +0000, Clint Adams wrote: > On Mon, Mar 28, 2011 at 01:17:34AM +0200, Aurelien Jarno wrote: > > The missing function is lchmod(), not lchown(), but I guess I can have > > a look at how lchown() is implemented to understand how to fix this > > issue. > > That's what I get for reading email in a hurry instead of when > I'm sleep-deprived. The answer is almost the same though: just > copy the entirety of chmod() in libfakeroot.c instead, and > s/chmod/lchmod/ in the function declaration and the next_ call, > sandwich it within #ifdef HAVE_LCHMOD, add the test to > configure.ac, and the same #ifdef'd prototype to wrapfunc.inp, > then borrow the STAT/LSTAT logic from the lchown stuff. > Something close to that, anyway. >
Thanks for the hints. I have been able to create the following patch. I have verified it fixes the issues with tar on GNU/kFreeBSD (which means that now the testsuite passes), and that is still builds on GNU/Linux. --- fakeroot-1.14.5.orig/configure.ac +++ fakeroot-1.14.5/configure.ac @@ -274,7 +274,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]) done -AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat unlinkat) +AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat unlinkat lchmod) dnl find out how stat() etc are called. On linux systems, we really dnl need to wrap (IIRC): --- fakeroot-1.14.5.orig/libfakeroot.c +++ fakeroot-1.14.5/libfakeroot.c @@ -894,6 +894,40 @@ int chmod(const char *path, mode_t mode) return r; } +#ifdef HAVE_LCHMOD +int lchmod(const char *path, mode_t mode){ + INT_STRUCT_STAT st; + int r; + +#ifdef LIBFAKEROOT_DEBUGGING + if (fakeroot_debug) { + fprintf(stderr, "lchmod path %s\n", path); + } +#endif /* LIBFAKEROOT_DEBUGGING */ + r=INT_NEXT_LSTAT(path, &st); + if(r) + return r; + + st.st_mode=(mode&ALLPERMS)|(st.st_mode&~ALLPERMS); + + INT_SEND_STAT(&st, chmod_func); + + /* see chmod() for comment */ + mode |= 0600; + if(S_ISDIR(st.st_mode)) + mode |= 0100; + + r=next_chmod(path, mode); + if(r&&(errno==EPERM)) + r=0; +#ifdef EFTYPE /* available under FreeBSD kernel */ + if(r&&(errno==EFTYPE)) + r=0; +#endif + return r; +} +#endif + int fchmod(int fd, mode_t mode){ int r; INT_STRUCT_STAT st; --- fakeroot-1.14.5.orig/wrapfunc.inp +++ fakeroot-1.14.5/wrapfunc.inp @@ -65,6 +65,9 @@ lchown;int;(const char *path, uid_t owne fchown;int;(int fd, uid_t owner, gid_t group);(fd, owner, group) chmod;int;(const char *path, mode_t mode);(path, mode) fchmod;int;(int fd, mode_t mode);(fd, mode) +#if defined HAVE_LCHMOD +lchmod;int;(const char *path, mode_t mode);(path, mode) +#endif #if defined __APPLE__ && !defined __LP64__ lchown$UNIX2003;int;(const char *path, uid_t owner, gid_t group);(path, owner, group) chmod$UNIX2003;int;(const char *path, mode_t mode);(path, mode) -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org