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)
Mon, Dec 16, 3:46 AM
Unknown Object (File)
Nov 26 2024, 9:18 AM
Unknown Object (File)
Nov 19 2024, 11:24 PM
Unknown Object (File)
Nov 1 2024, 9:26 PM
Unknown Object (File)
Oct 23 2024, 5:04 PM
Unknown Object (File)
Oct 2 2024, 7:41 AM
Unknown Object (File)
Sep 30 2024, 12:38 PM
Unknown Object (File)
Sep 30 2024, 4:26 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.