Re: What do you think?
>>>>> "CCC" == Christopher C Chimelis <chris@classnet.med.miami.edu> writes:
CCC> This is probably a perfect time for this...there was a new
CCC> glibc package revision released today. If you want, send me
CCC> a patch against it and I'll compile it in.
Two patches enclosed below, one against libc and one against dpkg
(1.4.0.23.2 - do we have a later working version yet?). You want to
upgrade them simultaneously :) I'm not sure if I caught all the cases
in dpkg, but I didn't see anything else that looked symlink
relevant.
m.
--- dpkg-1.4.0.23.2/dpkg/archives.c.orig Mon Mar 31 04:45:27 1997
+++ dpkg-1.4.0.23.2/dpkg/archives.c Sat Oct 3 12:08:56 1998
@@ -444,7 +444,7 @@
if (symlink(ti->LinkName,fnamenewvb.buf))
ohshite(_("error creating symbolic link `%.255s'"),ti->Name);
debug(dbg_eachfiledetail,"tarobject SymbolicLink creating");
- if (chown(fnamenewvb.buf,ti->UserID,ti->GroupID))
+ if (lchown(fnamenewvb.buf,ti->UserID,ti->GroupID))
ohshite(_("error setting ownership of symlink `%.255s'"),ti->Name);
break;
case Directory:
@@ -500,7 +500,7 @@
symlinkfn.used= r; varbufaddc(&symlinkfn,0);
if (symlink(symlinkfn.buf,fnametmpvb.buf))
ohshite(_("unable to make backup symlink for `%.255s'"),ti->Name);
- if (chown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
+ if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
ohshite(_("unable to chown backup symlink for `%.255s'"),ti->Name);
} else {
debug(dbg_eachfiledetail,"tarobject nondirectory, `link' backup");
diff -Nru glibc-2.0.7t.orig/sysdeps/unix/sysv/linux/alpha/lchown.c glibc-2.0.7t/sysdeps/unix/sysv/linux/alpha/lchown.c
--- glibc-2.0.7t.orig/sysdeps/unix/sysv/linux/alpha/lchown.c Thu Jan 1 08:00:00 1970
+++ glibc-2.0.7t/sysdeps/unix/sysv/linux/alpha/lchown.c Wed Sep 16 10:52:25 1998
@@ -0,0 +1,64 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+
+/*
+ [ from ../x86/chown.c: ]
+ In Linux 2.1.x the chown functions have been changed. A new function lchown
+ was introduced. The new chown now follows symlinks - the old chown and the
+ new lchown do not follow symlinks.
+
+ Let's try autodetecting. 980909 dichro-libc@rcpt.to
+*/
+
+#ifndef __NR_lchown
+#define __NR_lchown 208
+#endif
+
+int
+__lchown (const char *file, uid_t owner, gid_t group)
+{
+ static int state = 0;
+ int ret;
+
+ switch(state) {
+ case 0:
+ ret = syscall(__NR_lchown, file, owner, group);
+ if(ret != -ENOSYS) {
+ state = 2;
+ goto handleret;
+ }
+ state = 1;
+ case 1:
+ return __chown(file, owner, group);
+ case 2:
+ ret = syscall(__NR_lchown, file, owner, group);
+handleret:
+ if(ret < 0) {
+ __set_errno(-ret);
+ return -1;
+ }
+ return ret;
+ }
+}
+
+weak_alias (__lchown, lchown)
Reply to: