768 Commits

Author SHA1 Message Date
Akihiko Odaki
9810b85aad main: Override inaccessible xattrs
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 22:50:14 +09:00
Akihiko Odaki
90bea22c73 Prefer user.containers.override_stat over user.fuseoverlayfs.
Previously, fuse-overlayfs always used user.fuseoverlayfs.override_stat
for the upper layer while honoring user.containers.override_stat for
lower layers so that it can consume a layer created by
containers/storage.

It turned out that containers/storage also needs to get the overriding
extended attribute set by fuse-overlayfs and to set one for the upper
layer to make the root directory of the upper layer inherit the mode
of a lower layer. Adding code to get and to set
user.fuseoverlayfs.override_stat to containers/storage is a bit ugly.

The underlying problem is that fuse-overlayfs changes what name to use
ad hoc. Fix it by always preferring user.containers.override_stat, which
containers/storage honors, over user.fuseoverlayfs.overlayfs, which is
specific to fuse-overlayfs.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 22:50:14 +09:00
Akihiko Odaki
e16818c042 Fix printed extended attribute name
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 22:50:14 +09:00
Akihiko Odaki
9610adf7ab main: Do not set -1 for owner overriding xattrs
ovl_setattr () used to pass -1 as uid or gid when either of them
is not changed for do_fchown () / do_chown (), but if these functions
use overriding xattrs instead of real fchown () or chown (), it causes
-1 to be written in owner overriding xattrs and break them.

Replace -1 with the current uid or gid before calling do_fchown () /
do_chown ().

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 22:50:01 +09:00
Akihiko Odaki
136aefd2f6 main: Fix file owner retrieval for chmod
do_fchmod () and do_chmod () used to call override_mode () directly to
retrieve the owner information, but the usage of override_mode () was
wrong; override_mode () expects struct stat is already populated by
the information provided by the underlying filesystem, but do_fchmod ()
and do_chmod () only zeroed st_uid and st_gid. override_mode () does not
update the owner information when st_mode is not S_IFDIR nor S_IFREG so
this caused chmod to change the file owner to root at random.

Use the logic rpl_stat () employs to file owner retrieval for chmod
functions to ensure they provide the owner information consistent with
rpl_stat ().

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 21:35:51 +09:00
Akihiko Odaki
a13a9e71dc utils: Always suppress ENODATA
override_mode () used to suppress ENODATA only in a certain condition.
ENODATA errors in other situations made load_dir () fail because it
indirectly calls override_mode () when the underlying file system
reports DT_UNKNOWN for an opaque whiteout file and such an file does
not have mode xattrs. do_fchmod () and do_chmod () worked around the
problem by supressing ENODATA by themselves, but that led to code
duplication. Always suppress ENODATA to resolve these problems.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 21:35:51 +09:00
Akihiko Odaki
b644635d67 tests: Update to Ubuntu 22.04
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 21:35:39 +09:00
Akihiko Odaki
19ba462b57 tests: Update run-on-arch-action to v2.7.2
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 21:34:11 +09:00
Giuseppe Scrivano
25505d9b6c
Merge pull request #424 from akihikodaki/tests
Fix tests
2024-06-17 14:03:29 +02:00
Akihiko Odaki
d34257cd3a build: Fix libfuse version
Building the current master branch fails with:
#8 4.712 ninja: job failed: cc -Ilib/libfuse3.a.p -Ilib -I../lib -Iinclude -I../include -I. -I.. -fdiagnostics-color=always -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_REENTRANT -DHAVE_LIBFUSE_PRIVATE_CONFIG_H -Wno-sign-compare -D_FILE_OFFSET_BITS=64 -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -fno-strict-aliasing -Wno-unused-result -DHAVE_SYMVER_ATTRIBUTE -fPIC -pthread -DFUSE_USE_VERSION=317 '-DFUSERMOUNT_DIR="/usr/bin"' -MD -MQ lib/libfuse3.a.p/fuse_signals.c.o -MF lib/libfuse3.a.p/fuse_signals.c.o.d -o lib/libfuse3.a.p/fuse_signals.c.o -c ../lib/fuse_signals.c
#8 4.713 ../lib/fuse_signals.c:19:10: fatal error: execinfo.h: No such file or directory
#8 4.713    19 | #include <execinfo.h>
#8 4.713       |          ^~~~~~~~~~~~
#8 4.713 compilation terminated.
#8 13.65 ninja: subcommand failed

Use the latest stable version, which is 3.16.2

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 18:01:59 +09:00
Akihiko Odaki
da0f9cb03b tests: Use Fedora to test fast_ino_check
The test of fast_ino_check used CentOS Stream 8, which is no longer
supported and whose repositories are no longer available.

While we can update it to use CentOS Stream 9, use Fedora instead for
consistency with the other test cases.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 17:51:50 +09:00
Akihiko Odaki
3a1b242526 tests: Drop the test case for https://github.com/containers/fuse-overlayfs/issues/86
The test case for https://github.com/containers/fuse-overlayfs/issues/86
does no longer work because it relies on CentOS Stream 8 repositories,
which are unavailable.

While we can update it to use CentOS Stream 9, the issue says it is
limited to CentOS 6, and it is unclear if the test case will reproduce
the intended scenario with CentOS Stream 8 or 9 so drop it.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-17 17:49:20 +09:00
Giuseppe Scrivano
a01f52fc6b
Merge pull request #415 from flouthoc/fix-clang-errors
.clang-format: remove duplicated mapping key which breaks newer `clang` formatters.
2024-02-21 09:35:54 +01:00
flouthoc
ebc3b5c9f8
.clang-format: fix duplicated mapping key
New clang versions throw error like, following commit fixes that

```console
.clang-format:26:1: error: duplicated mapping key 'AllowShortIfStatementsOnASingleLine'
AllowShortIfStatementsOnASingleLine: false
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2024-02-20 22:16:16 -08:00
Giuseppe Scrivano
c2dd76c6d7
Merge pull request #412 from giuseppe/fix-variable-leak
main: automatically cleanup newpath
2024-02-06 13:21:34 +01:00
Giuseppe Scrivano
c08211ddd7
main: automatically cleanup newpath
this was already the assumption in the source code.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-06 10:21:52 +01:00
Giuseppe Scrivano
18f4d6768a
Merge pull request #410 from giuseppe/propagate-force-mask-on-dir-copyup
main: propagate xattrs permissions with copyup
2023-11-03 10:36:21 +01:00
Giuseppe Scrivano
d9e78eadb7
main: create dir in two steps with xattrs permissions
if xattrs permissions are used, create the directory in two steps and
set the correct ownership before moving it into the target.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-11-02 11:49:16 +01:00
Giuseppe Scrivano
d65ce2a8bb
main: propagate xattrs permissions with copyup
when a directory is copied up, propagate its mode if using xattrs
permissions.

Closes: https://github.com/containers/fuse-overlayfs/issues/407

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-11-01 21:35:03 +01:00
Giuseppe Scrivano
906513ccba
Merge pull request #409 from giuseppe/create-inodes-with-correct-mode
Create devices and dirs with correct mode with xattrs_permissions
2023-10-31 08:54:38 +01:00
Giuseppe Scrivano
f73fd2db7c
fuse-overlayfs: honor mode for dirs with xattr_permissions
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-30 18:10:19 +01:00
Giuseppe Scrivano
2d8613e7f5
fuse-overlayfs: honor mode for devices with xattr_permissions
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-30 18:07:11 +01:00
Daniel J Walsh
acfb6a27d1
Merge pull request #408 from giuseppe/honor-umask-xattr-permissions
fuse-overlayfs: honor umask with xattr_permissions
2023-10-30 10:26:32 -04:00
Giuseppe Scrivano
95e12f97f5
fuse-overlayfs: propagate force mode xattr
if the lower dir has a force mode xattr, use it for the upper layer
too.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-30 08:40:04 +01:00
Giuseppe Scrivano
40b431e243
fuse-overlayfs: honor umask with xattr_permissions
Closes: https://github.com/containers/fuse-overlayfs/issues/407

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-29 21:04:14 +01:00
Daniel J Walsh
e47790da06
Merge pull request #406 from AkihiroSuda/hub-to-gh
release.yaml: migrate from `hub` to `gh`
2023-10-09 16:04:13 -04:00
Akihiro Suda
542b005c67
release.yaml: migrate from hub to gh
`hub` was deprecated and removed from GitHub Actions runners

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-09 07:51:19 +09:00
Daniel J Walsh
9aba87b78f
Merge pull request #405 from giuseppe/add-clang-format
code: add clang-format
2023-10-02 15:41:20 -04:00
Giuseppe Scrivano
ba472b58bc
code: add clang-format
add a clang-format definition file and apply it to the code.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-10-02 15:12:42 +02:00
Giuseppe Scrivano
40e0f3c329
Merge pull request #403 from AkihiroSuda/repro
CI: release: enable reproducible builds
2023-09-14 12:11:52 +02:00
Akihiro Suda
5755b22bcb
CI: release: enable reproducible builds
The binaries are now bit-for-bit reproducible (<https://reproducible-builds.org/>):
```bash
docker buildx build \
   -o /tmp/fuse-overlayfs-builds \
   --build-arg SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) \
   --platform=amd64,arm64,arm,s390x,ppc64le,riscv64 \
   -f Containerfile.cross .
```

This ensures that the binaries are not built from any unpublished source.

- Implementation is similar to <https://github.com/rootless-containers/slirp4netns/compare/v1.2.1...v1.2.2>
- `/etc/apt/sources.list` is modified to use <http://snapshot.ubuntu.com> using
  <https://github.com/reproducible-containers/repro-sources-list.sh>.
- As <http://snapshot.ubuntu.com> is slow, `/var/cache/apt` is cached on GHA using
  <https://github.com/reproducible-containers/buildkit-cache-dance>.
- For testing sake, `.github/workflows/release.yaml` is now executed for every push events.
  The release artifacts are published only on a push event with a `v*` tag.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-09-14 05:48:00 +09:00
Giuseppe Scrivano
ff6b14d0a8
Merge pull request #402 from giuseppe/fix-perf-issue
main: fix performance issue with large dirs
2023-08-29 17:31:41 +02:00
Giuseppe Scrivano
6931a9c088
NEWS: tag 1.13
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
v1.13
2023-08-29 16:07:22 +02:00
Giuseppe Scrivano
98206a6a90
main: fix performance issue with large dirs
cache the number of links for a directory instead of calculating it on
every stat.  It makes a huge difference when the directory has a lot
of entries.

Closes: https://github.com/containers/fuse-overlayfs/issues/401

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-08-29 16:03:50 +02:00
Giuseppe Scrivano
6452d53e83
Merge pull request #398 from giuseppe/fix-check-for-proc
main: fix check for writeable /proc
2023-06-08 14:37:56 +02:00
Giuseppe Scrivano
06f8a69efa
main: fix check for writeable /proc
fix the check for writeable /proc to use statfs instead of statvfs,
and use the unitialized statvfs structure to check for the writeable
bit.

Closes: https://github.com/containers/fuse-overlayfs/issues/397

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-06-07 21:30:02 +02:00
Giuseppe Scrivano
bcea6c940b
Merge pull request #395 from giuseppe/tag-1.12
NEWS: tag 1.12
2023-05-11 12:13:50 +02:00
Giuseppe Scrivano
2aee61e0ac
configure.ac: switch to -dev
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-05-11 11:05:00 +02:00
Giuseppe Scrivano
560ab7d9de
NEWS: tag 1.12
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
v1.12
2023-05-11 11:05:00 +02:00
Daniel J Walsh
746960bdbe
Merge pull request #392 from giuseppe/change-license-gplv2+
fuse-overlays: change license to GPLv2+
2023-04-13 13:58:45 -04:00
Giuseppe Scrivano
d617afcefb
fuse-overlays: change license to GPLv2+
the contributors agreed on the change in the attached issue.

Closes: https://github.com/containers/fuse-overlayfs/issues/387

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-04-11 18:25:46 +02:00
Giuseppe Scrivano
cc1b0e2d34
lib: update hash library
it was relicensed as LGPLv2+ upstream in gnulib.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-04-11 18:24:22 +02:00
Giuseppe Scrivano
db404d85d4
Revert "Revert "configure.ac: back to -dev""
This reverts commit d9f017b59140ca774bab5cea54159043b573a28c.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-24 19:48:11 +01:00
Giuseppe Scrivano
68c31d14b0
release: use local file
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
v1.11
2023-03-24 19:48:05 +01:00
Giuseppe Scrivano
d9f017b591
Revert "configure.ac: back to -dev"
This reverts commit b6efecd3b0a42cd819fd6f6390937f7453b18035.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-24 19:48:04 +01:00
Daniel J Walsh
b622e9a955
Merge pull request #389 from giuseppe/check-for-acl-support
main: check that ACLs are supported in the lower layers
2023-03-24 08:37:56 -04:00
Giuseppe Scrivano
b6efecd3b0
configure.ac: back to -dev
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-23 23:02:31 +01:00
Giuseppe Scrivano
898252e14a
NEWS: release 1.11
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-23 23:02:31 +01:00
Giuseppe Scrivano
2666df2a49
main: check that ACLs are supported in the lower layers
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2180118

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-03-23 23:02:18 +01:00
Daniel J Walsh
25db5be78a
Merge pull request #381 from giuseppe/tag-1.10
NEWS: tag 1.10
2022-11-30 10:49:55 -05:00