vasi / squashfuse

FUSE filesystem to mount squashfs archives
Other
286 stars 66 forks source link

notify_pipe option in squashfuse not sending failure #112

Closed DrDaveD closed 10 months ago

DrDaveD commented 10 months ago

I should have tested -o notify_pipe before merging #110 into the master branch, but I did it afterward. I tried both success and failures of mounts for both squashfuse_ll and squashfuse, and 3 of the combinations worked but squashfuse failures did not; there was no notification. It would be good if the automated tests tried all four combinations.

Reproduce with

 $ mknod /tmp/notifypipe p
 $ cat </tmp/notifypipe

and in another window do

$ ./squashfuse -o notify_pipe=/tmp/notifypipe /dev/null /mnt

An f is only sent to the pipe if squashfuse_ll is used, but not if squashfuse is used.

@ariel-miculas

ariel-miculas commented 10 months ago

yeah, it seems I didn't cover all the test cases in the following script (which I probably should add to the automated tests, but I'm not sure how to add a new shell script to the test cases) :

#!/bin/bash
set -x
FIFO=$(mktemp -u)
mkfifo "$FIFO"

./squashfuse_ll -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/nonexistent-squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mountpoint should have failed"
    exit 1
else
    echo "Mounting squashfuse on /tmp/squash failed as expected"
fi

mkdir -p /tmp/squash
./squashfuse_ll -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mounted successfully as expected"
else
    echo "Mounting squashfuse on /tmp/squash failed"
    exit 1
fi

# Second time should fail with permission denied
./squashfuse_ll -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mounted successfully when it should have failed"
    exit 1
else
    echo "Mounting squashfuse on /tmp/squash failed as expected"
fi

fusermount -u /tmp/squash

./squashfuse -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/nonexistent-squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mountpoint should have failed"
    exit 1
else
    echo "Mounting squashfuse on /tmp/squash failed as expected"
fi

mkdir /tmp/squash
./squashfuse -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mounted successfully as expected"
else
    echo "Mounting squashfuse on /tmp/squash failed"
    exit 1
fi

# Second time should fail with permission denied
./squashfuse -o notify_pipe="$FIFO" -f ~/work/cisco/test-puzzlefs/barehost.sqhs /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
    echo "Mounted successfully when it should have failed"
    exit 1
else
    echo "Mounting squashfuse on /tmp/squash failed as expected"
fi

fusermount -u /tmp/squash