aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-persist/src/fs.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Remove users of fslock other than fslock-guard.Nick Mathewson2026-05-061-32/+26
| | | | | | There were two that relied on the the ability to have a lock in an unlocked state. Instead, we replace those with Option<LockFileGuard> or its equivalent.
* tor-persist: migrate to web-time-compat.Nick Mathewson2026-03-261-4/+4
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-6/+7
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Update code for Edition 2024Nick Mathewson2025-08-071-1/+3
| | | | | | | | | | | | | | | | | | 1. Run cargo fix --edition 2. Selectively revert the "if let"->"match" changes. These changes are meant to protect us from the lifetime changes for "if let" bindings in Rust 2024. But we're not actually relying on the old lifetime rules anywhere, and the match syntax here is quite ugly. 3. Automatically revert `$pat:expr_2021` to `$pat:expr`. (We don't actually want to restrict the expression syntax that our macros accept). Done with `git grep -l expr_2021 | xargs perl -i -pe 's/expr_2021/expr/g;'` 4. Run cargo fmt.
* tor-persist: miri: disable tests that involve fs accessIan Jackson2024-10-081-1/+3
|
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* implement TorClient::wait_for_stoptrinity-1686a2024-07-111-0/+20
|
* Fix clippy::doc_lazy_continuationIan Jackson2024-07-081-9/+9
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-persist: Improve test portabilityTobias Stoeckmann2024-03-011-3/+5
| | | | | | | | | The test fails on Windows systems for two reasons: - File separator \ is printed in error message instead of expected / - Temporary files are located within home directory, which is anonymized Test failure can be provoked on Linux as well by setting TMPDIR to point to a directory within HOME.
* tor-persist: Provide load_store module for use by state_dirIan Jackson2024-01-241-22/+16
|
* tor-persist: Use correct pathnames in errorsIan Jackson2024-01-241-5/+8
| | | | | | | | | | | | Before this, we would say the problem happened while accessing Resource::File { container: "STATE_DIR", file: "KEY.json", } which would imply that we failed to access "STATE_DIR/KEY.json". But that's not true: we *actually* access "STATE_DIR/state/KEY.json".
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-7/+3
| | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.
* Use ErrorReport - run rustfmtIan Jackson2023-01-301-1/+5
| | | | Split off for ease of review and possible rebase.
* Use ErrorReport for errors in warn! in tor-persistIan Jackson2023-01-301-1/+2
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Test a couple more error cases in tor-persist.Nick Mathewson2022-12-061-7/+19
|
* Fix a bunch of "needless borrow" warnings on nightlyNick Mathewson2022-11-181-2/+2
| | | | | It looks like, despite a few false starts, they've got this warning right; there weren't any false positives.
* Use anonymize_home() when displaying various messages.Nick Mathewson2022-08-311-2/+3
| | | | Closes #555
* add feature annotation not added by doc_auto_cfgtrinity-1686a2022-08-241-0/+1
|
* tor-persist: Big refactoring on Error type.Nick Mathewson2022-07-061-18/+81
| | | | | | | | | | | Every error now has an action (what we were trying to do), a resource (what we were trying to do it to), and a source (what problem we encountered). Initially I tried to add "action" and "resource" fields to error variants individually, but that led to a combinatorial explosion. Part of #323.
* tor-persist: Move Error to a module.Nick Mathewson2022-07-061-3/+2
|
* fs-mistrust: convert Io error variant to a struct.Nick Mathewson2022-06-221-1/+1
|
* Editorial improvements on fs-mistrust errorsNick Mathewson2022-06-221-1/+1
| | | | | | These changes make sure that the errors conform to our preferred style, and include a description of what exactly we were doing when something went wrong.
* Remove some stray dbg!() calls.Nick Mathewson2022-05-261-2/+1
|
* Test a few more corner cases in tor-persistNick Mathewson2022-05-251-4/+99
| | | | | Also, if we get an IoError from a call to fs-mistrust, report it as an IoError.
* fs-mistrust: make Mistrust have a corresponding Builder type.Nick Mathewson2022-05-241-1/+1
| | | | | This is an approximately minimal revision to get Builder in place; subsequent commits will clean up the API.
* tor-persist: Use fs-mistrust to verify state file permissions.Nick Mathewson2022-05-091-34/+40
|
* tor-persist::fs::clean: Tweaks based on review.Nick Mathewson2022-04-131-1/+2
| | | | | | | | | | | | Rename "deletable" to "obsolete". Simplify function structure. Report errors from `metadata()` and `modified()`. Don't claim that we're going to delete something unless we are. Comment about making CUTOFF configurable.
* Remove obsolete files from our state directory.Nick Mathewson2022-04-121-0/+16
| | | | | | | This patch removes files created by older versions of arti, if they are at least 4 weeks old. Closes #282
* arti-client: Unlock the state manager on failure to bootstrapeta2022-02-241-0/+11
| | | | | | | | | | | | `StateMgr` got a new `unlock()` method that does what it says on the tin. We now call it from `bootstrap()` using the new `util::StateMgrUnlockGuard`, which works in a manner similar to the `BoolResetter` from `tor_dirmgr`. (A decent small little task in future might be to unify these types in some sort of general arti utility crate?) closes arti#335
* tor-persist: Distinguish load vs. store json errorsIan Jackson2022-02-041-2/+3
| | | | | | | | Serialisation errors ought not to occur, since they would represent an attempt to store malformed data, or something. (We always convert to a string, so the JSON error never contains IO errors or the like.) Deserialisation errors mean the persistent state is corrupt.
* clippy: Pass simply &output to fs::writeIan Jackson2022-02-021-1/+1
| | | | | | clippy::needless_borrow quibbles here, IMO correctly. Its suggestion didn't go far enough: output is a String and a &String can be passed to write as-is for identical effect.
* Fix Rustdoc errors.Nick Mathewson2021-12-081-1/+1
|
* Test FsStateMgr::path(), and fix a bug in it.Nick Mathewson2021-12-071-1/+8
| | | | | We join "state" to the directory name, so we must call parent() to get the original.
* Sketch API for reconfiguration.Nick Mathewson2021-12-071-0/+4
| | | | | | | This patch doesn't actually make anything reconfigurable, but it does create an API that will tell you "you can't change the value of that!" If the API looks reasonable, I can start making it possible to change the values of individual items.
* Upgrade to fslock version 0.2Nick Mathewson2021-10-271-1/+1
| | | | | This version makes all locks per-handle rather than per-process, by moving from lockf() to flock() on unix.
* Replace the return type of StorageMgr::try_lock with a tristateNick Mathewson2021-10-201-6/+8
| | | | | It's useful to know now only if we now have the lock, but also if we just got it for the first time.
* Change tor-persist to use json instead of toml.Nick Mathewson2021-10-071-9/+8
| | | | | | The limitations with toml seemed to be reaching a head, and I wasn't able to refactor the guardmgr code enough to actually have its state be serializable as toml. Json's limitations are much narrower.
* Move FsStatemgr to an inner module.Nick Mathewson2021-09-301-0/+191