Commit Graph

95 Commits

Author SHA1 Message Date
Nick Mathewson 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
Nick Mathewson 932fe48eaf Run add_warnings. 2022-11-03 11:06:02 -04:00
eta c77cecd5b3 Merge branch 'edition-2021' into 'main'
set all crate edition to 2021

See merge request tpo/core/arti!822
2022-11-03 14:39:24 +00:00
trinity-1686a d29f38603d set all crate edition to 2021 2022-11-01 00:17:33 +01:00
trinity-1686a e6e064ac8a remove unused dependancies 2022-10-29 13:29:55 +02:00
Ian Jackson f84d8777db cargo fmt to remove blank lines
Apparently cargo fmt doesn't like these, which my perl rune didn't
delete.

This commit is precisely the result of `cargo fmt`.
2022-10-12 15:29:04 +01:00
Ian Jackson d9910dba08 Replace all README copies in src/lib.rs with includes
The feature we want is `#[doc = include_str!("README.md")]`, which is
stable since 1.54 and our MSRV is now 1.56.

This commit is precisely the result of the following Perl rune:
  perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
2022-10-12 15:29:03 +01:00
Ian Jackson 99f4511f1e README doctests: fix fs-mistrust
Add fn main wrappers to allow use of ?.

Add ,no-run to test cases that fail due to accessing the filesystem.
2022-10-12 15:26:52 +01:00
Nick Mathewson f5389b53e9 Bump crates that have had no API changes. 2022-10-03 09:47:09 -04:00
trinity-1686a 8e7a904260 fix clippy::needless_borrow 2022-09-10 14:39:47 +02:00
Nick Mathewson a5f704f443 Remove semver.md from arti-1.0.0 2022-09-07 09:17:00 -04:00
Nick Mathewson 96875ea208 Bump crate versions in preparation for Arti 1.0.0 release.
Because we want to work more on ensuring that our semver stability
story is solid, we are _not_ bumping arti-client to 1.0.0 right now.

Here are the bumps we _are_ doing.  Crates with "minor" bumps have
had API breaks; crates with "patch" bumps have had new APIs added.

Note that `tor-congestion` is not bumped here: it's a new crate, and
hasn't been published before.

```
tor-basic-utils         minor
fs-mistrust             minor
tor-config              minor
tor-rtcompat            minor
tor-rtmock              minor
tor-llcrypto            patch
tor-bytes               patch
tor-linkspec            minor
tor-cell                minor
tor-proto               minor
tor-netdoc              patch
tor-netdir              minor
tor-persist             patch
tor-chanmgr             minor
tor-guardmgr            minor
tor-circmgr             minor
tor-dirmgr              minor
arti-client             minor
arti-hyper              minor
arti                    major
arti-bench              minor
arti-testing            minor
```
2022-09-01 08:59:49 -04:00
Alexander Færøy 276d472739 Fix broken build and tests after arti!700.
This patch fixes a minor build error where we would call
`compact_home()` on Windows instead of `anonymize_home()` on our PathBuf
instance.

Additionally we change how the `arti_conf` path is constructed such that
we join the individual path components to ensure that no "/" ends up
being present on Windows where path's are separated by "\".

See: tpo/core/arti#555.
See: tpo/core/arti!700.
2022-08-31 20:36:01 +02:00
Nick Mathewson 8b6f4cc69d Update README.md files with "readmes" tool. 2022-08-31 11:08:03 -04:00
Nick Mathewson 77cb5acceb Merge branch 'compact_home_2' into 'main'
Represent the home directory as ${HOME} or %UserProfile%

Closes #555

See merge request tpo/core/arti!700
2022-08-31 13:57:11 +00:00
Nick Mathewson a9f19b0045 Use anonymize_home() when displaying various messages.
Closes #555
2022-08-31 09:38:35 -04:00
Nick Mathewson 7888ca09d2 fs-mistrust: Add a `anonymize_home` extension fn for Path.
This function transforms `/home/nickm/.config` to
`${HOME}/.config/`, so that we can expose the username less in our
logs.
2022-08-31 09:38:09 -04:00
Alexander Færøy 5c3456ff88 Comment out docstring as it fails to compile on Windows.
This patch comments out a method call to `trust_group()` as this method
is not available on all platforms that Arti builds on right now and thus
fails to compile there.

