tempfile
sudo
tempfile | sudo | |
---|---|---|
8 | 48 | |
1,074 | 1,105 | |
- | 1.5% | |
6.9 | 9.5 | |
16 days ago | about 22 hours ago | |
Rust | C | |
Apache License 2.0 | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tempfile
-
Hey Rustaceans! Got a question? Ask here (27/2023)!
I need to do some tests with files operations, what's the best practice in regards to creating temporary files in tests ? I heard about tempfile but is there a more idiomatic way to do that ?
-
Testing the memory safe Rust implementation of Sudo/Su
The sudo-rs Cargo.toml [1] file seems very reasonable. This is the curse of being cross platform. The inclusion of https://github.com/Stebalien/tempfile as a dependency is responsible for the overwhelming majority of lines due to including *-sys crates for multiple OSs.
~/Code/tempfile !! tokei vendor
-
Adding automated tests to rost_gen
Eventually, I had to test reading of input file and generation of the html file. To do this, I would need to create test files for input and output for this scenario. However, this could cause problems unless I named all the test files differently as tests usually run in parallel. So, I decided to use the tempfile crate to create a temporary test directory for each test (where needed):
-
Is this safe? Keeping and opening temporary file.
Create a NamedTempFile with the tempfile crate.
-
How can I test this get_type_filepaths function?
Even better would be to create a tempdir and populate it during the test run. Try the tempfile crate.
-
How to open a PDF with default PDF viewer?
Not the same commenter but you could use a tempfile
-
Blog post: Async Cancellation
That said though; there are a few solutions for the problem you're describing. One would be to have a "temp file" type which knows how to delete itself when dropped, but can manually be converted into a permanent file in the case of success. Crates like tempfile provide abstractions for this.
-
temp-dir: Simple temporary directory with cleanup
tempdir was merged into tempfile.
sudo
-
Run0 – systemd based alternative to sudo announced
It depends on whether sudo was compiled with --disable-env-reset or not, it's on by default[1].
Also some variables are inherited regardless (e.g. DISPLAY, TERM), and some useful ones (e.g. HOME) are initialized by sudo, but I can't tell where that's done.
[1]: https://github.com/sudo-project/sudo/blob/ef52db46f9b375d7ff...
- Sudo Contributors
-
Sudo for Windows
Side note that I've always found interesting: sudo is almost entirely maintained by one dude: https://github.com/sudo-project/sudo/graphs/contributors
-
Rowhammer Resistant Coding in Sudo
The n=2 case also occurs in the commit: https://github.com/sudo-project/sudo/commit/7873f8334c8d3103...
And indeed, the two values ate bitwise complements.
-
The First Stable Release of a Rust-Rewrite Sudo Implementation
One feature they didn't mention they left out was the ability to run `make me a sandwich` (https://github.com/sudo-project/sudo/blob/main/Makefile.in#L...)
-
to Linus Torvalds, maybe?
It's (kind of) back - https://github.com/sudo-project/sudo/commit/9757d29a24ac1872872cf09757b0439c54089707
-
Testing the memory safe Rust implementation of Sudo/Su
└───────────────────────────────────────────────────────────────────────────────────────┘
As a comparison, this is the output for https://github.com/sudo-project/sudo:
0.0439 secs
-
what is funniest prompt u have got from the terminal for incorrect password
Complete list (can be found here, files ins_*.h):
-
Get gnu gnu'd
Fun fact, the “incident will be reported” message was close to being removed from sudo recently: https://github.com/sudo-project/sudo/commit/6aa320c96a37613663e8de4c275bd6c490466b01
- ‘Godfather of AI’ quits Google and gives terrifying warning
What are some alternatives?
tempdir - Temporary directory management for Rust
doas - A port of OpenBSD's doas which runs on FreeBSD, Linux, NetBSD, and illumos
zbox - Zero-details, privacy-focused in-app file system.
cosmopolitan - build-once run-anywhere c library
xattr - Extended attribute library for rust.
php-docker - Docker Official Image packaging for PHP
rust-9p - Tokio-based asynchronous filesystems library using 9P2000.L protocol, an extended variant of 9P from Plan 9.
sudo-rs - A memory safe implementation of sudo and su.
rust - Empowering everyone to build reliable and efficient software.
dotfiles
fs_extra - Expanding opportunities standard library std::fs and std::io
CppCoreGuidelines - The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++