Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openSUSE/libpathrs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.3
Choose a base ref
...
head repository: openSUSE/libpathrs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Oct 9, 2024

  1. VERSION: back to development

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 9, 2024
    Copy the full SHA
    6433a63 View commit details
  2. merge #86 into openSUSE/libpathrs:main

    Aleksa Sarai (3):
      VERSION: back to development
      VERSION: release v0.1.3
      CHANGELOG: update to include python changes
    
    LGTMs: cyphar
    cyphar committed Oct 9, 2024
    Copy the full SHA
    27e0875 View commit details
  3. python bindings: add Root.creat_raw and sanify Root.creat API

    Users probably want to be able to do Root.creat and get a WrappedFd, so
    add a method for that.
    
    In addition, the argument order for Root.creat didn't match the
    openat(O_CREAT) argument order, which could cause some confusion so
    rotate the arguments to match (this means we have to give filemode a
    default value -- 0o644 makes the most sense as a default).
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 9, 2024
    Copy the full SHA
    51670ff View commit details

Commits on Oct 10, 2024

  1. go: drop nolintlint lint

    The nolintlint lint (heh) thinks the //nolint:exhaustive directive is
    extraneous and fails our CI seemingly randomly, so drop it for now.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 10, 2024
    Copy the full SHA
    840a5a5 View commit details
  2. go bindings: fixup import "C" line

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 10, 2024
    Copy the full SHA
    37bd58f View commit details
  3. {Root,Handle}::from_fd_unchecked -> from_fd

    It seems incredibly unlikely that we will ever add verification to
    Handle::from_fd / Root::from_fd, so having the _unchecked suffix doesn't
    really make sense.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 10, 2024
    Copy the full SHA
    97403ee View commit details
  4. impl From<...Fd> for {Root,Handle}

    We still need {Root,Handle}::from_fd because you can't do something like
    
      impl From<Into<OwnedFd>> for ...
    
    and being able to do Root::from_fd(<File>) is quite nice, so we need
    both methods. But at least now you could do <File>.into() if that's what
    you're into.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 10, 2024
    Copy the full SHA
    8c4a906 View commit details
  5. merge #88 into openSUSE/libpathrs:main

    Aleksa Sarai (2):
      impl From<...Fd> for {Root,Handle}
      {Root,Handle}::from_fd_unchecked -> from_fd
    
    LGTMs: cyphar
    cyphar committed Oct 10, 2024
    Copy the full SHA
    34de9d3 View commit details

