Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2024 22:12:18 +0000
From:      bugzilla-noreply@freebsd.org
To:        doc@FreeBSD.org
Subject:   [Bug 262895] access(2) man page should mention softlinks
Message-ID:  <bug-262895-9-sOQE6TwkGw@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-262895-9@https.bugs.freebsd.org/bugzilla/>
References:  <bug-262895-9@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262895

--- Comment #5 from Jamie Landeg-Jones <jamie@catflap.org> ---
(In reply to Dag-Erling Sm=C3=B8rgrav from comment #4)

Hi. Thanks for the feedback.

I could be wrong, but I'll explain my situation as far as I can remember:

I wasn't trying to open the file - I wanted to check the existence of any e=
ntry
with that name in a directory before renaming a file to said name.

Rather than "do it and see", if an entry of the destination name already
existed, I wanted the options presented to the user prior to the rename to =
be
changed appropriately.

I saw at the end of the manpage for access(2) :

"access() remains useful for providing clues to users as to whether operati=
ons
make sense for particular filesystem objects (e.g. 'delete' menu item only
highlighted in a writable folder ... avoiding interpretation of the st_mode
bits that the application might not understand -- e.g. in the case of AFS).=
  It
also allows a cheaper file existence test than stat(2)."

Going by that, access seemed the best option for the job, but of course, it
failed when I had a softlink in the directory that pointed to a non-existent
file, causing an unfriendly error rather than the result I wanted. OK, hard=
ly
the end of the world, but I had expected a test for whether an entry exists
within a directory to not fail in this case, hence why I suggested adding t=
he
bit about softlinks to that paragraph (Incidentally, I meant "lstat" not "s=
tat"
- I have already corrected it in the review)

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-262895-9-sOQE6TwkGw>