When directories with open handles are removed, the releasedir and
fsyncdir operations might be called with a NULL path. That is because
there is no hiding behavior like for regular files and the nodes get
removed immediately.
As pointed here [1] __has_attribute() is broken for many attributes and
if it doesn't support the specific attribute it returns true, so we
can't really rely on that for this check. This lead to Buildroot
libfuse3 build failure [2] where that shows up with:
```
error: symver is only supported on ELF platforms
```
Indeed Microblaze doesn't support ELF since it doesn't include elfos.h,
but __has_attribute(symver) returns true.
So let's substitute the #ifdef __has_attribute() with a stronger test on
a function foo() with __attribute__((symver ("test@TEST"))).
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766
[2]: http://autobuild.buildroot.net/results/d6c/d6cfaf2aafaeda3c12d127f6a2d2e175b25e654f/build-end.log
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
setlocale() can fail, returning NULL, which will lead
to a crash in iconv_new(). Fix it like in iconv_help().
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
Before last unlink() release the reference on inode.fd to allow reuse
of underlying fs inode number, mark the server inode "deleted" and bump
it's generation counter.
When same inode number is found on lookup(), the server inode object will
be reused as well.
Skip this when inode has an open file and when writeback cache is enabled.
This will be used to verify inode reuse bug fix in the kernel.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
On some tests on regular files, open an O_PATH fd of the testfile and
record it along side the size and mode and inode.
At the end of all tests, use recorded testfiles info to re-check the size
mode and inode of the unlinked testfiles.
With O_PATH fd, the server does not have to keep the inode alive so FUSE
inode may be stale or bad. Therefore, ESTALE and EIO are valid results
for fstat() on the old testfile fd's, but returning the wrong size or
mode is an invalid result.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Generate unique filename per test (only for regular file for now).
Make sure to unlink the unique filename after each test.
realpath variable was renamed to basepath_r to fix build warning
on conflicting symbols with realpath() function.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
rename dir loop test fails when test tmp dir is xfs with an error
test_rename_dir_loop() - rename : File exists
That is because xfs returns EEXIST for the case of renaming over
a non-empty directory.
According to rename(2) man page, EEXIST and ENOTEMPTY are both valid
error code in this case.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
We currently do not pass anything in PREDEFINED and that means
FUSE_USE_VERSION is undefined.
Add that definition so that Doxygen built-in C pre-processor can use
FUSE_USE_VERSION value to find the correct comment to parse.
fuse (4) is an excellent introduction to the FUSE protocol,
and it lists fusermount (1) and mount.fuse (8) in its
SEE ALSO section.
I (the author of gocryptfs) was not aware of this man
page till March 2021, which suggest that it should be
made more discoverable.
So link back to fuse (4) in our SEE ALSO sections.
* Use meson's warning_level instead of passing -Wflags
"-Wall" is included by default and level 2 adds "-Wextra". Avoids a
warning from meson.
Signed-off-by: Heiko Becker <heirecka@exherbo.org>
* Set the C++ language standard through a meson option
Avoids a warning from meson.
Signed-off-by: Heiko Becker <heirecka@exherbo.org>
When not using the readdir_plus mode, the d_type was not returned,
and the use_ino flag was not used for returning d_ino.
This patch fixes the returned values for d_ino and d_type by readdir(3)
The test for the returned value of d_ino has been adjusted to also
take the d_type into consideration and to check the returned values in
both basic readdir and readdir_plus modes. This is done by executing
the passthrough test twice.
Co-authored-by: Jean-Pierre André <jpandre@users.sourceforge.net>
- Test added for all passthrough examples.
- passthrough.c uses offset==0 mode. The others don't.
- passthrough.c changed to set FUSE_FILL_DIR_PLUS to make the test pass.
- This fixes#583.
Commit 0bef21e854 removed "-o nonempty" since mounting over
non-empty directories is always allowed. But this broke tools which
specify "-o nonempty". Since the expected behaviour is the same
anyway, ignoring the "nonempty" option seems safe, and allows programs
specifying "-o nonempty" to continue working with fusermount3.
This would fix https://bugs.debian.org/939767
Signed-off-by: Stephen Kitt <steve@sk2.org>
It is perfectly legal to execute a program with argc == 0 and therefore
no argv.
fusermount needs to check for this case, otherwise it will pass a NULL
poiunter to strdup() and cause undefined behavior.
Especially since fusermount is setuid root, we need to extra be careful.
Signed-off-by: Richard Weinberger <richard@nod.at>
Compiler warning about close(fd), add include file to fix.
Signed-off-by: haoyixing <haoyixing@kuaishou.com>
Co-authored-by: haoyixing <haoyixing@kuaishou.com>
this affected `-o remember` in single-thread mode, it could prematurely
exit if a signal was received
# start an example filesystem from example/
./passthrough -f -s -o remember=5 ./mnt
# make the poll() call return with EINTR
pkill -PIPE passthrough
In commit d614415a ("buffer.c: check whether buf is
NULL in fuse_bufvec_advance func"), if fuse_bufvec_current
func returns NULL, it returns 1 directly. Actually,
we should return 0 when buf is NULL.
Fixes: d614415a ("buffer.c: check whether buf is NULL in fuse_bufvec_advance func")
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Haotian Li <lihaotian9@huawei.com>