Skip to content

[0.2] Backports - #5532

Merged
tgross35 merged 45 commits into
rust-lang:libc-0.2from
tgross35:backport-red
Sep 17, 2026
Merged

tgross35 merged 45 commits into
rust-lang:libc-0.2from
tgross35:backport-red

Conversation

@tgross35

@tgross35 tgross35 commented Sep 17, 2026

Copy link
Copy Markdown
Member

Backport the following:

tgross35 and others added 30 commits September 17, 2026 07:37
Also fix a few lints.

(backport <rust-lang#5461>)
(cherry picked from commit 6930883)
Avoid an error when the commit message contains a word like "don't" that
ends the `'`-quoted string. Also fix a few lints.

(backport <rust-lang#5463>)
(cherry picked from commit 0cbe30a)
* File PRs against both branches separately. This avoids the need to
  backport lockfile bumps, which always conflicts.
* Swap to biweekly lockfile maintenance
* Add applicable stable-* labels
* Clean up some inconsistent syntax

(backport <rust-lang#5467>)
(cherry picked from commit 9a7a284)
…lowing are sources to each platform's `paths.h`:

From BSD:
* [Apple](https://github.com/apple-oss-distributions/Libc/blob/71bbe350ab79eef58113991d817ccc6165061a64/include/paths.h#L65): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [Dragonfly](https://github.com/DragonFlyBSD/DragonFlyBSD/blob/42aaacafd14ddb7f660730a5ca5da0a2d941723a/include/paths.h#L40): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [FreeBSD](https://github.com/freebsd/freebsd-src/blob/551b7c5e12bfea623a47edf97ad5689732a1233f/include/paths.h#L40): Has `_PATH_BSHELL` and `_PATH_DEFPATH` (verified same values on version 11+)
* [NetBSD](https://github.com/NetBSD/src/blob/f66621237dc60126bd8a972b6064639892b344b7/include/paths.h#L43): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [OpenBSD](https://github.com/openbsd/src/blob/7d89a3e823169cb6a1d989e3f5f93f7f3c4b5db4/include/paths.h#L39): Has `_PATH_BSHELL` and `_PATH_DEFPATH`

From Linux:
* [Android](https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/paths.h#48): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [glibc](https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/paths.h;h=1342ab3a96ab12065311b718e57e7235e07587f8;hb=HEAD#l36): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [musl](https://git.musl-libc.org/cgit/musl/tree/include/paths.h?id=f21a96538f78fa8e2040831b4209b35f2fb581da#n4): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [uClibc](https://github.com/kraj/uClibc/blob/ca1c74d67dd115d059a875150e10b8560a9c35a8/include/paths.h#L36): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [emscripten](https://github.com/emscripten-core/emscripten/blob/a2059f978ed206b688daf4a8774211949610c2aa/system/lib/libc/musl/include/paths.h#L4): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* l4re: There's [musl](https://github.com/l4re/l4re-core/blob/d09b1619c45d17786bc256ea219688f8ba3ff1fe/libc/musl/contrib/musl/include/paths.h#L4) and [uclibc](https://github.com/l4re/l4re-core/blob/d09b1619c45d17786bc256ea219688f8ba3ff1fe/libc/uclibc-ng/contrib/uclibc/include/paths.h#L36) `paths.h` file containing `_PATH_BSHELL` and `_PATH_DEFPATH` values

Miscellaneous Platforms:
* [Haiku](https://github.com/haiku/haiku/blob/8a33129223e93ea046dc62e9e09f8c93f45cfb7b/headers/compatibility/bsd/paths.h#L45): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [Hurd](https://github.com/joshumax/hurd/blob/83a6fc7641eecdb2b96c2dee2261da92573693de/hurd/paths.h#L20): Doesn't have `_PATH_BSHELL` and `_PATH_DEFPATH` in paths.h (wouldn't hurt to confirm this though in terminal)
* [Cygwin](https://github.com/cygwin/cygwin/blob/cf61e0140e3d6cd21e743a38d35efc98194b63f3/winsup/cygwin/include/paths.h#L12): Has `_PATH_BSHELL` and `_PATH_DEFPATH`
* [newlib](https://github.com/ourairquality/newlib/blob/0dea38754696422d526543262274703acd8317c5/newlib/libc/include/paths.h#L7): Has `_PATH_BSHELL`
* [Redox](https://gitlab.redox-os.org/redox-os/relibc/-/blob/c3b3f2773a3a2622fdb632a9bfa1a77d68778150/include/paths.h): Has `_PATH_BSHELL`

Platforms I'm unsure if they have `_PATH_BSHELL`/`_PATH_DEFPATH`:
* Solarish: I'm unsure how to get this info since I believe Solaris is closed source?
* AIX: I think this is also closed source? However, I saw this [archive repo](https://github.com/Arquivotheca/AIX-4.1.3/blob/d6fe8fe8299ececc0db4fae9c19cd3babffd28ae/bos/usr/include/paths.h#L36) of AIX 4.13 that has `_PATH_BSHELL`.
* [nuttx](https://github.com/apache/nuttx): Couldn't find a `include/paths.h` file.
* [NTO/QNX](https://github.com/qnx): Couldn't find a `include/paths.h` file.

(backport <rust-lang#5449>)
(cherry picked from commit 89a22c6)
Nest and re-export `io::sys`, and re-export other `bits` modules into
top level to match how things are imported via `bits/`.

(backport <rust-lang#5472>)
(cherry picked from commit df4fd88)
Renovate didn't like scheduling for an exact minute, and instead
requires a range.

(backport <rust-lang#5470>)
(cherry picked from commit 819314b)
`tmpnam` is TOCTOU-prone and not thread-safe if called with NULL, and
has been marked obsolete by POSIX [1] and glibc [2]. `tempnam` is also
TOCTOU-prone and marked obsolete by POSIX [3], and glib docs say "Never
use this function". We don't have these on all platforms, but mark them
deprecated where they still exist.

Closes: rust-lang#5211

[1]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/tmpnam.html
[2]: https://man7.org/linux/man-pages/man3/tmpnam.3.html
[3]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tempnam.html
[4]: https://man7.org/linux/man-pages/man3/tempnam.3.html

(backport <rust-lang#5478>)
(cherry picked from commit 0f65977)
(backport <rust-lang#5479>)
(cherry picked from commit d25215c)
ctest must not support nonpublic constant types, during testing we get
get:

       cargo:warning=/checkout/target/x86_64-unknown-linux-gnu/debug/build/libc-test/5b4faecd46dc6111/out/ctest_output.c:4929:8: error: unknown type name '__socket_type'; did you mean '__socklen_t'?
      cargo:warning= 4929 | static __socket_type ctest_const_SOCK_STREAM_val_static = SOCK_STREAM;
      cargo:warning=      |        ^~~~~~~~~~~~~
      cargo:warning=      |        __socklen_t
      cargo:warning=/checkout/target/x86_64-unknown-linux-gnu/debug/build/libc-test/5b4faecd46dc6111/out/ctest_output.c:4931:14: error: unknown type name '__socket_type'; use 'enum' keyword to refer to the type
      cargo:warning= 4931 | CTEST_EXTERN __socket_type *ctest_const__SOCK_STREAM(void) {
      cargo:warning=      |              ^~~~~~~~~~~~~
      cargo:warning=      |              enum
      cargo:warning=/checkout/target/x86_64-unknown-linux-gnu/debug/build/libc-test/5b4faecd46dc6111/out/ctest_output.c:4935:8: error: unknown type name '__socket_type'; did you mean '__socklen_t'?
      cargo:warning= 4935 | static __socket_type ctest_const_SOCK_DGRAM_val_static = SOCK_DGRAM;
      cargo:warning=      |        ^~~~~~~~~~~~~
      cargo:warning=      |        __socklen_t
      cargo:warning=/checkout/target/x86_64-unknown-linux-gnu/debug/build/libc-test/5b4faecd46dc6111/out/ctest_output.c:4937:14: error: unknown type name '__socket_type'; use 'enum' keyword to refer to the type
      cargo:warning= 4937 | CTEST_EXTERN __socket_type *ctest_const__SOCK_DGRAM(void) {
      cargo:warning=      |              ^~~~~~~~~~~~~
      cargo:warning=      |              enum

Link: https://github.com/sailfishos-mirror/glibc/blob/fe03757f67e25bc8fea1473572beb30a05508d08/socket/sys/socket.h
Link: https://github.com/sailfishos-mirror/glibc/blob/fe03757f67e25bc8fea1473572beb30a05508d08/sysdeps/unix/sysv/linux/bits/socket.h
Link: https://github.com/sailfishos-mirror/glibc/blob/fe03757f67e25bc8fea1473572beb30a05508d08/sysdeps/unix/sysv/linux/bits/socket_type.h
Link: https://github.com/sailfishos-mirror/glibc/blob/fe03757f67e25bc8fea1473572beb30a05508d08/sysdeps/unix/sysv/linux/mips/bits/socket_type.h
Link: https://github.com/sailfishos-mirror/glibc/blob/fe03757f67e25bc8fea1473572beb30a05508d08/sysdeps/unix/sysv/linux/sparc/bits/socket_type.h

(backport <rust-lang#5479>)
(cherry picked from commit 0136060)
Make things a bit more type safe and prepare for better checks.

(backport <rust-lang#5490>)
(cherry picked from commit 1f24be2)
Adjust configuration so that we are not e.g. setting `freebsd12` on
non-FreeBSD targets, and add assertions that similar configuration
setups make sense. This also means we aren't spending the (small) time
to invoke version-fetching commands on targets where they won't even be
used.

(backport <rust-lang#5491>)
(cherry picked from commit 6840d7b)
All that is needed is some import adjustments.

Closes: rust-lang#2064

(backport <rust-lang#5492>)
(cherry picked from commit 23bab1e)
(backport <rust-lang#5495>)
(cherry picked from commit ec167ae)
MUSL_REDIR_TIME64_ARCHES are just the 32-bit arches that aren't
1.2-only, i.e. the opposite of the 32-bit arches that always set
`musl_v1_2 = true`. Merge the logic for these two. riscv32 is added to
this list since it is in the same boat.

Additionally, restructure things to make the logic flow more clear.

(backport <rust-lang#5508>)
(cherry picked from commit 4042869)
(backport <rust-lang#5469>)
(cherry picked from commit 77e9b41)
(backport <rust-lang#5493>)
(cherry picked from commit 5cf8e76)
It's been a few months, so nudge to a version past the LLVM update.
This fixes the m68k LLVM issue, but libc still does not build on that
platform.

(backport <rust-lang#5513>)
(cherry picked from commit 92a41dd)
These constants were disabled for uclibc (and therefore implicitly
disabled for L4Re). Now that they are not disabled for uclibc anymore,
explicitly disable them for L4Re.

(backport <rust-lang#5515>)
(cherry picked from commit 7470c73)
In Alpine, we have to set both the old and new `cfg` *and* the
environment variable since various versions of libc are being used by
packaged software.

This will then emit the warnings about the options being deprecated,
even though we fully intentionally set them. I believe the primary
purpose of the warnings is to tell people to migrate to the new `cfg`,
so we can just not print a warning if musl 1.2 is being opted into via
a different way (and the `cfg` or env var has no effect) already.

(backport <rust-lang#5517>)
(cherry picked from commit df65616)
@rustbot

rustbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • Pull requests are usually filed against the main branch for this repo, but this one is against libc-0.2. Please double check that you specified the right target!
  • There are uncanonicalized issue links (such as #123) in the commit messages of the following commits.
    Please add the organization and repository before the issue number (like so rust-lang/rust#123) to avoid issues with subtree.

- Modify `struct_with_default` to automatically add a private field to
  all records such that they are always built field-by-field in
  downstream crates.

- Add support for `exhaustive` custom attribute to opt out of having the
  record have a `__non_exhaustive` field added to it.

- Annotate records without private fields under
  `src/new/helenos/time.rs` and `src/new/linux_uapi/linux/can.rs` with
  `exhaustive` attribute.

(backport <rust-lang#5390>)
(cherry picked from commit ee87176)
Add tests to ensure two things about the private field added to enforce
non-exhaustiveness in records declared within `s_with_default` and
`s_no_extra_traits_with_default`.

- Ensure the field is added only if the `exhaustive` attribute is not
  found while munching the annotated attributes of the record item.

- Ensure the `exhaustive` attribute also works when it appears between
  other sets of attributes.

(backport <rust-lang#5390>)
(cherry picked from commit 2614ed8)
@rustbot

rustbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • Pull requests are usually filed against the main branch for this repo, but this one is against libc-0.2. Please double check that you specified the right target!
  • There are uncanonicalized issue links (such as #123) in the commit messages of the following commits.
    Please add the organization and repository before the issue number (like so rust-lang/rust#123) to avoid issues with subtree.

- Rename `s_with_default`, `s_no_extra_traits_with_default` and
  `struct_with_default` to `s2`, `s_no_extra_traits2`, and
  `custom_struct`. These macros now both add a `Default` impl and a
  private field to enforce non-exhaustiveness.

- Rewrap comments and doc comments to follow 80 and 100 columns guides.

(backport <rust-lang#5390>)
(cherry picked from commit 0c0db5c)
@tgross35
tgross35 enabled auto-merge September 17, 2026 08:04
@tgross35
tgross35 added this pull request to the merge queue Sep 17, 2026
Merged via the queue into rust-lang:libc-0.2 with commit b02fb9c Sep 17, 2026
57 checks passed
@tgross35
tgross35 deleted the backport-red branch September 17, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.