I have added a comment that the given call is not available on non-Unix
like platforms.

See: tpo/core/arti#557.
2022-08-30 22:07:44 +02:00
Alexander Færøy a0bf6b1eeb Disable 3 tests in fs-mistrust.
This patch disables `readable_ok()`, `multiple_errors()`, and
`check_contents()` as they all rely on permission issues on groups being
detected properly which is not the case on Windows right now.

See: tpo/core/arti#557.
2022-08-30 22:06:47 +02:00
Alexander Færøy 8668bd7bc9 Use `expect()` instead of `unwrap()` in `mistrust_build()`.
See: tpo/core/arti#557.
2022-08-29 16:40:00 +02:00
Alexander Færøy d208706280 Refactor the construction of the `Mistrust` type in tests.
This patch refactors how we construct the `Mistrust` type in the tests
found in the fs-mistrust crate such that it is possible to construct an
instance of the `Mistrust` type using a set of operations available via
the `MistrustBuilder`'s methods.

We handle some of the portability issues found while testing this code
on Windows in the convenience function `mistrust_build()` instead of
having duplicated code in multiple test cases.

See: tpo/core/arti#557.
2022-08-29 16:22:57 +02:00
Alexander Færøy 514aaf41b8 Document in link_rel() why we do not support symlinks on Windows.
This patch adds a comment to the `link_rel()` function in fs-mistrust to
explain why we ignore symlink creation on the Windows platform.

See: tpo/core/arti#557.
2022-08-29 15:29:25 +02:00
Alexander Færøy 7b5ee8423b Disable fs-mistrust's simple_cases() unit test on non-Unix.
This patch disables the simple_cases() test on non-Unix platforms and
hides the LinkType type import on non-Unix where we won't be testing
symbolic link features.

See: tpo/core/arti#557.
2022-08-26 21:34:49 +02:00
Alexander Færøy c3928bfe6c Fix compilation of tests for Windows.
This patch allows us to compile the fs-mistrust tests on Windows where
the `trust_no_group_id()` method is unavailable.

See: tpo/core/arti#557.
2022-08-26 21:33:40 +02:00
Alexander Færøy fa1b77642f Mark fs-mistrust's link_rel() and link_abs() as Unix-only.
Since we are not going to test symlink creation on Windows we remove
this code from the testing module.

See: tpo/core/arti#557.
2022-08-26 21:32:12 +02:00
Alexander Færøy edec8f3ecd Mark the repeats and looping tests in fs-mistrust as Unix-only.
See: tpo/core/art#557.
2022-08-26 21:30:20 +02:00
Nick Mathewson c1f64144b3 fs-mistrust: Try to handle verbatim prefixes in test.
We have a test that tries to check that our outputs are the same as
those from `std::fs::canonicalize`.  But on Windows, they aren't:
There, `canonicalize` also puts path prefixes into a "Verbatim"
form.

This patch tries to replicate that behavior for the test only.  If
we find that it's unreliable, though, our best bet is probably to
revise or disable this check on Windows, rather than chasing
compatibility with `GetFinalPathNameByHandle`.

Should fix part of #557.
2022-08-26 10:56:32 -04:00
Ian Jackson ca4ca75ede fs-mistrust: Clarify comment on `stack` 2022-08-26 14:14:40 +00:00
Nick Mathewson 5e7a62dff2 fs-mistrust: Handle windows prefixes specially.
On Windows, paths can have a "prefix", like `C:` or
`\\server\share`.  Attempts to get metadata for these prefixes
appear to fail with `ERROR_INVALID_FUNCTION`, since they are not
files.

This patch teaches fs-mistrust about prefixes on Windows, and tells
it that attempts to find their metadata are allowed to fail.

