Page MenuHomeFreeBSD

open(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW.
ClosedPublic

Authored by jilles on Nov 20 2016, 2:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 3:12 AM
Unknown Object (File)
Sun, Apr 21, 3:12 AM
Unknown Object (File)
Sat, Apr 20, 2:34 PM
Unknown Object (File)
Sat, Apr 20, 2:04 PM
Unknown Object (File)
Sat, Apr 6, 12:00 PM
Unknown Object (File)
Mar 13 2024, 7:15 PM
Unknown Object (File)
Mar 13 2024, 6:40 PM
Unknown Object (File)
Jan 29 2024, 8:41 AM
Subscribers

Details

Summary

We return [EMLINK] instead of [ELOOP] when trying to open a symlink with
O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished.
Code like cmp -h and xz takes advantage of this.

Test Plan

None

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jilles retitled this revision from to open(2): Clarify non-POSIX error when opening a symlink with O_NOFOLLOW..
jilles updated this object.
jilles edited the test plan for this revision. (Show Details)
jilles added a reviewer: kib.
kib edited edge metadata.
kib added inline comments.
lib/libc/sys/open.2
509 ↗(On Diff #22362)

s/fails with/returns error/ ?

'fails' implies that the implementation misbehaves, while there the narrative is about proper handling of a condition.

This revision is now accepted and ready to land.Nov 20 2016, 2:51 PM

The proposed wording is awkward.
See my suggestions for improvement.

lib/libc/sys/open.2
509 ↗(On Diff #22362)

Agreed. Or maybe

".Fx sets errno to EMLINK if O_NOFOLLOW is set in flags and the final component of pathname is a symbolic link instead of ELOOP specified by POSIX" plus blelow

or

".Fx sets errno to EMLINK instead of ELOOP as specified by POSIX when O_NOFOLLOW is set in flags and the final component of pathname is a symbolic link to distinguish it from the case of too many symbolic link traversals in on of its non-final component."

518–520 ↗(On Diff #22362)

"to distinguish the case of too many symbolic link traversals in the non-final components of the pathname from the case of a symbolic link in the final component."

is shorter and imho clearer.

jilles edited edge metadata.

Improve wording.

This revision now requires review to proceed.Nov 22 2016, 8:55 PM
kib edited edge metadata.
kib added inline comments.
lib/libc/sys/open.2
510 ↗(On Diff #22444)

.Va errno

This revision is now accepted and ready to land.Nov 22 2016, 9:17 PM
This revision was automatically updated to reflect the committed changes.