change getcwd behavior
This is a feature request to change getcwd to not implement this failure case:
The getcwd() function may fail if:
A parent directory cannot be read to get its name.
This failure case hampers a process' ability to safely operate in a directory with shared access. The prime example of an application harmed by this is Samba. Samba exports directories via SMB. When Samba moves around the exported directory, it uses getcwd to validate it hasn't left the exported tree. With the failure case described above, a user can set permissions on their own directories such that getcwd fails. If getcwd is unreliable, Samba is unable to verify its location and refuses to perform certain actions.
Samba's other major platforms (Linux, FreeBSD) do not have this restriction in their getcwd implementation. I was also informed by an Oracle engineer that Solaris 11 and Solaris 10U11 have changed getcwd's behavior as well.
Can getcwd be changed to match other modern platforms while still following the standard?
Samba bug: https://bugzilla.samba.org/show_bug.cgi?id=13027
illumos-discuss thread: https://illumos.topicbox.com/groups/discuss/T1bf578bf66b8b8b0
Updated by Paul Henson over 4 years ago
Not sure how relevant these are, but a couple links posted on the mailing list so you don't have to dig for them: