Commit Graph

19 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
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
Nalin Dahyabhai 8807739467 pkg/archive.parseDirent(): adjust to avoid unsafe pointer conversion
Try to avoid an unsafe pointer conversion when parsing buffers returned
by unix.ReadDirent().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-02-24 09:53:59 -05:00
Kir Kolyshkin 3bf3251882 system.*xattr: wrap errors into os.PathError
This way the error messages are more informative.

Convert all the users accordingly (assuming there are no users outside
of this repo).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-29 03:30:02 -07:00
Zac Medico 091491bbf7 pkg/archive: limit user xattr value size to math.MaxUint16 bytes
This should avoid the following panic in Lgetxattr:

    panic: runtime error: makeslice: len out of range

Fixes: 0da4bc60b3 ("pkg/archive: strictly handle errors reading xattrs")
See: https://travis-ci.org/containers/buildah/jobs/617652963
Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-27 14:41:08 -08:00
Zac Medico f39fb8370d Remove redundant if statements for nil slices
Suggested-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-22 13:02:42 -08:00
Zac Medico 0da4bc60b3 pkg/archive: strictly handle errors reading xattrs
Suggested-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-22 11:05:31 -08:00
Zac Medico 5fc095c06d VFS support for user.* xattrs
Preservation of user.* xattrs is supported by most (if not all) other
drivers, and it's especially useful for containers that run under a
PaX kernel where "user.pax.flags" is used to store PaX flags.

Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-20 22:15:20 -08: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
Nalin Dahyabhai 97326e1d2f Support for per-container uid/gid mapping: lower
Expose reading and writing ID mapping in the archive and chrootarchive
packages, and in the driver interface.  Generally this means that
when computing or applying diffs, we need to have ID mappings passed in
that are specific to the layers we're using.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Miloslav Trmač c973ca0bd5 Make isENOTDIR available on all platforms
This fixes compilation on macOS, at least, and by code inspection could
work on Windows as well.

Fixes #160.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-03-15 17:30:26 +01:00
Nalin Dahyabhai 3543e3687b overlay: 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
Nalin Dahyabhai c21a98e79e changes: check for whiteout when looking at lower layers
When deciding whether to mark a file as added or modified, we check for
the presence of an item with the same path in a layer from which the
current later might have inherited a different version of the file.
This can be tripped up by overlay-style whiteout entries, which have the
same name as the file which they mark as having been removed.  Also make
sure that we don't mistakenly count, as inherited, a file with the same
name that was in a lower layer, but which was removed by an intermediate
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
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 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
Burke Libbey 03956610e5
ino and dev must both match for a file to be identical.
This case is triggered frequently on ZFS.

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
2015-05-05 11:06:54 -04:00
Burke Libbey 45c45a2c9a
archive: Optimize ChangesDirs on Linux
If we tear through a few layers of abstraction, we can get at the inodes
contained in a directory without having to stat all the files. This
allows us to eliminate identical files much earlier in the changelist
generation process.

Signed-off-by: Burke Libbey <burke@libbey.me>
2015-04-27 21:26:13 -04:00