Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2001 14:06:46 +0300 (EEST)
From:      Maxim Sobolev <sobomax@FreeBSD.ORG>
To:        nbm@mithrandr.moria.org (Neil Blakey-Milner)
Cc:        sobomax@FreeBSD.ORG (Maxim Sobolev), freebsd-ports@FreeBSD.ORG
Subject:   Re: Problem removing links to directories with pkg_delete
Message-ID:  <200108131106.f7DB6kq12024@vega.vega.com>
In-Reply-To: <20010813120919.A57988@mithrandr.moria.org> from "Neil Blakey-Milner" at Aug 13, 2001 12:09:19 PM

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 
> --bp/iNruPH9dso1Pn
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> On Mon 2001-08-13 (12:28), Maxim Sobolev wrote:
> > > 
> > > >At Sun, 12 Aug 2001 22:10:25 +0200,
> > > >Jean-Sebastien Roy wrote:
> > > >> I made a port (scilab 2.6, see: ports/26997) that includes a file
> > > >> named "config" in it's plist. This file is a link to a
> > > >> directory. (the name has no importance)
> > > >>
> > > >> When I use "make deinstall" to uninstall the port, everything is fine.
> > > >> (I used the recommanded test ordering in the handbook and everything went fine)
> > > >>
> > > >> But when I use pkg_delete, it complains that the directory enclosing
> > > >> "config" cannot be removed because it is not empty. Indeed, it
> > > >> contains "config", which was not removed. I suppose it's because its
> > > >> MD5 checksum changed while pkg_delete removed file in the directory
> > > >> "config" points to.
> > > >> What is the recomended way to cope with this problem (and with links
> > > >> inside plist in general) ?
> > > >
> > > >List the symlink prior to the file/directory it points to. :)
> > > 
> > > Of course... but it breaks the handbook recommendation to keep the files sorted alphabeticaly. It's the only solution ?
> > 
> > I have a patch in the local CVS that changes the way pkg_create(8)
> > registers checksums of symlinks - i.e. instead of checksum of entry
> > the link is poining to it registers checksum of the value returned
> > by readlink(2). This should fix the problem in question.
> > 
> > I'll try to commit this fix after 4.4 is out.
> 
> Since you're in the area, can you have something like the attached,
> which only does MD5s for regular files, not devices and such things
> (used locally to generate a jail package).

Sure, I'll add it into my ever-growing list of pending pkg_* improvements.

-Maxim

> 
> Neil
> -- 
> Neil Blakey-Milner
> nbm@mithrandr.moria.org
> 
> --bp/iNruPH9dso1Pn
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="create.regular.patch"
> 
> Index: pl.c
> ===================================================================
> RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/pl.c,v
> retrieving revision 1.16
> diff -u -r1.16 pl.c
> --- pl.c	2001/05/17 10:12:41	1.16
> +++ pl.c	2001/08/13 10:06:04
> @@ -36,6 +36,7 @@
>      char *where = home;
>      char *there = NULL;
>      char *cp, name[FILENAME_MAX], buf[33];
> +    struct stat sb;
>      PackingList p;
>  
>      for (p = pkg->head; p != NULL; p = p->next)
> @@ -51,6 +52,10 @@
>  	    break;
>  	case PLIST_FILE:
>  	    sprintf(name, "%s/%s", there ? there : where, p->name);
> +	    if (stat(name, &sb) == 0)
> +		if ((sb.st_mode & S_IFREG) != S_IFREG)
> +			break;
> +
>  	    if ((cp = MD5File(name, buf)) != NULL) {
>  		PackingList tmp = new_plist_entry();



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108131106.f7DB6kq12024>