Skip to content

Commit 098fe4a

Browse files
committed
Add --auto-unmount flag to simple.rs
1 parent ecc9a85 commit 098fe4a

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

examples/simple.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,12 @@ fn main() {
19971997
.requires("mount-point")
19981998
.help("Mount FUSE with direct IO"),
19991999
)
2000+
.arg(
2001+
Arg::new("auto-unmount")
2002+
.long("auto-unmount")
2003+
.action(ArgAction::SetTrue)
2004+
.help("Automatically unmount FUSE when process exits"),
2005+
)
20002006
.arg(
20012007
Arg::new("fsck")
20022008
.long("fsck")
@@ -2037,12 +2043,9 @@ fn main() {
20372043
if matches.get_flag("suid") {
20382044
info!("setuid bit support enabled");
20392045
options.push(MountOption::Suid);
2040-
} else {
2041-
options.push(MountOption::AutoUnmount);
20422046
}
20432047
}
2044-
#[cfg(not(feature = "abi-7-26"))]
2045-
{
2048+
if matches.get_flag("auto-unmount") {
20462049
options.push(MountOption::AutoUnmount);
20472050
}
20482051
if let Ok(enabled) = fuse_allow_other_enabled() {

mount_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function test_no_user_allow_other {
6262
DIR=$(su fusertestnoallow -c "mktemp --directory")
6363
DATA_DIR=$(su fusertestnoallow -c "mktemp --directory")
6464
cargo build --example simple $1 > /dev/null 2>&1
65-
su fusertestnoallow -c "target/debug/examples/simple -vvv --data-dir $DATA_DIR --mount-point $DIR"
65+
su fusertestnoallow -c "target/debug/examples/simple --auto-unmount -vvv --data-dir $DATA_DIR --mount-point $DIR"
6666
exitCode=$?
6767
if [[ $exitCode -eq 2 ]]; then
6868
echo -e "$GREEN OK Detected lack of user_allow_other: $2 $NC"

pjdfs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export RUST_BACKTRACE=1
1313
DATA_DIR=$(mktemp --directory)
1414
DIR=$(mktemp --directory)
1515

16-
fuser -vvv --suid --data-dir $DATA_DIR --mount-point $DIR > /code/logs/mount.log 2>&1 &
16+
fuser -vvv --auto-unmount --suid --data-dir $DATA_DIR --mount-point $DIR > /code/logs/mount.log 2>&1 &
1717
FUSE_PID=$!
1818
sleep 0.5
1919

xfstests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ echo "generic/531" >> xfs_excludes.txt
124124
echo "generic/564" >> xfs_excludes.txt
125125

126126

127-
FUSER_EXTRA_MOUNT_OPTIONS="" TEST_DEV="$TEST_DATA_DIR" TEST_DIR="$TEST_DIR" SCRATCH_DEV="$SCRATCH_DATA_DIR" SCRATCH_MNT="$SCRATCH_DIR" \
127+
FUSER_EXTRA_MOUNT_OPTIONS="--auto-unmount" TEST_DEV="$TEST_DATA_DIR" TEST_DIR="$TEST_DIR" SCRATCH_DEV="$SCRATCH_DATA_DIR" SCRATCH_MNT="$SCRATCH_DIR" \
128128
./check-fuser -E xfs_excludes.txt "$@" \
129129
| tee /code/logs/xfstests.log
130130

0 commit comments

Comments
 (0)