realpath bug

Miguel Angel Alvarez ma.alvarez at ziv.es
Fri Feb 9 08:58:52 UTC 2007


Marc Leeman escribió:
> 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()?
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
People here knows a lot better than me what the behaviour of realpath 
should be. I am in the same situation as Marc, an that is why I tried to 
fix realpath.

Just one question... If the correct behaviour is returning NULL, why 
does realpath copy the path to the output variable?

strcpy(resolved_path, got_path);
return NULL;

Miguel Angel

P.S. Sorry for hijacking a thread. I did not notice it.

P.P.S. I will remember to attach the patches. 
 
----------------------------------------- PLEASE NOTE -------------------------------------------
This message, along with any attachments, may be confidential or legally privileged. 
It is intended only for the named person(s), who is/are the only authorized recipients.
If this message has reached you in error, kindly destroy it without review and notify the sender immediately.
Thank you for your help.
ZIV uses virus scanning software but excludes any liability for viruses contained in any attachment.
 
------------------------------------ ROGAMOS LEA ESTE TEXTO -------------------------------
Este mensaje y sus anexos pueden contener información confidencial y/o con derecho legal. 
Está dirigido únicamente a la/s persona/s o entidad/es reseñadas como único destinatario autorizado.
Si este mensaje le hubiera llegado por error, por favor elimínelo sin revisarlo ni reenviarlo y notifíquelo inmediatamente al remitente. Gracias por su colaboración.  
ZIV utiliza software antivirus, pero no se hace responsable de los virus contenidos en los ficheros anexos.



More information about the uClibc mailing list