diff -Nru rust-caps-0.3.2/Cargo.toml rust-caps-0.3.3/Cargo.toml --- rust-caps-0.3.2/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-caps-0.3.3/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "caps" -version = "0.3.2" +version = "0.3.3" authors = ["Luca Bruno "] exclude = [".gitignore", ".travis.yml"] description = "A pure-Rust library to work with Linux capabilities" diff -Nru rust-caps-0.3.2/Cargo.toml.orig rust-caps-0.3.3/Cargo.toml.orig --- rust-caps-0.3.2/Cargo.toml.orig 2019-06-21 21:09:24.000000000 +0000 +++ rust-caps-0.3.3/Cargo.toml.orig 2019-08-07 19:38:52.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "caps" -version = "0.3.2" +version = "0.3.3" authors = ["Luca Bruno "] license = "MIT/Apache-2.0" repository = "https://github.com/lucab/caps-rs" diff -Nru rust-caps-0.3.2/.cargo_vcs_info.json rust-caps-0.3.3/.cargo_vcs_info.json --- rust-caps-0.3.2/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 +++ rust-caps-0.3.3/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +1,5 @@ { "git": { - "sha1": "2d630d8f0da345f571b11a841ab9493951e7a736" + "sha1": "eabca98b3eef61c4d27c369684200fdd937c55af" } } diff -Nru rust-caps-0.3.2/debian/cargo-checksum.json rust-caps-0.3.3/debian/cargo-checksum.json --- rust-caps-0.3.2/debian/cargo-checksum.json 2019-08-06 16:09:53.000000000 +0000 +++ rust-caps-0.3.3/debian/cargo-checksum.json 2019-10-04 12:58:56.000000000 +0000 @@ -1 +1 @@ -{"package":"db0daf83be1c75833102028411aa9c5a5847bc3212f8e2656fd41ab9e514c99f","files":{}} +{"package":"20d9a108615cedf6989a2c82d7aa6f6e7c8be5398a210adcc8df458bfa7ff4ee","files":{}} diff -Nru rust-caps-0.3.2/debian/changelog rust-caps-0.3.3/debian/changelog --- rust-caps-0.3.2/debian/changelog 2019-10-04 15:10:26.000000000 +0000 +++ rust-caps-0.3.3/debian/changelog 2019-10-04 12:58:56.000000000 +0000 @@ -1,8 +1,8 @@ -rust-caps (0.3.2-2build1) eoan; urgency=medium +rust-caps (0.3.3-1) unstable; urgency=medium - * No-change rebuild to drop i386 + * Package caps 0.3.3 from crates.io using debcargo 2.4.0 (Closes: #941723) - -- Steve Langasek Fri, 04 Oct 2019 15:10:26 +0000 + -- kpcyrd Fri, 04 Oct 2019 14:58:56 +0200 rust-caps (0.3.2-2) unstable; urgency=medium diff -Nru rust-caps-0.3.2/debian/control rust-caps-0.3.3/debian/control --- rust-caps-0.3.2/debian/control 2019-08-06 16:09:53.000000000 +0000 +++ rust-caps-0.3.3/debian/control 2019-10-04 12:58:56.000000000 +0000 @@ -2,7 +2,7 @@ Section: rust Priority: optional Build-Depends: debhelper (>= 11), - dh-cargo (>= 15), + dh-cargo (>= 18), cargo:native , rustc:native , libstd-rust-dev , @@ -30,8 +30,8 @@ librust-caps-0+default-dev (= ${binary:Version}), librust-caps-0.3-dev (= ${binary:Version}), librust-caps-0.3+default-dev (= ${binary:Version}), - librust-caps-0.3.2-dev (= ${binary:Version}), - librust-caps-0.3.2+default-dev (= ${binary:Version}) + librust-caps-0.3.3-dev (= ${binary:Version}), + librust-caps-0.3.3+default-dev (= ${binary:Version}) Description: Pure-Rust library to work with Linux capabilities - Rust source code This package contains the source for the Rust caps crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-caps-0.3.2/debian/rules rust-caps-0.3.3/debian/rules --- rust-caps-0.3.2/debian/rules 2019-08-06 16:09:53.000000000 +0000 +++ rust-caps-0.3.3/debian/rules 2019-10-04 12:58:56.000000000 +0000 @@ -1,3 +1,6 @@ #!/usr/bin/make -f %: dh $@ --buildsystem cargo + +override_dh_auto_test: + dh_auto_test -- test --all diff -Nru rust-caps-0.3.2/debian/tests/control rust-caps-0.3.3/debian/tests/control --- rust-caps-0.3.2/debian/tests/control 2019-07-13 20:11:12.000000000 +0000 +++ rust-caps-0.3.3/debian/tests/control 2019-10-04 12:58:56.000000000 +0000 @@ -1,7 +1,7 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test caps 0.3.2 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test caps 0.3.3 --all-targets --all-features Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test caps 0.3.2 --all-targets --no-default-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test caps 0.3.3 --all-targets --no-default-features Depends: dh-cargo (>= 18), librust-caps-dev Restrictions: allow-stderr, skip-not-installable diff -Nru rust-caps-0.3.2/src/bounding.rs rust-caps-0.3.3/src/bounding.rs --- rust-caps-0.3.2/src/bounding.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/src/bounding.rs 2019-07-05 09:19:52.000000000 +0000 @@ -18,9 +18,10 @@ let ret = unsafe { libc::prctl(nr::PR_CAPBSET_DROP, libc::c_uint::from(cap.index()), 0, 0) }; match ret { 0 => Ok(()), - _ => Err( - Error::from_kind(ErrorKind::Sys(errno::errno())).chain_err(|| "PR_CAPBSET_DROP error") - ), + _ => { + Err(Error::from_kind(ErrorKind::Sys(errno::errno())) + .chain_err(|| "PR_CAPBSET_DROP error")) + } } } @@ -29,9 +30,10 @@ match ret { 0 => Ok(false), 1 => Ok(true), - _ => Err( - Error::from_kind(ErrorKind::Sys(errno::errno())).chain_err(|| "PR_CAPBSET_READ error") - ), + _ => { + Err(Error::from_kind(ErrorKind::Sys(errno::errno())) + .chain_err(|| "PR_CAPBSET_READ error")) + } } } diff -Nru rust-caps-0.3.2/src/errors.rs rust-caps-0.3.3/src/errors.rs --- rust-caps-0.3.2/src/errors.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/src/errors.rs 2019-07-05 09:19:52.000000000 +0000 @@ -2,7 +2,7 @@ use errno; -error_chain!{ +error_chain! { errors { /// Parsing error due to invalid capability name. InvalidCapName(name: String) { @@ -16,3 +16,11 @@ } } } + +#[test] +fn test_sys_errno() { + let eperm = errno::Errno(1); + let err = ErrorKind::Sys(eperm); + assert!(err.description().contains("syscall failed")); + assert!(format!("{}", err).contains("Operation not permitted")); +} diff -Nru rust-caps-0.3.2/src/lib.rs rust-caps-0.3.3/src/lib.rs --- rust-caps-0.3.2/src/lib.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/src/lib.rs 2019-07-05 09:19:52.000000000 +0000 @@ -23,11 +23,11 @@ extern crate errno; extern crate libc; -mod ambient; // Implementation of Ambient set -mod base; // Implementation of POSIX sets -mod bounding; // Implementation of Bounding set -pub mod errors; // Error wrapping -mod nr; // All kernel-related constants +mod ambient; // Implementation of Ambient set +mod base; // Implementation of POSIX sets +mod bounding; // Implementation of Bounding set +pub mod errors; // Error wrapping +mod nr; // All kernel-related constants pub mod runtime; // Features/legacy detection at runtime pub mod securebits; // Thread security bits @@ -380,12 +380,12 @@ /// to [`from_str`]. /// /// [`from_str`]: enum.Capability.html#method.from_str -pub fn to_canonical(s: &str) -> String { - let su = s.to_uppercase(); - if su.starts_with("CAP_") { - su +pub fn to_canonical(name: &str) -> String { + let uppername = name.to_uppercase(); + if uppername.starts_with("CAP_") { + uppername } else { - ["CAP_", &su].concat() + ["CAP_", &uppername].concat() } } @@ -404,7 +404,9 @@ fn test_parse_invalid() { use std::str::FromStr; let p1 = Capability::from_str("CAP_FOO"); - assert!(p1.is_err()); + let p1_err = p1.unwrap_err(); + assert!(p1_err.description().contains("invalid")); + assert!(format!("{}", p1_err).contains("CAP_FOO")); let p2: Result = "CAP_BAR".parse(); assert!(p2.is_err()); } @@ -416,4 +418,6 @@ assert!(Capability::from_str(&to_canonical(p1)).is_err()); let p2 = "sys_admin"; assert!(Capability::from_str(&to_canonical(p2)).is_ok()); + let p3 = "CAP_SYS_CHROOT"; + assert!(Capability::from_str(&to_canonical(p3)).is_ok()); } diff -Nru rust-caps-0.3.2/src/nr.rs rust-caps-0.3.3/src/nr.rs --- rust-caps-0.3.2/src/nr.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/src/nr.rs 2019-08-07 19:32:12.000000000 +0000 @@ -97,3 +97,13 @@ pub const CAPGET: i64 = 184; #[cfg(target_arch = "s390x")] pub const CAPSET: i64 = 185; + +#[cfg(target_arch = "sparc")] +pub const CAPGET: i64 = 21; +#[cfg(target_arch = "sparc")] +pub const CAPSET: i64 = 22; + +#[cfg(target_arch = "sparc64")] +pub const CAPGET: i64 = 21; +#[cfg(target_arch = "sparc64")] +pub const CAPSET: i64 = 22; diff -Nru rust-caps-0.3.2/src/securebits.rs rust-caps-0.3.3/src/securebits.rs --- rust-caps-0.3.2/src/securebits.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/src/securebits.rs 2019-07-05 09:19:52.000000000 +0000 @@ -16,9 +16,10 @@ match ret { 0 => Ok(false), 1 => Ok(true), - _ => Err( - Error::from_kind(ErrorKind::Sys(errno::errno())).chain_err(|| "PR_GET_KEEPCAPS error") - ), + _ => { + Err(Error::from_kind(ErrorKind::Sys(errno::errno())) + .chain_err(|| "PR_GET_KEEPCAPS error")) + } } } @@ -28,8 +29,9 @@ let ret = unsafe { libc::prctl(nr::PR_SET_KEEPCAPS, flag, 0, 0) }; match ret { 0 => Ok(()), - _ => Err( - Error::from_kind(ErrorKind::Sys(errno::errno())).chain_err(|| "PR_SET_KEEPCAPS error") - ), + _ => { + Err(Error::from_kind(ErrorKind::Sys(errno::errno())) + .chain_err(|| "PR_SET_KEEPCAPS error")) + } } } diff -Nru rust-caps-0.3.2/tests/bounding.rs rust-caps-0.3.3/tests/bounding.rs --- rust-caps-0.3.2/tests/bounding.rs 2019-06-04 09:59:41.000000000 +0000 +++ rust-caps-0.3.3/tests/bounding.rs 2019-07-05 09:19:52.000000000 +0000 @@ -6,7 +6,8 @@ None, caps::CapSet::Bounding, caps::Capability::CAP_SYS_CHROOT, - ).unwrap(); + ) + .unwrap(); } #[test]