Doing this may solve part of #557.
2022-08-26 09:43:08 -04:00
Ian Jackson 3faf4475cc Bump toml dependency
We need
  60b874308e6792a73cc00517a60bbef60a12e3cc
  Mixed type arrays (#358)
for a test case in tor-config.

While we're here, drop the dupe entry in tor-config.

(In principle we could make this increase only in tor-config's
dev-dependencies, but that seems unnecessarily fiddly.)
2022-08-25 18:41:28 +01:00
trinity-1686a 7f939fa480 enable doc_auto_cfg feature on every crate when documenting for docs.rs 2022-08-24 18:22:41 +02:00
trinity-1686a 3cb5d27fb7 fix fs-misstrust on android
it would fail to link at runtime due to missing getgrnam_r in bionic

and then it would fail again because some directory is group writeable
2022-08-08 22:32:07 +02:00
Nick Mathewson b16c042004 Now that versions have bumped, remove semver.md files. 2022-08-01 10:07:12 -04:00
Nick Mathewson f5dcb98f06 Bump minor versions on all crates that have had breaking changes.
Done with these commands:

```
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-linkspec      --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump minor
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump minor
cargo set-version -p tor-dirclient     --bump minor
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump minor
cargo set-version -p arti              --bump minor
```
2022-08-01 09:43:09 -04:00
trinity-1686a 4f6c23a1da update semver status file 2022-07-30 15:52:45 +02:00
trinity-1686a 19a71534ec fix runtime issues on ios 2022-07-30 15:42:37 +02:00
trinity-1686a 68ad22a985 remove dependancy 'users' on iOS 2022-07-30 11:28:03 +02:00
trinity-1686a eed8032dbd fix nighly clippy 2022-07-23 20:25:33 +02:00
Nick Mathewson d2b64642e1 fs-mistrust: accept "n" as "no". 2022-07-19 15:29:24 -04:00
Ian Jackson d89758ace2 Semver tweaks from review.
These aren't user facing comments, but getting them
right will help us write better changelogs.
2022-07-19 15:29:24 -04:00
Nick Mathewson 03b5efbd6e fs-mistrust: API to disable based on environment
By default we look at `$FS_MISTRUST_DISABLE_PERMISSIONS_CHECKS`.

Optionally, the user can provide another variable as well, or
disable looking at the environment entirely.
2022-07-19 15:21:09 -04:00
Nick Mathewson 1dda69af2b Remove semver.md files now that 0.5.0 is out 2022-06-24 13:31:38 -04:00
Nick Mathewson 20435aea75 Bump crate and dependency versions.
These were done with the following commands:

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-error         --bump patch
cargo set-version -p tor-config        --bump patch
cargo set-version -p tor-units         --bump patch
cargo set-version -p tor-rtcompat      --bump minor
cargo set-version -p tor-llcrypto      --bump patch
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-proto         --bump minor
cargo set-version -p tor-netdoc        --bump patch
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump patch
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump patch
cargo set-version -p tor-dirclient     --bump patch
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump patch
cargo set-version -p arti              --bump minor
cargo set-version -p arti-bench        --bump minor
cargo set-version -p arti-testing      --bump minor
```
2022-06-24 12:00:22 -04:00
Ian Jackson 589c6e52bb Run maint/add_warning crates/*/src/{lib,main}.rs
Update all lint blocks
2022-06-23 19:15:42 +01:00
Nick Mathewson 813a648ce2 fs-mistrust: convert Io error variant to a struct. 2022-06-22 15:21:34 -04:00
Nick Mathewson 326ab1a7ae Editorial improvements on fs-mistrust errors
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.
2022-06-22 08:03:15 -04:00
Nick Mathewson 08d9bbf33b Do not include error source() in display() format.
According to doc/Errors.md, and in keeping with current best
practices, we should not include display an error's `source()` as
part of that error's display method.  Instead, we should let the
caller decide to call source() and display that error in turn.

Part of #323.
2022-06-21 14:14:14 -04:00
Ian Jackson c2d8dac1ce Merge branch 'better-fs-mistrust-badpermissions-string' into 'main'
fs-mistrust: Improve BadPermission string

See merge request tpo/core/arti!554
2022-06-02 11:15:52 +00:00
Ian Jackson 98ccd7e7e2 Merge branch 'lint' into 'main'
lints: Make lint blocks consistent and ensure they stay that way

Closes #469

See merge request tpo/core/arti!557
2022-05-31 18:27:53 +00:00
Alex Xu (Hello71) bc6b02045e fs-mistrust: Improve BadPermission string
To me, "Incorrect permissions on file or directory /path: g=w o=w"
implies that the current permissions on /path are 022.

Change the message to "Incorrect permissions: /path is
u=rwx,g=rwx,o=rwx; need g-w,o-w", which is closer to chmod syntax and is
more useful in non-interactive environments such as CI and support.
2022-05-31 14:23:01 -04:00