Giter VIP home page Giter VIP logo

Comments (6)

ChrisDenton avatar ChrisDenton commented on September 23, 2024 3

I think we definitely do need to flesh out our documentation. But I'd also like to explicitly decide what our behaviour should be rather than just documenting behaviour which is mostly accidental. Even if that decision ends up being to keep doing what we're currently doing, I'd rather that was a conscious choice.

from rust.

ChrisDenton avatar ChrisDenton commented on September 23, 2024 1

Rust's std does not use PATHEXT and nor does the underlying CreateProcess API. I did once make an issue about Command running scripts but most felt this was better done in a crate (see #94743)

from rust.

jyn514 avatar jyn514 commented on September 23, 2024

https://flatt.tech/research/posts/batbadbut-you-cant-securely-execute-commands-on-windows/ says:

However, since Windows includes .bat and .cmd files in the PATHEXT environment variable by default, some runtimes execute batch files against the developers’ intention if there is a batch file with the same name as the command that the developer intended to execute

does libstd ignore PATHEXT? or is it possible that Command::new("script") could have the same effect as Command::new("script.bat")? in the latter case i don't see much point in disallowing .bat specifically (although it might be reasonable for clippy to lint on it).

from rust.

cuviper avatar cuviper commented on September 23, 2024

FWIW, I was previously confused about PATHEXT too: #50870 (comment)

Other relevant issues for cross reference: #37519 #87945 #93124

from rust.

ChrisDenton avatar ChrisDenton commented on September 23, 2024

This was discussed in the libs-api meeting. There was no consensus on dropping this behaviour.

However there's also not currently a consensus on documenting this behaviour, rather than just keeping some degree of hidden support for compatibility reasons but not actively advertising it (maybe with a lint on static strings passed to Command::new that contain .bat or .cmd extensions).

from rust.

ChrisDenton avatar ChrisDenton commented on September 23, 2024

This was again discussed in the latest libs-api meeting. It was felt that keeping our current behaviour was worth it for the sake of compatibility. So I'll close this.

I'll add that our documentation does now have warnings around bat use. Improved documentation for Windows specific issues can of course be added but that's a separate issue.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.