Commits on Oct 14, 2024

  1. capi: readlink: only calculate path length once

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 14, 2024
    Copy the full SHA
    a856dbb View commit details
  2. *: migrate from lazy_static! to once_cell::sync::Lazy

    Ideally we would switch to std::sync::LazyLock but that was only
    stabilised in Rust 1.80.0, so we have to make do with once_cell. At
    least once_cell has basically the same API as the merged-into-std API,
    so we can switch over very easily.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 14, 2024
    Copy the full SHA
    aaec3d6 View commit details
  3. procfs: make is_subset check cheaper

    Allocating file descriptors for the is_subset check is completely
    unnecessary. We can just do a basic faccessat(2) check -- the paths we
    care about are very basic and we only care if they exist at all and not
    their contents or what they point to.
    
    In addition, because we check /proc/1 and /proc/stat, using faccessat(2)
    will avoid us thinking that /proc is a subset if something has
    overmounted /proc/stat (technically is a subset but that's just a game
    of whack-a-mole we can't win).
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 14, 2024
    Copy the full SHA
    13966e0 View commit details
  4. merge #89 into openSUSE/libpathrs:main

    Aleksa Sarai (1):
      *: migrate from lazy_static! to once_cell::sync::Lazy
    
    LGTMs: cyphar
    cyphar committed Oct 14, 2024
    Copy the full SHA
    4baab3d View commit details
  5. merge #90 into openSUSE/libpathrs:main

    Aleksa Sarai (1):
      procfs: make is_subset check cheaper
    
    LGTMs: cyphar
    cyphar committed Oct 14, 2024
    Copy the full SHA
    14f579c View commit details
  6. bindings: mv COPYING.APACHE-2.0 -> COPYING

    It turns out that pkg.go.dev doesn't like COPYING.APACHE-2.0 as a
    license file name and refuses to generate docs, so just rename all of
    the custom COPYING.* files to just COPYING.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 14, 2024
    Copy the full SHA
    3fc2b5d View commit details

Commits on Oct 17, 2024

  1. syscalls: switch to rustix for most of our syscalls

    Using libc leads to several issues when dealing with multiarch that make
    things quite frustrating, and rustix does provide nicer APIs (for the
    most part -- some are a little wonky). One major annoyance is that
    building for musl leads to annoying build failures because musl uses
    differently-sized or differently-signed types, which we don't want to
    care about because we just want to use the actual kernel APIs. Also,
    musl is missing wrappers for things like statx(2) which we need to use.
    
    We still need syscall wrappers to provide nice error information, but we
    can remove most of the internal-only bitflags and unsafe blocks. The
    only syscall wrapper we don't switch to rustix is openat2 because
    rustix's API is not designed to be extensible and so we can stick with
    libc for now.
    
    In the future we might want to consider migrating away from libc
    entirely (to linux_raw_sys) to reduce the code bloat of having two
    different syscall wrappers.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 17, 2024
    Copy the full SHA
    7c055d0 View commit details
  2. merge #92 into openSUSE/libpathrs:main

    Aleksa Sarai (1):
      syscalls: switch to rustix for most of our syscalls
    
    LGTMs: cyphar
    cyphar committed Oct 17, 2024
    Copy the full SHA
    55226a9 View commit details
  3. multiarch: fix build failures on 32-bit word arches

    The move to rustix fixed most of these issues, but the translations to
    MetadataExt still needed to be adjusted.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 17, 2024
    Copy the full SHA
    37fea42 View commit details
  4. *: fix musl builds

    Almost everything works, thanks to the rustix migration. The only
    outstanding problem is that O_FSYNC is not provided by musl. We don't
    really care about these flags (they're only used for debug output in
    practice) so just skip defining it on musl.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 17, 2024
    Copy the full SHA
    487c093 View commit details
  5. makefile: move CARGO_FLAGS placement

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 17, 2024
    Copy the full SHA
    eb2fbcd View commit details
  6. gha: test cross-compilation to other arches

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 17, 2024
    Copy the full SHA
    8421d66 View commit details
  7. merge #91 into openSUSE/libpathrs:main

    Aleksa Sarai (4):
      gha: test cross-compilation to other arches
      makefile: move CARGO_FLAGS placement
      *: fix musl builds
      multiarch: fix build failures on 32-bit word arches
    
    LGTMs: cyphar
    cyphar committed Oct 17, 2024
    Copy the full SHA
    8a655c8 View commit details

Commits on Oct 22, 2024

  1. cargo: commit lockfile

    Rust has changed their recommendation on whether libraries should commit
    lockfiles. It seems the answer is now that we should err on the side of
    committing it unless there is a strong reason not to[1]. Given that we
    also package libpathrs for distros, I suspect most would prefer a
    lockfile to improve reproducibility a bit (even if they can track
    dependencies themselves).
    
    CI will no longer test the latest version of every dependency, but we
    have dependabot so that just means we'll see test results in the
    (slightly spammy) PRs provided by dependabot.
    
    [1]: https://blog.rust-lang.org/2023/08/29/committing-lockfiles.html
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Oct 22, 2024
    Copy the full SHA
    04a4209 View commit details

Commits on Oct 23, 2024

  1. build(deps): bump thiserror from 1.0.64 to 1.0.65

    Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.64 to 1.0.65.
    - [Release notes](https://github.com/dtolnay/thiserror/releases)
    - [Commits](dtolnay/thiserror@1.0.64...1.0.65)
    
    ---
    updated-dependencies:
    - dependency-name: thiserror
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 23, 2024
    Copy the full SHA
    0086c9f View commit details

Commits on Oct 24, 2024

  1. Copy the full SHA
    c08f8f8 View commit details
  2. build(deps): bump anyhow from 1.0.90 to 1.0.91

    Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.90 to 1.0.91.
    - [Release notes](https://github.com/dtolnay/anyhow/releases)
    - [Commits](dtolnay/anyhow@1.0.90...1.0.91)
    
    ---
    updated-dependencies:
    - dependency-name: anyhow
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 24, 2024
    Copy the full SHA
    7c57c43 View commit details
  3. Copy the full SHA
    dfc5525 View commit details

Commits on Oct 28, 2024

  1. build(deps): bump rustix from 0.38.37 to 0.38.38

    Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.37 to 0.38.38.
    - [Release notes](https://github.com/bytecodealliance/rustix/releases)
    - [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
    - [Commits](bytecodealliance/rustix@v0.38.37...v0.38.38)
    
    ---
    updated-dependencies:
    - dependency-name: rustix
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 28, 2024
    Copy the full SHA
    ecb41b4 View commit details

Commits on Oct 29, 2024

  1. Copy the full SHA
    d6801de View commit details

Commits on Nov 1, 2024

  1. build(deps): bump thiserror from 1.0.65 to 1.0.66

    Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.65 to 1.0.66.
    - [Release notes](https://github.com/dtolnay/thiserror/releases)
    - [Commits](dtolnay/thiserror@1.0.65...1.0.66)
    
    ---
    updated-dependencies:
    - dependency-name: thiserror
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 1, 2024
    Copy the full SHA
    5c4f1a5 View commit details
  2. Copy the full SHA
    94ca24d View commit details
  3. build(deps): bump anyhow from 1.0.91 to 1.0.92

    Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.91 to 1.0.92.
    - [Release notes](https://github.com/dtolnay/anyhow/releases)
    - [Commits](dtolnay/anyhow@1.0.91...1.0.92)
    
    ---
    updated-dependencies:
    - dependency-name: anyhow
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 1, 2024
    Copy the full SHA
    ac71bd7 View commit details
  4. Copy the full SHA
    95f5f2f View commit details

Commits on Nov 2, 2024

  1. makefile: build on cargo file changes

    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    cyphar committed Nov 2, 2024
    Copy the full SHA
    e735d84 View commit details

Commits on Nov 5, 2024

  1. build(deps): bump rustix from 0.38.38 to 0.38.39

    Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.38 to 0.38.39.
    - [Release notes](https://github.com/bytecodealliance/rustix/releases)
    - [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
    - [Commits](bytecodealliance/rustix@v0.38.38...v0.38.39)
    
    ---
    updated-dependencies:
    - dependency-name: rustix
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 5, 2024
    Copy the full SHA
    4bded03 View commit details
  2. Copy the full SHA
    c62c31d View commit details
  3. build(deps): bump thiserror from 1.0.66 to 1.0.68

    Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.66 to 1.0.68.
    - [Release notes](https://github.com/dtolnay/thiserror/releases)
    - [Commits](dtolnay/thiserror@1.0.66...1.0.68)
    
    ---
    updated-dependencies:
    - dependency-name: thiserror
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 5, 2024
    Copy the full SHA
    683aa7f View commit details
  4. Copy the full SHA
    a08866c View commit details

Commits on Nov 6, 2024

  1. build(deps): bump anyhow from 1.0.92 to 1.0.93

    Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.92 to 1.0.93.
    - [Release notes](https://github.com/dtolnay/anyhow/releases)
    - [Commits](dtolnay/anyhow@1.0.92...1.0.93)
    
    ---
    updated-dependencies:
    - dependency-name: anyhow
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 6, 2024
    Copy the full SHA
    f836596 View commit details

Commits on Nov 7, 2024

  1. Copy the full SHA
    479c916 View commit details
  2. build(deps): bump thiserror from 1.0.68 to 2.0.0

    Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.68 to 2.0.0.
    - [Release notes](https://github.com/dtolnay/thiserror/releases)
    - [Commits](dtolnay/thiserror@1.0.68...2.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: thiserror
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 7, 2024
    Copy the full SHA
    33d7fd2 View commit details
  3. Copy the full SHA
    eff5091 View commit details

Commits on Nov 8, 2024

  1. build(deps): bump libc from 0.2.161 to 0.2.162

    Bumps [libc](https://github.com/rust-lang/libc) from 0.2.161 to 0.2.162.
    - [Release notes](https://github.com/rust-lang/libc/releases)
    - [Changelog](https://github.com/rust-lang/libc/blob/0.2.162/CHANGELOG.md)
    - [Commits](rust-lang/libc@0.2.161...0.2.162)
    
    ---
    updated-dependencies:
    - dependency-name: libc
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 8, 2024
    Copy the full SHA
    d0301ee View commit details
  2. Copy the full SHA
    acf1dc1 View commit details
  3. build(deps): bump tempfile from 3.13.0 to 3.14.0

    Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.13.0 to 3.14.0.
    - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
    - [Commits](Stebalien/tempfile@v3.13.0...v3.14.0)
    
    ---
    updated-dependencies:
    - dependency-name: tempfile
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 8, 2024
    Copy the full SHA
    a9fdb9b View commit details
  4. Copy the full SHA
    619b468 View commit details

Commits on Nov 11, 2024

  1. build(deps): bump thiserror from 2.0.0 to 2.0.3

    Bumps [thiserror](https://github.com/dtolnay/thiserror) from 2.0.0 to 2.0.3.
    - [Release notes](https://github.com/dtolnay/thiserror/releases)
    - [Commits](dtolnay/thiserror@2.0.0...2.0.3)
    
    ---
    updated-dependencies:
    - dependency-name: thiserror
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 11, 2024
    Copy the full SHA
    cb90ff5 View commit details

Commits on Nov 13, 2024

  1. Copy the full SHA
    a5d3a66 View commit details
  2. build(deps): bump rustix from 0.38.39 to 0.38.40

    Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.39 to 0.38.40.
    - [Release notes](https://github.com/bytecodealliance/rustix/releases)
    - [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
    - [Commits](bytecodealliance/rustix@v0.38.39...v0.38.40)
    
    ---
    updated-dependencies:
    - dependency-name: rustix
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 13, 2024
    Copy the full SHA
    9d21996 View commit details
  3. Copy the full SHA
    a0c398e View commit details

Commits on Nov 18, 2024

  1. build(deps): bump libc from 0.2.162 to 0.2.164

    Bumps [libc](https://github.com/rust-lang/libc) from 0.2.162 to 0.2.164.
    - [Release notes](https://github.com/rust-lang/libc/releases)
    - [Changelog](https://github.com/rust-lang/libc/blob/main/CHANGELOG.md)
    - [Commits](rust-lang/libc@0.2.162...0.2.164)
    
    ---
    updated-dependencies:
    - dependency-name: libc
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 18, 2024
    Copy the full SHA
    b344ef5 View commit details
Showing with 4,568 additions and 1,834 deletions.
  1. +40 −2 .github/workflows/rust.yml
  2. +0 −1 .gitignore
  3. +85 −0 CHANGELOG.md
  4. +562 −0 Cargo.lock
  5. +8 −10 Cargo.toml
  6. +8 −14 Makefile
  7. +3 −3 README.md
  8. 0 contrib/bindings/python/{COPYING.APACHE-2.0 → COPYING}
  9. +21 −14 contrib/bindings/python/pathrs/_libpathrs_cffi/lib.pyi
  10. +92 −21 contrib/bindings/python/pathrs/_pathrs.py
  11. +2 −2 contrib/bindings/python/pyproject.toml
  12. +4 −12 examples/c/cat.c
  13. +3 −3 examples/c/cat_multithread.c
  14. +2 −8 examples/go/cat.go
  15. +4 −5 examples/python/cat.py
  16. +3 −7 examples/rust-cat/main.rs
  17. +2 −1 go-pathrs/.golangci.yml
  18. 0 go-pathrs/{COPYING.APACHE-2.0 → COPYING}
  19. +17 −15 go-pathrs/doc.go
  20. +17 −15 go-pathrs/error_linux.go
  21. +52 −42 go-pathrs/handle_linux.go
  22. +61 −48 go-pathrs/libpathrs_linux.go
  23. +31 −21 go-pathrs/procfs_linux.go
  24. +145 −70 go-pathrs/root_linux.go
  25. +17 −15 go-pathrs/utils_linux.go
  26. +85 −0 hack/rust-tests.sh
  27. +85 −47 include/pathrs.h
  28. 0 src/{capi/mod.rs → capi.rs}
  29. +107 −59 src/capi/core.rs
  30. +121 −16 src/capi/error.rs
  31. +4 −6 src/capi/procfs.rs
  32. +5 −31 src/capi/utils.rs
  33. +87 −7 src/error.rs
  34. +15 −0 src/flags.rs
  35. +24 −38 src/handle.rs
  36. +2 −8 src/lib.rs
  37. +27 −26 src/procfs.rs
  38. +92 −23 src/{resolvers/mod.rs → resolvers.rs}
  39. +35 −20 src/resolvers/opath/{impl.rs → imp.rs}
  40. +0 −24 src/resolvers/opath/mod.rs
  41. +49 −23 src/resolvers/openat2.rs
  42. +17 −13 src/resolvers/procfs.rs
  43. +178 −94 src/root.rs
  44. +300 −513 src/syscalls.rs
  45. +45 −3 src/{tests/mod.rs → tests.rs}
  46. +6 −12 src/tests/capi/handle.rs
  47. +0 −31 src/tests/capi/mod.rs
  48. +71 −27 src/tests/capi/root.rs
  49. +4 −3 src/tests/capi/utils.rs
  50. +53 −0 src/tests/common/error.rs
  51. +100 −49 src/tests/common/handle.rs
  52. +54 −84 src/tests/common/mntns.rs
  53. +0 −27 src/tests/common/mod.rs
  54. +130 −28 src/tests/common/root.rs
  55. +162 −51 src/tests/test_procfs.rs
  56. +935 −0 src/tests/test_race_resolve_partial.rs
  57. +62 −18 src/tests/test_resolve.rs
  58. +45 −62 src/tests/test_resolve_partial.rs
  59. +258 −43 src/tests/test_root_ops.rs
  60. +9 −25 src/tests/traits/handle.rs
  61. +0 −33 src/tests/traits/mod.rs
  62. +47 −9 src/tests/traits/root.rs
  63. 0 src/{utils/mod.rs → utils.rs}
  64. +120 −22 src/utils/dir.rs
  65. +52 −27 src/utils/fd.rs
  66. +1 −1 src/utils/path.rs
  67. +2 −2 src/utils/sysctl.rs
42 changes: 40 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,40 @@ jobs:
toolchain: ${{ env.RUST_MSRV }}
- run: cargo check --workspace --all-features --all-targets

check-cross:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- arm-unknown-linux-gnueabi
- arm-unknown-linux-gnueabihf
- armv7-unknown-linux-gnueabihf
- i686-unknown-linux-gnu
- loongarch64-unknown-linux-gnu
- loongarch64-unknown-linux-musl
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- sparc64-unknown-linux-gnu
- s390x-unknown-linux-gnu
name: cargo check (${{ matrix.target }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
# TODO: Should we use MSRV for this?
targets: ${{ matrix.target }}
- name: cargo check --target=${{ matrix.target }}
run: >-
cargo check --target=${{ matrix.target }} --workspace --all-features --all-targets
- name: cargo build --target=${{ matrix.target }}
run: >-
cargo build --target=${{ matrix.target }} --release --all-features
rustdoc:
name: cargo doc
runs-on: ubuntu-latest
@@ -112,7 +146,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# We need to use nightly Rust to check the formatting.
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
@@ -122,7 +157,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# Pin the Rust version to avoid Rust updates breaking our clippy lints.
- uses: dtolnay/rust-toolchain@1.83
with:
components: clippy
- run: cargo clippy --all-features --all-targets
@@ -132,6 +168,7 @@ jobs:
needs:
- check
- check-msrv
- check-cross
- rustdoc
- test
- examples
@@ -155,6 +192,7 @@ jobs:
needs:
- check
- check-msrv
- check-cross
- rustdoc
- test
- examples
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Rust.
/target
**/*.rs.bk
Cargo.lock

# pkg-config generated by install.sh.
/pathrs.pc
85 changes: 85 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,91 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] ##

### Breaking ###
- python bindings: `Root.creat` has had its `filemode` and `flags` arguments
swapped to match the argument order of `openat2` (and `Root.creat_raw`). This
also now makes `filemode` have a default value of `0o644` if unspecified.
- Most of the C FFI functions have been renamed:
- Operations on a `Root` have been renamed to have a `pathrs_inroot_` prefix.
- `pathrs_open_root` has been renamed to `pathrs_open_root`, to avoid
confusion with `pathrs_inroot_*` functions and clarify what it is opening.
- python bindings: `Root.open` has been changed to be a wrapper of
`pathrs_inroot_open` instead of being a wrapper around the `Root`
constructor.
- All C FFI functions that return a file descriptor now set `O_CLOEXEC` by
default. Previously some functions that took `O_*` flags would only set
`O_CLOEXEC` if the user explicitly requested it, but `O_CLOEXEC` is easy to
unset on file descriptors and having it enabled is a more sane default.

### Added ###
- python bindings: add `Root.creat_raw` to create a new file and wrap it in a
raw `WrappedFd` (os opposed to `Root.creat` which returns an `os.fdopen`).
- Root: it is now possible to open a file in one shot without having to do an
intermediate `resolve` step with `Root::open_subpath`. This can be more
efficient in some scenarios (especially with the openat2-based resolver or
for C FFI users where function calls are expensive) as it saves one file
descriptor allocation and extra function calls.
- Error: `ErrorKind` is now exported, allowing you to programmatically handle
errors returned by libpathrs. This interface may change in the future (in
particular, `ErrorKind::OsError` might change its representation of `errno`
values).
- capi: errors that are returned by libpathrs itself (such as invalid arguments
being passed by users) will now contain a `saved_errno` value that makes
sense for the error type (so `ErrorKind::InvalidArgument` will result in an
`EINVAL` value for `saved_errno`). This will allow C users to have a nicer
time handling errors programmatically.
- tests: we now have a large array of tests for verifying that the core lookup
logic of libpathrs is race-safe against various attacks. This is no big
surprise, given libpathrs's design, but we now have more extensive tests than
`github.com/cyphar/filepath-securejoin`.

### Fixes ###
- multiarch: we now build correctly on 32-bit architectures as well as
architectures that have unsigned char. We also have CI jobs that verify that
builds work on a fairly large number of architectures (all relevant tier-1
and tier-2-with-host-tools architectures). If there is an architecture you
would like us to add to the build matrix and it is well-supported by `rustc`,
feel free to open an issue or PR!
- `Handle::reopen` will now return an error if you attempt to reopen a handle
to a symlink (such as one created with `Root::resolve_nofollow`). Previously,
you would get various errors and unexpected behaviour. If you wish to make an
`O_PATH|O_NOFOLLOW` copy of a symlink handle, you can simply use `try_clone`
(i.e. `dup(2)` the file descriptor).
- `Handle::reopen(O_NOFOLLOW)` will now return reasonable results. Previously,
it would return `-ELOOP` in most cases and in other cases it would return
unexpected results because the `O_NOFOLLOW` would have an effect on the
magic-link used internally by `Handle::reopen`.
- `Root::mkdir_all` will no longer return `-EEXIST` if another process tried to
do `Root::mkdir_all` at the same time, instead the race winner's directory
will be used by both processes. See [opencontainers/runc#4543][] for more
details.
- `Root::remove_all` will now handle missing paths that disappear from
underneath it more gracefully, ensuring that multiple `Root::remove_all`
operations run on the same directory tree will all succeed without errors.
The need for this is similar to the need for `Root::mkdir_all` to handle such
cases.
- opath resolver: in some cases with trailing symlinks in the symlink stack
(i.e. for partial lookups caused by `Root::mkdir_all`) we would not correctly
handle leading `..` components, leading to safety errors when libpathrs
thought that the symlink stack had been corrupted.
- openat2 resolver: always return a hard `SafetyViolation` if we encounter one
during partial lookups to match the opath resolver behaviour and to avoid
confusion by users (it is theoretically safe to fall back from a
`SafetyViolation` during a partial lookup, but it's better to be safe here).

### Changed ###
- syscalls: switch to rustix for most of our syscall wrappers to simplify how
much code we have for wrapper raw syscalls. This also lets us build on
musl-based targets because musl doesn't support some of the syscalls we need.

There are some outstanding issues with rustix that make this switch a little
uglier than necessary ([rustix#1186][], [rustix#1187][]), but this is a net
improvement overall.

[rustix#1186]: https://github.com/bytecodealliance/rustix/issues/1186
[rustix#1187]: https://github.com/bytecodealliance/rustix/issues/1187
[opencontainers/runc#4543]: https://github.com/opencontainers/runc/issues/4543

## [0.1.3] - 2024-10-10 ##

> 自動化って物は試しとすればいい物だ
Loading