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

Re: Experiences with compiling Debian



> This will execute /bin/bash[1], and set environmen varable
> "LD_PRELOAD" to a libfakeroot.so.0.0. This libfakeroot currently
> overloads only chown and lstat[2]. Now, when you type in the thus
> executed shell:
> 
> $ chown root:users somefile
> 
> this will call the wrapper "chown" function. this wrapper calls the
> real chown, _and_ it sends (via SYSV IPC calls) a message to the
> (still running) fakeroot "daemon". This daemon records the new fake
> onerships of the file in an internal variable.

Looks fine so far! BTW, I guess the daemon is also started by
'fakeroot', right?

> - yes fstat and fchown will be somewhat of a problem, but I'll just
> have to overlod open() etc too, and keep a list of inodes/filenames.

Hmm... to be more exactly: You have to wrap open(), create(), and
close(), and have to keep a table of fd -> name mappings for fchown()
and fchmod().

> 	- I probably will go wrong for pathalogical cases like
> 
> 		 ln file1 file2
> 		 chown mail:sys file2
> 		 rm file2
> 		 ls -al file2
> 
> 	  I doubt whether these are important, and even if they are, I
> 	  guess it will be possible to get it right.

Ok, it's a really pathological case, maybe we can delay a solution
until we need it. I think the way to handle it would be to wrap link()
and unlink() calls, too... But that could become a bit more
complicated :-(

> [2] Well, I've olverloaded lstat all right, but it doesn't seem to
> get called don't know why yet. Why would chown() work and lstat()
> not?

Better also wrap stat() and fstat(), too. Maybe that's the reason.
Another possibility is that the shell uses some other library function
that indirectly does the stat, and that function uses _lstat or _stat
instead of lstat/stat. Then you'd have to wrap those '_' versions,
too. A real drawback of this: You then can't call the real functions
anymore :-((, you have to write your own versions using the macros
from <asm/unistd.h>, which isn't very clean anymore. Maybe use gdb on
the shell to learn what's going on.

Roman


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: