Skip to content

Build script regression prevents some builds from terminating #11196

Closed
@Kirens

Description

@Kirens

Problem

It seems build scripts previously were executed with a terminated stdin, but not since 1.63.0.

The build script of a package that I am using checks for an optional build-time dependency with Command::new("exe").spawn().is_ok(). It is expected to terminate immediately, but in newer versions of cargo it's blocking the script from completing while awaiting input from stdin. A solution for this package is to add .stdin(Stdio::null()) to quickly resolve the issue.

I'm not sure if this is a deliberate change. But I can't seem to find any notes regarding this in the changelogs.

Steps

  1. Create a build.rs that Command::new(...).spawn()s a process that only terminates once stdin does (e.g. cat)
  2. cargo build with 1.62. Notice how it completes
  3. cargo build with 1.63. Notice how it freezes while building.

I wrote a simple proof-of-concept

Possible Solution(s)

I was unable to find the culprit. If it's a desired change, I'd suggest adding a note about it in the changelog.

Notes

No response

Version

cargo 1.62.0
release: 1.62.0
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.84.0 (sys:0.4.51+curl-7.80.0 system ssl:OpenSSL/1.1.1q)
os: NixOS 21.11.0 [64-bit]

------------------------------------------------------------------

cargo 1.63.0
release: 1.63.0
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.84.0 (sys:0.4.55+curl-7.83.1 system ssl:OpenSSL/1.1.1q)
os: NixOS 21.11.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions