Skip to content

Cast MS_RDONLY to uintptr_t to fix build error on Fedora 43 (Glibc 2.42) due to unsigned enum - #246

Merged
robertswiecki merged 1 commit into
google:masterfrom
LukaHietala:master
Jan 6, 2026
Merged

Cast MS_RDONLY to uintptr_t to fix build error on Fedora 43 (Glibc 2.42) due to unsigned enum#246
robertswiecki merged 1 commit into
google:masterfrom
LukaHietala:master

Conversation

@LukaHietala

@LukaHietala LukaHietala commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a build failure on Fedora 43 (and likely on other systems with Glibc 2.42+) where sys/mount.h enum is unsigned. In Glibc 2.42, MS_NOUSER was updated to 1U << 31 from 1 << 31 to fix integer overflow warnings (Bug 32708, commit: 3263675250cbcbbcc76ede4f7c660418bd345a11). This change forces the entire sys/mount.h enum (which includes MS_RDONLY) to be unsigned, which causes the build to fail in mnt.cc.

Build errors:

mnt.cc:550:43: error: enumerated and non-enumerated type in conditional expression [-Werror=extra]
  550 |                 uintptr_t flags = (p.rw() ? 0 : MS_RDONLY);
      |                                           ^
cc1plus: all warnings being treated as errors

Casting MS_RDONLY to uintptr_t fixes this issue by ensuring type compatibility,

Tested on Fedora 43 (Glibc 2.42, Unsigned enum) and on Debian 13 (Glibc 2.41, Signed enum). Tested also on Arch Linux with Glibc 2.42 to confirm its not Fedora only issue.

Glibc 2.42 release notes: https://inbox.sourceware.org/libc-announce/5906001.DvuYhMxLoT@pinacolada/T/

@google-cla

google-cla Bot commented Jan 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@robertswiecki

Copy link
Copy Markdown
Collaborator

Great, thank you!

@robertswiecki
robertswiecki merged commit 4cd66bc into google:master Jan 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants