152 Commits

Author SHA1 Message Date
fangzhiyi18 bd5ee7c317 升级1.17.3
Signed-off-by: fangzhiyi18 <fangzhiyi1@h-partners.com>
2025-11-08 13:04:30 +08:00
psycho c99f6182b4 libfuse升级
Signed-off-by: psycho <wangmingxuan6@h-partners.com>
2024-01-09 09:19:42 +08:00
Nikolaus Rath 022539c8b0 Travis-CI: Make sure lsan supppressions file can be read by root. 2021-06-24 09:11:29 +01:00
Amir Goldstein e4e615af0e Do not run unlinked files test on passthrough_hp with old kernels
test_syscalls unlinked testfiles check fails on passthourhg_hp without
the kernel commit "fuse: fix illegal access to inode with reused nodeid"
queued for kernel 5.14 [1].

Make this check opt-in and do not run it with kernel version before 5.14.

[1] https://lore.kernel.org/linux-fsdevel/CAJfpegtGKjeK8E5QsHKF0=re1J9wVHuGRVgg9NDJ_OOwQdCUNg@mail.gmail.com/

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-23 11:46:19 +01:00
Amir Goldstein 7bd58ebe84 test/test_syscalls.c: check unlinked testfiles at the end of the test
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>
2021-06-14 09:13:12 +01:00
Amir Goldstein 3b44599685 test/test_syscalls.c: refactor fcheck_* helpers
Avoid multiple fstat() calls and consolidate all fcheck_* helpers
into fcheck_stat().

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-14 09:13:12 +01:00
Amir Goldstein e55463e8a5 test/test_syscalls.c: use unique filename per test
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>
2021-06-14 09:13:12 +01:00
Christian Menges 79286adbe5 Cuse example: Fix memory leak (#607)
* cuse example: fix memory leak

* Travis CI: re-enable leak checking
2021-06-09 09:04:41 +01:00
Amir Goldstein dad2789473 test/test_syscalls.c: fix test failure on xfs src dir (#611)
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>
2021-06-02 10:23:06 +01:00
Jean-Pierre André 3dec359766 Fix returning d_ino and d_type by readdir(3) in non-plus mode
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>
2021-03-18 09:52:30 +00:00
Martin Pärtel 884b57886b Fix returning inode numbers from readdir() in offset==0 mode. (#584)
- 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.
2021-02-03 09:53:21 +00:00
Zhiqiang Liu 4dc1267898 test/test_syscalls.c: fix potential fd leakage problems
In test_syscalls.c, several funcs have potential fd leakage
problems. This patch will fix them.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Haotian Li <lihaotian9@huawei.com>
2020-11-06 19:26:03 +00:00
Tom Callaway 6e121408c7 Update Travis to Ubuntu Bionic 2020-09-12 09:28:27 +01:00
Tom Callaway 6fc9630acd Implement GCC 10 style symbol versioning (#545) 2020-09-11 10:15:43 +01:00
Seunghoon Yeon d04c43db47 Typo fixed. (#520) 2020-06-22 06:27:58 +01:00
Rosen Penev 1bdcd554bd fix format in test (#515)
Fixes warning under 32-bit.
2020-05-15 19:34:31 +01:00
Dr. David Alan Gilbert 4e719a9745 State GPL version in comment (#485)
IN a bunch of comments we say 'under the terms of the GNU GPL', make
it clear this is GPLv2 (as LICENSE says).

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-03-13 16:46:44 +00:00
philmd 55e3a2ae07 Travis-CI: Fix ImportError: No module named 'zipp' (#502)
Upgrade pip to fix [*]:

  [66/66] Linking target example/passthrough_hp.
  Traceback (most recent call last):
    File "/usr/lib/python3.5/runpy.py", line 174, in _run_module_as_main
      mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
    File "/usr/lib/python3.5/runpy.py", line 133, in _get_module_details
      return _get_module_details(pkg_main_name, error)
    File "/usr/lib/python3.5/runpy.py", line 109, in _get_module_details
      __import__(pkg_name)
    File "/usr/local/lib/python3.5/dist-packages/pytest/__init__.py", line 6, in <module>
      from _pytest.assertion import register_assert_rewrite
    File "/usr/local/lib/python3.5/dist-packages/_pytest/assertion/__init__.py", line 7, in <module>
      from _pytest.assertion import rewrite
    File "/usr/local/lib/python3.5/dist-packages/_pytest/assertion/rewrite.py", line 24, in <module>
      from _pytest.assertion import util
    File "/usr/local/lib/python3.5/dist-packages/_pytest/assertion/util.py", line 14, in <module>
      import _pytest._code
    File "/usr/local/lib/python3.5/dist-packages/_pytest/_code/__init__.py", line 2, in <module>
      from .code import Code  # noqa
    File "/usr/local/lib/python3.5/dist-packages/_pytest/_code/code.py", line 28, in <module>
      import pluggy
    File "/usr/local/lib/python3.5/dist-packages/pluggy/__init__.py", line 16, in <module>
      from .manager import PluginManager, PluginValidationError
    File "/usr/local/lib/python3.5/dist-packages/pluggy/manager.py", line 11, in <module>
      import importlib_metadata
    File "/usr/local/lib/python3.5/dist-packages/importlib_metadata/__init__.py", line 9, in <module>
      import zipp
  ImportError: No module named 'zipp'
  The command "test/travis-build.sh" exited with 1.

[*] https://travis-ci.org/libfuse/libfuse/builds/651523034

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-02-24 21:41:28 +00:00
Anthony Rebello b5100afd63 Fixes 477, optional src_dir in tst_(rmdir,unlink) (#493)
tst_rmdir and tst_unlink now pass for passthrough_hp.

Previously, tst_rmdir and tst_unlink created the directory / file
using src_dir, causing the test to fail as the cache was stale.
Now, the src_dir is optional. When cache is enabled, tst_rmdir
and tst_unlink do not provide a src_dir, forcing the test to
use mnt_dir itself.
2020-01-25 10:17:09 +00:00
Nikolaus Rath e469fb6ebe Invoke cleanup() with right arguments.
This currently causes hangs if the test fails, cf issue #459.
2019-11-20 11:38:33 +00:00
Stefan Hajnoczi 3bc5778e19 Avoid gcc 9.1 strncpy(3) warnings (#447)
Recent GCC releases have warnings related to common strncpy(3) bugs.
These warnings can be avoided by explicitly NUL-terminating the buffer
or using memcpy(3) when the intention is to copy just the characters
without the NUL terminator.

This commit fixes the following warnings:

  [1/27] Compiling C object 'test/9f86d08@@test_syscalls@exe/test_syscalls.c.o'.
  In function ‘test_socket’,
      inlined from ‘main’ at ../test/test_syscalls.c:1899:9:
  ../test/test_syscalls.c:1760:2: warning: ‘strncpy’ output may be truncated copying 108 bytes from a string of length 1023 [-Wstringop-truncation]
   1760 |  strncpy(su.sun_path, testsock, sizeof(su.sun_path));
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [2/27] Compiling C object 'lib/76b5a35@@fuse3@sha/fuse.c.o'.
  ../lib/fuse.c: In function ‘add_name’:
  ../lib/fuse.c:968:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    968 |  strncpy(s, name, len);
        |  ^~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse.c:944:15: note: length computed here
    944 |  size_t len = strlen(name);
        |               ^~~~~~~~~~~~
  [3/27] Compiling C object 'lib/76b5a35@@fuse3@sha/fuse_lowlevel.c.o'.
  ../lib/fuse_lowlevel.c: In function ‘fuse_add_direntry’:
  ../lib/fuse_lowlevel.c:288:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    288 |  strncpy(dirent->name, name, namelen);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse_lowlevel.c:276:12: note: length computed here
    276 |  namelen = strlen(name);
        |            ^~~~~~~~~~~~
  ../lib/fuse_lowlevel.c: In function ‘fuse_add_direntry_plus’:
  ../lib/fuse_lowlevel.c:381:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    381 |  strncpy(dirent->name, name, namelen);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse_lowlevel.c:366:12: note: length computed here
    366 |  namelen = strlen(name);
        |            ^~~~~~~~~~~~

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-08-29 20:28:29 +01:00
Nikolaus Rath de31610486 Do not run passthrough test when caching is active.
Readdir caching means that direct modifications to the source
directory will not be seen immediately, so the test becomes flaky.

Fixes: #416.
2019-07-09 05:29:49 -07:00
Nikolaus Rath 725ca46d8c test_cuse: fix runtime error
We are no longer using the capfd mechanism.
2019-07-05 11:03:31 +01:00
Nikolaus Rath 1343f59c27 Fix output checking in test cases
py.test's capture plugin does not work reliably when used by
other fixtures. Therefore, implement our own version.
2019-07-04 21:20:41 +01:00
Alan Somers 1f842c996e passthrough: fix unix-domain sockets on FreeBSD (#413)
FreeBSD doesn't allow creating sockets using mknod(2). Instead, one has to use socket(2)
and bind(2).  Add appropriate logic to the examples and add a test case.
2019-05-15 21:35:57 +01:00
Nikolaus Rath 055f272517 Added new example filesystem
passthrough_hp puts emphasis and performance and correctness, rather
than simplicity.
2019-05-09 14:16:37 -05:00
maxice8 b1b06d1920 Define ALLPERMS for musl libc systems. (#379) 2019-03-11 17:32:45 +00:00
Tomohiro Kusumi b394699a66 Work around -Wformat-truncation=/-Wformat-overflow= warnings (#356)
sprintf(3)/snprintf(3) destination buffers need to be large enough
so that gcc doesn't warn -Wformat-truncation= or -Wformat-overflow=
when source buffer size is 1024 bytes.

--
../test/test_syscalls.c:1445:47: warning: '%s' directive output may be truncated writing 1 byte into a region of size between 0 and 1023 [-Wformat-truncation=]
 #define PATH(p)  (snprintf(path, sizeof path, "%s/%s", testdir, p), path)
                                               ^~~~~~~
../test/test_syscalls.c:1458:19:
  res = mkdir(PATH("a"), 0755);
                   ~~~

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
2019-03-09 10:39:02 +00:00
Alan Somers 1b7d2b8862 Document fuse_fsync_in.fsync_flags and remove magic numbers (#375) 2019-03-08 21:24:50 +00:00
Nikolaus Rath 86ebe1d2df Travis CI: Use Xenial instead of Trusty. 2019-02-27 21:20:58 +00:00
Nikolaus Rath b35afb000a Added testcase for "big" readdir. 2018-11-24 20:51:47 +00:00
Nikolaus Rath 68f177d238 Kill filesystem process on test cleanup. 2018-11-24 20:51:34 +00:00
Niels de Vos 0c73b8389a tests: add copy_file_range() to the syscall tests 2018-11-19 12:33:56 +00:00
Nikolaus Rath df37856738 Update CI build script
There is no gcc-6 package anymore.
2018-11-06 18:54:06 +00:00
Ahmed Masud 078ef6641c Do not fail "ninja test" when running as subproject 2018-10-19 14:17:48 -07:00
Nikolaus Rath fd588b59e0 Enable more tests for passthrough_ll 2018-10-10 10:49:48 +01:00
Mattias Nissler da7c9b228a Add unprivileged option in mount.fuse3
The unprivileged option allows to run the FUSE file system process
without privileges by dropping capabilities and preventing them from
being re-acquired via setuid / fscaps etc. To accomplish this,
mount.fuse sets up the `/dev/fuse` file descriptor and mount itself
and passes the file descriptor via the `/dev/fd/%u` mountpoint syntax
to the FUSE file system.
2018-10-09 20:36:22 +01:00
Scott Worley 161fffd979 Fix unlink errno check 2018-09-27 09:29:22 +01:00
Rostislav Skudnov 055fcec831 test_write_cache: Use fuse_session_exit() to stop filesystem thread
Using fuse_session_exit() followed by fuse_session_unmount() ensures
that a proper cleanup and shutdown is performed.
2018-07-23 11:02:57 +01:00
Rostislav Skudnov c7ae066cb4 test_write_cache: Fix memory leaks 2018-07-23 11:02:57 +01:00
Rostislav 5f125c5e6b Fix readdir() bug when a non-zero offset is specified in filler (#269)
The bug occurs when a filesystem client reads a directory until the end,
seeks using seekdir() to some valid non-zero position and calls
readdir(). A valid 'struct dirent *' is expected, but NULL is returned
instead. Pseudocode demonstrating the bug:

DIR *dp = opendir("some_dir");
struct dirent *de = readdir(dp);

/* Get offset of the second entry */
long offset = telldir(dp);

/* Read directory until the end */
while (de)
	de = readdir(de);

seekdir(dp, offset);
de = readdir(dp);
/* de must contain the second entry, but NULL is returned instead */

The reason of the bug is that when the end of directory is reached, the
kernel calls FUSE_READDIR op with an offset at the end of directory, so
the filesystem's .readdir callback never calls the filler function, and
we end up with dh->filled set to 1. After seekdir(), FUSE_READDIR is
called again with a new offset, but this time the filesystem's .readdir
callback is never called, and an empty reply is returned.

Fix by setting dh->filled to 1 only when zero offsets are given to
filler function.
2018-07-21 10:57:09 +01:00
Nikolaus Rath 415f084ec1 Don't assume sub-second resolution for st_atime/st_mtime.
Fixes: #224
2018-07-11 10:33:16 +01:00
Bill Zissimooulos d105fafabb rename: perform user mode dir loop check when not done in kernel
Linux performs the dir loop check (rename(a, a/b/c)
    or rename(a/b/c, a), etc.) in kernel. Unfortunately
    other systems do not perform this check (e.g. FreeBSD).
    This results in a deadlock in get_path2, because libfuse
    did not expect to handle such cases.

    We add a check_dir_loop function that performs the dir
    loop check in user mode and enable it on systems that
    need it.
2018-05-18 12:52:10 +01:00
Nikolaus Rath da29b950bc Fix path to pytest cache directory. 2018-04-13 10:28:27 -07:00
Nikolaus Rath 53c31a099f Travis: remove root-owned cache files. 2018-03-31 13:52:14 +01:00
Nikolaus Rath 41f528677d Fix Travis build environment
Newest Meson requires Python 3.5 which isn't available in Trusty.
Pip version pin no longer necessary.
2018-03-31 13:21:08 +01:00
Tomohiro Kusumi 72ab7172b8 Fix build error on DragonFlyBSD (sync with other *BSD) (#240)
DragonFlyBSD has no "bsd" in uname, so add 'dragonfly' to conditionals.

-- e.g. uname(1) in DragonFlyBSD
[root@ ~]# uname
DragonFly
[root@ ~]# python -c "import sys; print(sys.platform)"
dragonfly5
2018-03-28 20:32:59 +01:00
Nikolaus Rath c3a881735f Travis CI: Don't use deprecated environment
Travis support recommends to install specific pip
version to work around problems in new environment.
2017-09-20 12:38:35 +01:00
Nikolaus Rath 21b55a05a1 example/ioctl: build on FreeBSD, but add protocol check instead. 2017-08-25 10:48:09 +02:00
Nikolaus Rath 48d0e99af3 Fix writeback capability check. 2017-08-25 09:49:23 +02:00