Re: git: d549de769055 - main - libc: Remove readdir_r(3) [This broke building rust 1.88]

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 11 Sep 2025 15:05:27 UTC
Alan Somers <asomers_at_freebsd.org> wrote on
Date: Thu, 11 Sep 2025 13:44:11 UTC :

> On Thu, Sep 11, 2025 at 4:49 AM Dag-Erling Smørgrav <des@freebsd.org> wrote:
> 
> > Mark Millard <marklmi@yahoo.com> writes:
> > > Example error message text from the log file for the
> > > rust build via poudriere-devel:
> > >
> > >
> > > = note: ld: error: undefined symbol: readdir_r
> > > >>> referenced by std.d8968a002452916e-cgu.07
> > > >>>
> > std-de94806a57729acc.std.d8968a002452916e-cgu.07.rcgu.o:(std::sys::fs::unix::remove_dir_impl::remove_dir_all_recursive::hbe1160129d2c5f7c)
> > > >>> in archive /wrkdirs/usr/ports/lan
> > >
> > g/rust/work/bootstrap/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-de94806a57729acc.rlib
> > > >>> did you mean: readdir_r@FBSD_1.5
> > > >>> defined in: /lib/libc.so.7
> > > cc: error: linker command failed with exit code 1 (use -v to
> > see invocation)
> >
> > Tell that to the Rust developers. They have been repeatedly warned
> > against using readdir_r(3) for years, as far back as 2016.
> >
> 
> Have they?

The man page covering readdir_r for FreeBSD 11.1-RELEASE
and later say:

QUOTE
DESCRIPTION
     The readdir_r() interface is deprecated because it cannot be used
     correctly unless {NAME_MAX} is a fixed value.
END QUOTE

The web page reports: August 31, 2016

It is too bad that it was not noticed and fixed during
the rust changes to support FreeBSD 12.

> Looking at rust's github page, I see discussions about using
> readdir_r on Fuchsia and Linux, but nothing about BSD. But even if they
> have been "warned", that's not really relevant. We shouldn't cavalierly
> break the build for such important software. I'm guessing that you didn't
> do an exp-run for this change, so there is probably other software in ports
> that is broken, too.

I would agree that an exp-run and explicit decisions
about the handling of any related failures seems
appropriate. Some of that might involve notifications
to upstream for various ports.

> I request that this change be reverted. And I
> request that it remain reverted until such a time as an exp-run passes,
> possibly with the aid of installing misc/compat14x as a dependency for some
> ports.


I'm nervous about the references to rust's libstd
being involved (copy/pasted text):

referenced by std.d8968a002452916e-cgu.07

std-de94806a57729acc.std.d8968a002452916e-cgu.07.rcgu.o:
(std::sys::fs::unix::remove_dir_impl::remove_dir_all_recursive::hbe1160129d2c5f7c)

lib/libstd-de94806a57729acc.rlib

===
Mark Millard
marklmi at yahoo.com