Re: getcwd() returns with stale errno value upon error
From:
Oğuz
Subject:
Re: getcwd() returns with stale errno value upon error
Date:
Thu, 26 Jun 2025 17:02:21 +0300
On Thursday, June 26, 2025, Martin D Kealey <martin@kurahaupo.gen.nz> wrote:
> There's a fairly obvious race condition where another process replaces a
> directory entry
That's not the case here.
between readlink and lstat.
Who said anything about them?
> I would like bash to cope more gracefully with "unexpected" results
Yeah? How far should it go? Should it check if a list is actually sorted
after calling qsort on it?
> PS: Under what circumstances would this occur on Linux, where «
> getcwd(buf,size) » is usually implemented as «
> readlink("/proc/self/cwd",buf,size) ».
>
I don't think it's realistic to expect bash to support every toy platform
with five or so users. But if you got time to waste on it, go ahead.
--
Oğuz