Bug 5289 - Build system: Uninstall scripts can clobber system files
Summary: Build system: Uninstall scripts can clobber system files
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: Build (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Jelmer Vernooij
QA Contact:
URL:
Keywords:
: 5437 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-28 22:16 UTC by Andrew Kroeger
Modified: 2008-09-18 11:46 UTC (History)
1 user (show)

See Also:


Attachments
Patch to prevent prefix=/usr (750 bytes, patch)
2008-09-13 12:11 UTC, Matthias Dieter Wallnöfer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Kroeger 2008-02-28 22:16:55 UTC
Credit for this discovery goes to cypher on IRC.

The "make uninstall" functionality can clobber system files if S4 was uninstalled under the standard /usr/bin, /usr/sbin, /usr/lib, etc. directories.

The problem is that "make uninstall" calls some shell scripts (script/uninstall*) that take a base directory and file names or partial paths as arguments.  Each of the file names/partial paths is passed through "basename" and then the combination of the base directory and the output of basename is removed.

The particular problem is that /usr/include/time.h can get clobbered.  The uninstallheader.sh script gets /usr/include as the base directory.  One of the partial paths given as an argument is lib/util/time.h, which results in "time.h" when passed through basename.  Thus, "/usr/include" + "time.h" causes the system header file to get clobbered.

Seems like these scripts (and maybe the arguments to their calls in the Makefile) are slightly out of date.

The basename method seems to be used in most of the uninstall* scripts.
Comment 1 Jelmer Vernooij 2008-05-05 11:29:17 UTC
*** Bug 5437 has been marked as a duplicate of this bug. ***
Comment 2 Matthias Dieter Wallnöfer 2008-06-07 13:04:16 UTC
This shouldn't be too difficult to fix!
Comment 3 Jelmer Vernooij 2008-06-07 20:41:00 UTC
Well, patches are welcome :-)
Comment 4 Matthias Dieter Wallnöfer 2008-08-07 13:10:08 UTC
Now I realize that the issue is much more difficult. A small and fast resolution would be the renaming of SAMBA's "time.h".
Otherwise we had much more effort to proof for the right "time.h". Another solution would be to change the header path from "/usr/include" to a subdirectory called "/usr/include/samba".
Comment 5 Matthias Dieter Wallnöfer 2008-09-13 12:09:46 UTC
This is caused due to the use of "--prefix=/usr" on the invocation of "configure". This should be prevented, because there exists an extra option (--with-fhs) for installation in FHS paths.
I'm posting a patch to correct this.
Comment 6 Matthias Dieter Wallnöfer 2008-09-13 12:11:16 UTC
Created attachment 3578 [details]
Patch to prevent prefix=/usr

This patch prevents this special case.
Comment 7 Jelmer Vernooij 2008-09-18 11:46:39 UTC
Thanks! Pushed.