[gmail] Re: realpath bug

Marc Leeman marc.leeman at gmail.com
Fri Feb 9 08:36:05 UTC 2007


Cc to busybox ML.

> > > could you be more specific as to what is breaking ?  "syslogd breaks on
> > > read only filesystems" does not translate well into actual test cases for
> > > inclusion into uClibc testsuite ...
> >
> > cf. busybox discussion of yesterday:
> >
> > http://www.busybox.net/lists/busybox/2007-February/026252.html
> 
> ok, looking again and i see your setup is:
>  - /dev is mounted RO
>  - /tmp is mounted RW
>  - /dev/log is a symlink to ../tmp/log
> 
> busybox launches sysklogd which does:
>  - dev_log_name = xmalloc_realpath(/dev/log)
>  - unlink(dev_log_name)
> 
> on your system, dev_log_name should be resolving to /tmp/log but it seems to 
> return NULL ... on my system, it works:
> # ls -l /dev/log /tmp/log 
> lrwxrwxrwx 1 root root 10 2007-02-08 23:58 /dev/log -> ../tmp/log
> -rw-r--r-- 1 root root  0 2007-02-08 23:58 /tmp/log
> # ./busybox syslogd -n
> running xmalloc_realpath(/dev/log)
> got back /tmp/log
> dev_log_name is now /tmp/log
> unlinking(/tmp/log)
> exiting now
> # ./busybox syslogd -n
> running xmalloc_realpath(/dev/log)
> got back (null)
> dev_log_name is now /dev/log
> unlinking(/dev/log)
> exiting now
> 
> this behavior is correct ... since /tmp/log was removed in the first run, the 
> second run should actually return NULL ...

The system is using an empty /tmp fs (tmpfs), so the socket or any other
file is not present in /tmp when xmallok_realpath("/dev/log") is called.

The old syslogd implementation correctly de-referenced the pointer in
/dev/log to /tmp/log and created a /tmp/log socket. the new syslogd
implementation tries to delete /dev/log on the RO filesystem and tries
to create the log socket there, what obviously fails on a RO fs.

So since uclibc's implementation of realpath matches glibc's; we should
re-store the relevant parts of the older syslogd code again instead of
fixing it in xmalloc_realpath()?

-- 
  greetz, marc
My dear, I've kicked more ass than you've sat on.
	Zhaan - Through the Looking Glass
scorpius.homelinux.org 2.6.19 #1 Tue Dec 5 16:35:02 CET 2006 GNU/Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070209/e3e8d3ed/attachment-0002.pgp 


More information about the busybox mailing list