I have been using Linux Mint for about a year, previously using Windows 7. Thanks to the easy GUI it's been a smooth transition but I still don't know my way around the deeper system components and configurations.
I would now like to learn Rust, and I want to do it in some kind of sandbox or controlled space since all my stuff is on this machine.
As a beginner how should I install Rust? Should I use rustup.rs, the IRust Flatpak in the Software Manager, or do I need to first create a virtual machine?
What is the easiest way to create a sandbox for running Rust programs? Can I allow the programs to access specific drives or folders only, without having to copy these resources into a separate sandbox tree?
What else should I know that I don't know to ask before starting on this journey?
[SOLVED] Learning Rust safely
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
[SOLVED] Learning Rust safely
Last edited by Navigator on Sat Dec 30, 2023 2:05 pm, edited 1 time in total.
- JoeFootball
- Level 13
- Posts: 4673
- Joined: Tue Nov 24, 2009 1:52 pm
- Location: /home/usa/mn/minneapolis/joe
Re: Learning Rust safely
I'd say the easiest is the Rust Playground, as it's online ready-to-go.Navigator wrote: What is the easiest way to create a sandbox for running Rust programs?
And here's some learning resources for your consideration.
Re: Learning Rust safely
Thanks, that's surely a good place to start, but when I want to go a bit deeper my original questions remain.
Re: Learning Rust safely
Why do you want to run your rust programs in a sandbox?
Re: Learning Rust safely
I am afraid I'll do something stupid and delete or corrupt files. I would also like to be able to run and modify program examples without worry that they could be malicious or just poorly conceived. I don't want to rename all files in /home to foo.bar or something.
Is this a foolish or difficult request? It's pretty trivial under Windows with Sandboxie to keep a program's disk writes contained.
Re: Learning Rust safely
I think if you want to be absolutely sure, & have an easy life in the future, then a virtual machine is the way to go.
I use VirtualBox downloaded directly from Oracle
https://www.virtualbox.org/wiki/Downloads
plus the Oracle VM VirtualBox Extension Pack, rather than using the instance from the Repositories.
If you create chaos with your Rust programmes then just revert back to the prior Snapshot, or delete completely and start again!!
I use VirtualBox downloaded directly from Oracle
https://www.virtualbox.org/wiki/Downloads
plus the Oracle VM VirtualBox Extension Pack, rather than using the instance from the Repositories.
If you create chaos with your Rust programmes then just revert back to the prior Snapshot, or delete completely and start again!!
Re: Learning Rust safely
You need to use Rustup from their website, don't use repository or Flatpak versions. Rustup gets updates constantly. Best learning resource is Rust Foundation's own book. https://github.com/rust-lang/book
I think your fears are unfounded; you can just use VS Code and the Rust extension, then create a project with
I think your fears are unfounded; you can just use VS Code and the Rust extension, then create a project with
cargo
and you're not going to corrupt anything, you will be exclusively working with files inside the project directory. Please stop worrying!
Re: Learning Rust safely
Okay, Rustup it is. Would you please explain "you will be exclusively working with files inside the project directory." Does Cargo automatically limit scope somehow? How then do I write programs that CAN access/alter files outside of the project directory?spamegg wrote: ⤴Fri Dec 29, 2023 12:05 pm You need to use Rustup from their website, don't use repository or Flatpak versions. Rustup gets updates constantly. Best learning resource is Rust Foundation's own book. https://github.com/rust-lang/book
I think your fears are unfounded; you can just use VS Code and the Rust extension, then create a project withcargo
and you're not going to corrupt anything, you will be exclusively working with files inside the project directory. Please stop worrying!
Screenshot from 2023-12-29 19-03-53.jpg
Re: Learning Rust safely
I know nothing about rust, but I know vscode focuses on a project directory, and I think you would have to deliberately reach up and outside, with something like
If it really worries you, you could make a new user/login for your rust development work.
open("../filename")
. If it really worries you, you could make a new user/login for your rust development work.
Re: Learning Rust safely
Cargo has commands likeDoes Cargo automatically limit scope somehow?
cargo build, cargo test, cargo run
etc. that only works with the project directory. Instead of asking here you should go over to Rust Community's Discourse forum. https://users.rust-lang.org/ Technically you can still do anything you want (write malicious code that messes with your system) but I don't see how that would ever come up unless you go out of your way to do it on purpose.
Do not access / alter files outside of the project directory. Just put the files you need inside the project directory. According to Cargo defaults, they would probably go into theHow then do I write programs that CAN access/alter files outside of the project directory?
/tests
or /examples
directory. This is how modern project management works. It should not depend on outside files, since that cannot be reproduced on other people's machines. Project structures are made with open source collaboration in mind, not your personal PC.
If you are so scared of writing over your system files, then all the more reason NOT to access outside files! Outside files are not relevant to the project anyway!
You simply need to get familiar with Cargo projects. Thousands of beginners write projects without any fear of writing over any files. It's really not an issue. You need to get over your worries.