Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notify_pipe option in squashfuse not sending failure #112

Closed
DrDaveD opened this issue Sep 8, 2023 · 1 comment · Fixed by #113
Closed

notify_pipe option in squashfuse not sending failure #112

DrDaveD opened this issue Sep 8, 2023 · 1 comment · Fixed by #113

Comments

@DrDaveD
Copy link
Collaborator

DrDaveD commented Sep 8, 2023

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
Copy link
Contributor

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

ariel-miculas added a commit to ariel-miculas/squashfuse that referenced this issue Sep 8, 2023
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Fixes vasi#112
ariel-miculas added a commit to ariel-miculas/squashfuse that referenced this issue Sep 11, 2023
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Fixes vasi#112
ariel-miculas added a commit to ariel-miculas/squashfuse that referenced this issue Sep 11, 2023
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Fixes vasi#112
ariel-miculas added a commit to ariel-miculas/squashfuse that referenced this issue Sep 11, 2023
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Fixes vasi#112
ariel-miculas added a commit to ariel-miculas/squashfuse that referenced this issue Sep 12, 2023
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Add tests/notify_test.sh which checks that a notification is sent in
both the successful and unsuccessful cases.

Fixes vasi#112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants