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

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



                  How to become unpopular

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)

3. Add a space after "ROOTDIR=/"
4. Release to unwary users

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.

Seriously now, I made a mistake of this kind in an early release of
the tpctl program.  Spaces got added to the end of a line in the Makefile
when I copied a bit of code from one place to another using X's copy and
paste.  A user wrote to inform me that my lovely "make uninstall" rule
had deleted his entire /lib/modules directory.  If the error had been
a little bit different it could have wiped out his entire filesystem,
as one would do if one followed the instructions above.  I recently
came across this user's bug report as I was cleaning out old e-mail
and I thought that the story deserved a wider audience.  A mistake like
this could be made in a debian package installation script too, I
suppose.  Beware.

--
Thomas Hood
jdthood_AT_yahoo.co.uk



Reply to: