rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Please set the rust lib source code read only to prevent the code change by accident.

Open ghost opened this issue 5 years ago • 2 comments

Describe the problem you are trying to solve I am using vscode with auto save on for development. Then I can navigate to the source code of some types in rust lib. For example ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs.But the problem is that the core lib code can be modified by accident and saved automatically.

Describe the solution you'd like The language like golang can save go mod lib files read only in $GOPATH/pkg/mod directory. The vscode will prompt an error when saving the file when the lib code was modified by accident.For example dr-x------ [email protected] in $GOPATH/pkg/mod/github.com/syndtr dirctory.

ghost avatar Nov 11 '20 08:11 ghost

This is an interesting idea. We're not able to trivially do this though as it would either involve OS-specific magic I'm not aware of; or else would require additional IO operations to set permissions bits on every file during unpack. I'd like to as @rbtcollins 's opinion on how that might impact installation time. If not too badly then we can try it.

kinnison avatar Nov 12 '20 15:11 kinnison

The Java world provides this mechanism as the sources of libraries are provided as zip files. The zip file system is naturally read-only.

EugeneChung avatar Dec 10 '23 11:12 EugeneChung