Skip to content

Commit

Permalink
merge #82 into openSUSE/libpathrs:main
Browse files Browse the repository at this point in the history
Aleksa Sarai (2):
  gha: run codespell
  *: fix spelling errors

LGTMs: cyphar
  • Loading branch information
cyphar committed Oct 8, 2024
2 parents 714cd27 + 65731d4 commit 5e51ffe
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ env:
RUST_MSRV: "1.63"

jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install codespell==v2.3.0
- run: codespell -L crate

check:
name: cargo check (stable)
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
against the system libraries don't need to make any changes.

### Fixed ###
- `Root::mkdir_all` no longer does strict verification that directories craeted
- `Root::mkdir_all` no longer does strict verification that directories created
by `mkdir_all` "look right" after opening each component. These checks didn't
protect against any practical attack (since an attacker could just get us to
use a directory by creating it before `Root::mkdir_all` and we would happily
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ totally private `procfs` handle that can be used without worrying about racing
mount operations. `libpathrs` will try to use this if it can (this usually
requires root).
Here are a few examples of pratical things you might want to do with
Here are a few examples of practical things you might want to do with
`libpathrs`'s `procfs` API:
```c
Expand Down
6 changes: 3 additions & 3 deletions contrib/bindings/python/pathrs/_pathrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def __init__(self, file: FileLike):
WrappedFd.leak() to ensure there is only ever one owner of the handle
at a given time).
However, for os.fdopen() (or simmilar Pythonic file objects that are
However, for os.fdopen() (or similar Pythonic file objects that are
tracked by the GC), we have to create a clone and so the WrappedFd is a
copy.
"""
Expand Down Expand Up @@ -649,7 +649,7 @@ def mkdir(self, path: str, mode: int) -> None:
A pathrs.Error will be raised if the parent directory doesn't exist, or
the path already exists. To create a directory and all of its parent
directories (or just re-use an existing directory) you can use
directories (or just reuse an existing directory) you can use
Root.mkdir_all().
"""
err = libpathrs_so.pathrs_mkdir(self.fileno(), _cstr(path), mode)
Expand All @@ -659,7 +659,7 @@ def mkdir(self, path: str, mode: int) -> None:
def mkdir_all(self, path: str, mode: int) -> Handle:
"""
Recursively create a directory and all of its parents at the given path
within the Root (or re-use an existing directory if the path already
within the Root (or reuse an existing directory if the path already
exists).
This method returns a Handle to the created directory.
Expand Down
2 changes: 1 addition & 1 deletion go-pathrs/procfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func ProcSelfOpen(path string, flags int) (*os.File, error) {
//
// Because Go can change the running OS thread of your goroutine without notice
// (and then subsequently kill the old thread), this method will lock the
// current goroutine to ths OS thread (with runtime.LockOSThread) and the
// current goroutine to the OS thread (with runtime.LockOSThread) and the
// caller is responsible for unlocking the the OS thread with the
// ProcHandleCloser callback once they are done using the returned file. This
// callback MUST be called AFTER you have finished using the returned *os.File.
Expand Down
2 changes: 1 addition & 1 deletion include/pathrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum pathrs_proc_base_t {
* different CLONE_FS, it is possible for /proc/self to point the wrong
* thread and so /proc/thread-self may be necessary.
*
* NOTE: Using /proc/thread-self may require care if used from langauges
* NOTE: Using /proc/thread-self may require care if used from languages
* where your code can change threads without warning and old threads can
* be killed (such as Go -- where you want to use runtime.LockOSThread).
*/
Expand Down
2 changes: 1 addition & 1 deletion src/capi/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum CProcfsBase {
/// different CLONE_FS, it is possible for /proc/self to point the wrong
/// thread and so /proc/thread-self may be necessary.
///
/// NOTE: Using /proc/thread-self may require care if used from langauges
/// NOTE: Using /proc/thread-self may require care if used from languages
/// where your code can change threads without warning and old threads can
/// be killed (such as Go -- where you want to use runtime.LockOSThread).
PATHRS_PROC_THREAD_SELF = 0x3EAD_5E1F,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ mod capi;
mod syscalls;
mod utils;

// Library tetss.
// Library tests.
#[cfg(test)]
mod tests;
2 changes: 1 addition & 1 deletion src/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl ProcfsHandle {
// mount ID from parent. This is necessary because ProcfsHandle::open
// might create a brand-new procfs handle with a different mount ID.
// However, ProcfsHandle::open already checks that the mount ID and
// fstype are safe, so we can just re-use the mount ID we get without
// fstype are safe, so we can just reuse the mount ID we get without
// issue.
let parent_mnt_id = utils::fetch_mnt_id(&parent, "")?;

Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/opath/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//! If the check fails, we assume we are being attacked and return an error (and
//! the caller can decide to re-try if they want). The kernel implementation
//! will fail in fewer cases because it has access to in-kernel locks and other
//! measures, but the final check throgh procfs should block all attack
//! measures, but the final check through procfs should block all attack
//! attempts.

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ macro_rules! procfs_tests {
//
// TODO: Figure out the fd type of GLOBAL_PROCFS_HANDLE. In principle we
// would expect to be able to do fsopen(2) (otherwise the fsopen(2)
// tests will fail) but it would be nice to avoid possible spurrious
// tests will fail) but it would be nice to avoid possible spurious
// errors.
procfs_tests! {
@capi-fn [<capi_ $test_name>]
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_root_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ mod utils {
);
}
RenameFlags::RENAME_WHITEOUT => {
// Verify that there is a whiteout entry where the soure
// Verify that there is a whiteout entry where the source
// used to be.
let new_lookup = root
.resolve_nofollow(src_path)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub(crate) fn path_split(path: &'_ Path) -> Result<(&'_ Path, Option<&'_ Path>),
Ok((dir, base))
}

/// RawComponents is like [`Components`] execpt that no normalisation is done
/// RawComponents is like [`Components`] except that no normalisation is done
/// for any path components ([`Components`] normalises "/./" components), and
/// all of the components are simply [`OsStr`].
///
Expand Down Expand Up @@ -211,7 +211,7 @@ impl<'p> Iterator for Ancestors<'p> {
Some(idx) => idx,
};

// TODO: Skip over mutiple "//" components.
// TODO: Skip over multiple "//" components.

// Split the path.
// TODO: We probably want to move some of the None handling here to
Expand Down

0 comments on commit 5e51ffe

Please sign in to comment.