[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to become very unpopular. (or:) A scary story.



On Thu, Aug 16, 2001 at 01:56:02PM -0400, Thomas Hood wrote:
> Instructions.
> 
> 1. Create some piece of software
> 2. Write "install" and "uninstall" targets for the Makefile
>    (to be run by root of course) as follows:
> 
> > ROOTDIR=/
> > LIBDIR=$(ROOTDIR)usr/lib/
> > 
> > install:
> >	mkdir $(LIBDIR)foo
> > 	cp -p lib/foo* $(LIBDIR)foo
> > 
> > uninstall:
> > 	rm -rf $(LIBDIR)
>
I assume, you mean rm -rf $(LIBDIR)foo
 
> 3. Add a space after "ROOTDIR=/"
> 4. Release to unwary users
>
install target would fail. I assume, you mean not adding a space in 1st
version.
 
> 5. Just to make sure, add the space and the "uninstall" target
> to a later release and write in the README that the user should
> first run "make uninstall" in order to remove earlier versions of
> the software.
>
yup.

On Thu, Aug 16, 2001 at 10:53:31PM +0300, Richard Braakman wrote:
> An easy way to prevent problems of this sort is to specify all directory
> variables without trailing slashes.  This makes using them more natural, too.
> Example:
>
> > ROOTDIR=
> > LIBDIR=$(ROOTDIR)/usr/lib
> >
> > install:
> >	  mkdir $(LIBDIR)/foo
> >	  cp -p lib/foo* $(LIBDIR)/foo/
> >
> > uninstall:
> >	  rm -rf $(LIBDIR)
Ups, what about?:

ROOTDIR=/usr<space>
LIBDIR=$(ROOTDIR)/lib

the proper solution in this case is to quote:

install:
      mkdir $(LIBDIR)/foo
      cp -p lib/foo* "$(LIBDIR)"/foo/

uninstall:
      rm -rf "$(LIBDIR)"

Regards, Gerrit.

-- 
pape@innominate.com
                                                        innominate AG

tel: +49.30.308806-0  fax: -77              http://www.innominate.com



Reply to: