Bug 9611 - UnixSymbolicLinkInfo does not work with Linux proc file system
Summary: UnixSymbolicLinkInfo does not work with Linux proc file system
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.POSIX (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-16 12:23 UTC by Andreas Damm
Modified: 2013-01-16 12:23 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Andreas Damm 2013-01-16 12:23:35 UTC
The proc file system in Linux is not POSIX compliant and returns st_size == 0 when calling lstat (e.g. lstat on "/proc/self/exe"). Which in turn makes Mono.Unix.UnixSymbolicLinkInfo.TryReadLink throw an exception when calling ToString(int, int) on the buffer populated by readlink. 

I suggest that when st_size == 0 that the length of the buffer for readlink is established through repeated calls to readlink (stop when result is less then buffer size).

Actual version tested: 3.0.2

Note You need to log in before you can comment on or make changes to this bug.