logoalt Hacker News

swiftcodertoday at 2:50 PM2 repliesview on HN

build.rs by design can run absolutely anything. There tons of build.rs scripts that invoke a whole-ass C compiler toolchain to build and link C dependencies...

It isn't so much a question of sandboxing build.rs, as fundamentally changing the way that foreign dependencies are integrated into the rust toolchain (i.e. moving from a rust-centric system like Cargo to something more general like buck2)


Replies

mike_hearntoday at 5:17 PM

Worth noting that the JVM ecosystem doesn't have this issue because there is no notion of installing dependencies, and the package managers are just downloaders with nothing else. No build.rs equivalent.

To solve the problem of native/C dependencies, they just bundle pre-compiled libraries as data files.

Rust could do the same thing.

show 2 replies
kibwentoday at 3:43 PM

The vast and overwhelming majority of build scripts are building C code, so the other solution is to move away from integrating with C dependencies to native Rust dependencies, in which case adding friction to build scripts would be less noticeable.

show 2 replies