Bug 117976 - misc/gnomehier creates bad mtree file when built as non-root
Summary: misc/gnomehier creates bad mtree file when built as non-root
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-11 15:30 UTC by Stefan Sperling
Modified: 2007-12-11 21:30 UTC (History)
0 users

See Also:


Attachments
file.diff (645 bytes, patch)
2007-11-11 15:30 UTC, Stefan Sperling
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Sperling 2007-11-11 15:30:01 UTC
	
	
	I use the SU_CMD feature in make.conf to avoid compiling
	ports as root.

	If I run 'make' in misc/gnomehier, it creates an mtree
	file that contains my normal user and group IDs as owners
	for all directories in the mtree file.

	So when mtree is used to create the gnome hierarchy,
	the corresponding directories under /usr/local/ end up
	being owned by my normal user.
	
	This leads to various problems, including ldconfig
	refusing to create symlinks in /usr/local/lib.

Fix: The problem is that the pre-install target creates
	a directory tree by simply running 'mkdir' for each
	directory that needs to be in the gnome hierarchy.

	One obvious way of trying to solve this is prefixing the mkdir
	commands with ${SU_CMD}. This is has a problem though:
	If /usr/obj is owned by a group other than wheel (say, "wobj")
	to allow users in that group to write to it (as on my system),
	the resulting mtree file will still specify a wrong group
	ownership (not "wheel", but "wobj" in my case).

	I could not find an mtree flag to override ownership
	information it picks up from the filesystem.

	Of course, more commands could added to the "mkdir loop" to
	ensure the ownership of all directories is set to root:wheel.
	But this would running 'make clean' as a normal user impossible,
	which is slightly annoying.

	So I decided to pipe mtree's output through sed instead
	and carry out the necessary substitutions there.

	This works fine for me:
How-To-Repeat: 	
	
	As non-root user who can write to /usr/obj, run:

	$ echo 'SU_CMD="/usr/bin/su root -c"' >> /etc/make.conf
	$ cd /usr/ports/misc/gnomehier
	$ make clean deinstall reinstall
	$ head /usr/local/etc/mtree/BSD.gnome.dist

	The first line of the file will show your own user
	in uname and gname fields, even though it should be:

	/set type=dir uname=root gname=wheel mode=0755
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-11-11 15:30:09 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-12-11 21:22:33 UTC
mezz        2007-12-11 21:22:28 UTC

  FreeBSD ports repository

  Modified files:
    misc/gnomehier       Makefile 
  Log:
  Fix the creates bad mtree file when built as non-root that will ending up
  the gnomehier in /usr/local/* will have the incorrect owner/group permission.
  
  PR:             ports/117976
  Submitted by:   Stefan Sperling <stsp@stsp.name>
  
  Revision  Changes    Path
  1.39      +3 -1      ports/misc/gnomehier/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Jeremy Messenger freebsd_committer freebsd_triage 2007-12-11 21:22:35 UTC
State Changed
From-To: open->closed

Committed, thanks!