Revert "builtins/path: Use fancy bitflags feature"

This builds on my machine, but doesn't on CI.

Rust 1.67 possibly needs to derive Eq as well as PartialEq?

This reverts commit 2fa0f13db2.
This commit is contained in:
Fabian Boehm 2024-06-08 09:12:04 +02:00
parent 2fa0f13db2
commit 251ddd1bcc

View file

@ -86,7 +86,7 @@ impl TryFrom<&wstr> for TypeFlags {
}
bitflags! {
#[derive(Copy, Clone, Default, PartialEq)]
#[derive(Copy, Clone, Default)]
pub struct PermFlags: u32 {
const READ = 1 << 0;
const WRITE = 1 << 1;
@ -405,6 +405,7 @@ fn path_transform(
if transformed != arg {
n_transformed += 1;
// Return okay if path wasn't already in this form
// TODO: Is that correct?
if opts.quiet {
return STATUS_CMD_OK;
};
@ -797,15 +798,26 @@ fn filter_path(opts: &Options, path: &wstr, uid: Option<u32>, gid: Option<u32>)
if let Some(perm) = opts.perms {
let mut amode = 0;
// TODO: Update bitflags so this works
/*
for f in perm {
amode |= match f {
PermFlags::READ => R_OK,
PermFlags::WRITE => W_OK,
PermFlags::EXEC => X_OK,
_ => 0,
_ => PermFlags::empty(),
}
}
*/
if perm.contains(PermFlags::READ) {
amode |= R_OK;
}
if perm.contains(PermFlags::WRITE) {
amode |= W_OK;
}
if perm.contains(PermFlags::EXEC) {
amode |= X_OK;
}
// access returns 0 on success,
// -1 on failure. Yes, C can't even keep its bools straight.
// Skip this if we don't have a mode to check - the stat can do existence too.