pathrs 0.2.3

C-friendly API to make path resolution safer on Linux.
Documentation
# SPDX-License-Identifier: MPL-2.0 OR LGPL-3.0-or-later
#
# libpathrs: safe path resolution on Linux
# Copyright (C) 2019-2025 SUSE LLC
# Copyright (C) 2026 Aleksa Sarai <cyphar@cyphar.com>
#
# == MPL-2.0 ==
#
#  This Source Code Form is subject to the terms of the Mozilla Public
#  License, v. 2.0. If a copy of the MPL was not distributed with this
#  file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# Alternatively, this Source Code Form may also (at your option) be used
# under the terms of the GNU Lesser General Public License Version 3, as
# described below:
#
# == LGPL-3.0-or-later ==
#
#  This program is free software: you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or (at
#  your option) any later version.
#
#  This program is distributed in the hope that it will be useful, but
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
#  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
#  for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with this program. If not, see <https://www.gnu.org/licenses/>.

[package]
name = "pathrs"
version = "0.2.3"
license = "MPL-2.0 OR LGPL-3.0-or-later"
authors = ["Aleksa Sarai <cyphar@cyphar.com>"]

description = "C-friendly API to make path resolution safer on Linux."
repository = "https://github.com/cyphar/libpathrs"
readme = "README.md"

keywords = ["file", "fs", "security", "linux"]
categories = ["filesystem"]
edition = "2021"
rust-version = "1.63"

[badges]
maintenance = { status = "experimental" }

[lib]
# MSRV(1.64): Replace with --crate-type={cdy,static}lib in Makefile.
crate-type = ["rlib"]

[features]
default = []
capi = ["dep:bytemuck", "bitflags/bytemuck", "dep:rand", "dep:open-enum"]
# All of these _test_* features are only used for our own tests -- they must
# not be used by actual users of libpathrs! The leading "_" should mean that
# they are hidden from documentation (such as the features list on crates.io).
_test_as_root = []
_test_race = []

[profile.release]
# Enable link-time optimisations.
lto = true

[dependencies]
bitflags = "2.2"
bytemuck = { version = "1", features = ["extern_crate_std", "derive"], optional = true }
itertools = "0.14"
libc = "0.2.178"
memchr = "2"
# MSRV(1.80): Use LazyLock.
# MSRV(1.65): Update to once_cell >= 1.21.
once_cell = "1"
# MSRV(1.65): Update to >=0.4.1 which uses let_else. 0.4.0 was broken.
open-enum = { version = "0.3", optional = true }
rand = { version = "0.9", optional = true }
rustix = { version = "1.1", features = ["fs", "process", "thread", "mount"] }
rustversion = "1"
thiserror = "2"
static_assertions = "1.1"

[dev-dependencies]
anyhow = "1"
clap = { version = "3", features = ["cargo"] }
errno = "0.3"
indoc = "2"
tempfile = "3"
paste = "1"
path-clean = "1"
pretty_assertions = { version = "1.4.1", features = ["unstable"] }

[build-dependencies]
tempfile = "3"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
	# We have special handling for coverage runs (which set cfg(coverage)).
	'cfg(coverage)',
	# We set these cfgs when building with --features=capi.
	'cfg(cdylib)', 'cfg(staticlib)',
	# DIY version of <https://github.com/nextest-rs/nextest/discussions/2789>.
	'cfg(nextest)',
] }

[workspace]
resolver = "2"
members = [
	"contrib/fake-enosys",
	"e2e-tests/cmd/rust",
]