Commit Graph

18 Commits

Author SHA1 Message Date
Kir Kolyshkin a4d8f720a2 Format sources with gofumpt
gofumpt is a superset of gofmt, enabling some more code formatting
rules.

This commit is brought to you by

	gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2023-05-26 16:17:31 -07:00
Daniel J Walsh a3204cf7e8
Move to golang 1.18 and later
Github.com is reporting security issues on older versions of
golang.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-04-03 15:26:54 -04:00
Doug Rabson 8cd1f5a8c5 pkg/archive: Use archive_unix.go on FreeBSD
Almost all the code can be shared between Linux, FreeBSD and Darwin with
the only different in the handling of lchmod. On FreeBSD and Darwin (and
probably other BSDs) we can access lchmod functionality via
unix.Fchmodat.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-09-29 11:37:32 +01:00
Nalin Dahyabhai cbef82ca7b pkg/archive/overlayWhiteoutConverter.ConvertWrite(): force mode to 0
Force the mode for whiteouts that have been converted from overlay
format (produced by overlay native diff) to aufs format to 0x0, to match
the permissions we assign to whiteouts we create when using naive diff.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-04-11 10:47:02 -04:00
Tycho Andersen 0a8ace983c archive/overlay: ignore failures from nested whiteouts
See comment for the situation that arises, we've seen this with images
generated by very old dockers (and possibly others?).

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
2021-05-18 08:03:37 -06:00
Giuseppe Scrivano 9bf64bb716
archive, rootless: use user.* instead of trusted.*
unprivileged users cannot use the trusted.* xattrs.  Since for
rootless we always mount overlay with userxattr, we can just check if
running in rootless mode and use user.* instead of trusted.*.

Closes: https://github.com/containers/podman/issues/9936

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-06 17:10:24 +02:00
Giuseppe Scrivano b9ada3d657
archive: make getFileOwner public
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-09 15:35:36 +01:00
Giuseppe Scrivano bb2fffc4e2
archive: whiteout creation with a handler
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-09 15:35:35 +01:00
Giuseppe Scrivano 329f129d04
archive: make getWhiteoutConverter public
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-09 15:35:35 +01:00
Giuseppe Scrivano cdb1fd70b2
storage: store original permissions mask if force_mask!=0
if force mask is configured, store the original permissions in the
'user.containers.override_stat` xattr.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-11 10:30:59 +01:00
Daniel J Walsh f3c3a0abee
Fix to be able to build on FTBFS on mipsel
Some platforms store s.Rdev as unit32, translate to unit64 so it
will compile.

Also add function to make it clear that the object is a whiteout object.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-11-11 17:27:49 -05:00
Giuseppe Scrivano 86147bc774
storage: make [l]chown errors clearer
if os.[Lc,C]hown are failing with EINVAL, it might be related to an
UID/GID not mapped in the user namespace we are currently using.

It could be possible to detect this issue by inspecting
/proc/self/uid_map or /proc/self/gid_map, but that won't be possible
when we are pulling a new image and extracting it from a chroot where
/proc is not mounted.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-11 08:56:38 +01:00
Nalin Dahyabhai 3063635862 archive.Tar: don't trust the "trusted.overlay.opaque" xattr
If the overlay filesystem implements an optimization that landed in
97c684cc911060ba7f97c0925eaf842f159a39e8, and in the mainline kernel in
4.10, directories created in merged directories are marked as opaque by
the kernel to let the kernel know that it needn't bother looking at
other layers when reading the contents of that directory.

This means that, when generating a diff for an upper directory, we can't
treat the presence of an opaque attribute as enough of an indication
that a layer diff needs to include whiteout for a directory of the same
name from a lower layer.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-02-23 16:00:48 -05:00
Daniel J Walsh f39066fe1b Update packages to match latest code in moby/pkg
Had to vendor in a new version of golang.org/x/net to build
Also had to make some changes to drivers to handle
archive.Reader -> io.Reader
archive.Archive -> io.ReadCloser

Also update .gitingore to ignore emacs files, containers-storage.*
and generated man pages.

Also no longer test travis against golang 1.7, cri-o, moby have also
done this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-12 18:00:29 +00:00
Derek McGowan 3a53c82c22 Fix files in subdirectories creating bad whiteout
Closes #23863

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-08-16 12:06:33 -04:00
Nalin Dahyabhai 60ff079996 Rename: cow/cowman -> storage/oci-storage
Rename the library module and CLI wrapper.
Rename daemon/graphdriver to drivers.
Catch up vendoring to match modules we've pruned.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-07-18 17:35:50 -04:00
Derek McGowan bd13c53f8d Fix overlay2 ignoring whiteout files
Currently when overlay creates a whiteout file then the overlay2 layer is archived,
the correct tar header will be created for the whiteout file, but the tar logic will then attempt to open the file causing a failure.
When tar encounters such failures the file is skipped and excluded for the archive, causing the whiteout to be ignored.
By skipping the copy of empty files, no open attempt will be made on whiteout files.

Fixes #23863

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-23 13:34:38 -07:00
Derek McGowan 8222c86360 Update archive package to support overlay whiteouts
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-08 00:10:16 -07:00