Skip to content

cygwin: Change POSIX_SPAWN_* flags to c_short - #5572

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
vignesh-chaturvedi:cygwin-posix-spawn-c-short
Oct 1, 2026
Merged

tgross35 merged 1 commit into
rust-lang:mainfrom
vignesh-chaturvedi:cygwin-posix-spawn-c-short

Conversation

@vignesh-chaturvedi

@vignesh-chaturvedi vignesh-chaturvedi commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

On every other platform the POSIX_SPAWN_* flags are c_short, matching posix_spawnattr_setflags and posix_spawnattr_getflags. Linux was changed in #3629, which fixed #3627, a duplicate of #2268. Cygwin support was added after that with c_int, even though its posix_spawnattr_setflags binding in this crate already takes c_short and newlib's spawn.h declares the parameter as short. This makes Cygwin match.

The values are unchanged. Since this changes the type, it is a breaking change and is meant for main only.

Cygwin is not built in CI, so I checked it locally with RUSTFLAGS=-Dwarnings cargo +nightly check -Zbuild-std=core --target x86_64-pc-cygwin.

The posix_spawn path in std is used on Cygwin, and it infers the type of its flags variable from these constants and then passes flags as _. That is the same as on FreeBSD and illumos, where the flags are already c_short, so std should not need any changes.

With this, the flags are c_short on every platform, so this closes #2268.

Checklist

  • Relevant tests in libc-test/semver have been updated (nothing to update, the names are already listed in cygwin.txt and only the types change)
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the standard doc comment (not applicable)
  • Tested locally (cargo test -p libc-test --target mytarget); especially relevant for platforms that may not be checked in CI

I do not have a Cygwin environment to run libc-test, so the change was only type checked with the command above.

@rustbot

This comment has been minimized.

@tgross35

tgross35 commented Oct 1, 2026

Copy link
Copy Markdown
Member

Seems reasonable to me, @Berrysoft could you ack?

@Berrysoft Berrysoft left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Oct 1, 2026
@tgross35
tgross35 enabled auto-merge October 1, 2026 08:12
These flags are passed to `posix_spawnattr_setflags`, which takes a
`short` in newlib's `spawn.h` and is already bound with `c_short` here.
Every other platform uses `c_short` for them. Linux was changed in
rust-lang#3629, and Cygwin support was added after that with
`c_int`.

The values are unchanged.

Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L42-L47
Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L92-L93
Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L105
@tgross35
tgross35 force-pushed the cygwin-posix-spawn-c-short branch from 598cbe6 to 44cdb48 Compare October 1, 2026 08:12
@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@tgross35

tgross35 commented Oct 1, 2026

Copy link
Copy Markdown
Member

@vignesh-chaturvedi it looks like your PR description may have been AI-assisted, it's a bit verbose. Please handwrite all user-facing communication, including PR descriptions and commit messages (in accordance with the Rust policy).

@tgross35
tgross35 added this pull request to the merge queue Oct 1, 2026
Merged via the queue into rust-lang:main with commit 8cc9013 Oct 1, 2026
60 checks passed
@vignesh-chaturvedi

Copy link
Copy Markdown
Contributor Author

Yes, I used an AI assistant for the PR description and commit message. Sorry about that, and thanks for pointing it out. I’ll write them myself from now on.

@vignesh-chaturvedi
vignesh-chaturvedi deleted the cygwin-posix-spawn-c-short branch October 1, 2026 09:06
@tgross35 tgross35 mentioned this pull request Oct 1, 2026
renovate-bot pushed a commit to renovate-bot/rust-lang-_-libc that referenced this pull request Oct 1, 2026
These flags are passed to `posix_spawnattr_setflags`, which takes a
`short` in newlib's `spawn.h` and is already bound with `c_short` here.
Every other platform uses `c_short` for them. Linux was changed in
rust-lang#3629, and Cygwin support was added after that with
`c_int`.

The values are unchanged.

Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L42-L47
Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L92-L93
Link: https://github.com/cygwin/cygwin/blob/6fde14c0e24aa7e6dd73ba96b8ec60962261e2d5/newlib/libc/include/spawn.h#L105

(backport <rust-lang#5572>)
(cherry picked from commit 8cc9013)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix S-waiting-on-maintainer stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POSIX_SPAWN_* flags have incorrect type POSIX_SPAWN_SETPGROUP et al should be of type c_short

4 participants