Re: getcwd() returns with stale errno value upon error
From:
Richard Weinberger
Subject:
Re: getcwd() returns with stale errno value upon error
Date:
Wed, 25 Jun 2025 20:12:00 +0200
Hello Oğuz,
On Mittwoch, 25. Juni 2025 20:07 Oğuz wrote:
> On Wednesday, June 25, 2025, Richard Weinberger <richard@sigma-star.at>
> wrote:
> >
> > This can happen on filesystems where d_ino != st_ino
>
>
> i.e. a broken filesystem. What does any of this have to do with bash?
Bash could, for example, check the readdir() return state better to
avoid a confusing error message. IOW setting errno to 0 before calling readdir()
and then checking whether errno has changed.
Having different results for d_ino and st_ino is not that uncommon.
The most prominent example is Linux's OverlayFS. But this happens also with
some FUSE filesystems and such.
Thanks,
//richard
--
sigma star gmbh | Eduard-Bodem-Gasse 6, 6020 Innsbruck, AUT UID/VAT Nr:
ATU 66964118 | FN: 374287y