From owner-freebsd-hackers Wed Mar 15 21:15:57 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id VAA00661 for hackers-outgoing; Wed, 15 Mar 1995 21:15:57 -0800 Received: from gndrsh.aac.dev.com (gndrsh.aac.dev.com [198.145.92.241]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id VAA00654 for ; Wed, 15 Mar 1995 21:15:53 -0800 Received: (from rgrimes@localhost) by gndrsh.aac.dev.com (8.6.8/8.6.6) id VAA14433; Wed, 15 Mar 1995 21:15:31 -0800 From: "Rodney W. Grimes" Message-Id: <199503160515.VAA14433@gndrsh.aac.dev.com> Subject: Re: cpio bug ? To: phk@ref.tfs.com (Poul-Henning Kamp) Date: Wed, 15 Mar 1995 21:15:31 -0800 (PST) Cc: hackers@FreeBSD.org In-Reply-To: <199503160431.UAA09849@ref.tfs.com> from "Poul-Henning Kamp" at Mar 15, 95 08:31:27 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 3936 Sender: hackers-owner@FreeBSD.org Precedence: bulk > > I think I have found one of the things which have troubled us in the > install procedure, and would like to hear people opinions: > > In a cpio file I have: > file usr/bin/passwd (root,bin, setuid+0555) > symlink usr/bin/yppasswd (bin,bin,0755) -> passwd > > Now, cpio will do a chown(bin) on usr/bin/yppasswd, and this will > make usr/bin/passwd owned by bin instead of root. > > Obviously wrong. > > How to fix this ? > > Who will do it for me ? Actually it looks simpler than I though at first, -DHAVE_LCHOWN and implement lchown(const char *path, uid_t owner, gid_t group) as a NOP :-). That fixes the CHOWN problem, but it looks like there is still a chmod done to the symlink which will break things still.... thats a little tougher to fix. Look this over and test it out, if you like it commit it! Index: Makefile =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/cpio/Makefile,v retrieving revision 1.1 diff -c -r1.1 Makefile *** 1.1 1993/08/07 22:33:10 --- Makefile 1995/03/16 05:06:37 *************** *** 1,8 **** PROG= cpio ! CFLAGS+= -I${.CURDIR} -DRETSIGTYPE=void -DHAVE_SYS_MTIO_H=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_UTIME_H=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDIRENT=1 SRCS = copyin.c copyout.c copypass.c defer.c dstring.c fnmatch.c global.c \ ! main.c tar.c util.c error.c filemode.c getopt.c getopt1.c version.c \ rtapelib.c dirname.c idcache.c makepath.c xmalloc.c stripslash.c \ userspec.c xstrdup.c --- 1,9 ---- PROG= cpio ! CFLAGS+= -I${.CURDIR} -DRETSIGTYPE=void -DHAVE_SYS_MTIO_H=1 -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_UTIME_H=1 -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDIRENT=1 -DHAVE_LCHOWN SRCS = copyin.c copyout.c copypass.c defer.c dstring.c fnmatch.c global.c \ ! lchown.c main.c tar.c util.c error.c filemode.c getopt.c getopt1.c \ ! version.c \ rtapelib.c dirname.c idcache.c makepath.c xmalloc.c stripslash.c \ userspec.c xstrdup.c Index: extern.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/cpio/extern.h,v retrieving revision 1.1 diff -c -r1.1 extern.h *** 1.1 1993/08/07 22:33:25 --- extern.h 1995/03/16 05:12:24 *************** *** 114,119 **** --- 114,124 ---- gid_t *getgidbyname (); #endif + /* lchown.c */ + #ifdef HAVE_LCHOWN + int lchown P_((const char *path, uid_t owner, gid_t group)); + #endif + /* main.c */ void process_args P_((int argc, char *argv[])); void initialize_buffers P_((void)); *** /dev/null Wed Mar 15 14:31:13 1995 --- lchown.c Wed Mar 15 21:11:24 1995 *************** *** 0 **** --- 1,27 ---- + /* lchown.c - dummy version of lchown for systems that do not store + file owners of symbolic links. + Copyright (C) 1995 Rodney W. Grimes, Accurate Automation Company + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + /* Written by Rodney W. Grimes */ + + #include + + int + lchown(const char *path, uid_t owner, gid_t group) { + + return (0); + } -- Rod Grimes rgrimes@gndrsh.aac.dev.com Accurate Automation Company Custom computers for FreeBSD