Commit Graph

22 Commits

Author SHA1 Message Date
Kir Kolyshkin 29a197522e drivers/copy: simplify atime conversion
Mostly to avoid explicit typecasts.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-01 16:18:38 -07:00
Kir Kolyshkin 7c9328eb0c Remove obsoleted linter from nolint annotations
While at it, made sure there's no space between // and nolint
(as it is required for comments aimed for tools not humans).

This fixes the following golangci-lint warning:

> WARN [runner/nolint_filter] Found unknown linters in //nolint directives: golint

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-26 14:29:57 -07:00
Minseo Kim 5015968dd8 pkg/system: fix `EOPNOTSUPP` to `ENOTSUP` for xattr syscalls
The lgetxattr(2), lsetxattr(2), and llistxattr(2) syscalls on Linux
return ENOTSUP instead of EOPNOTSUPP. The same applies to getxattr(2),
setxattr(2), and listxattr(2) on macOS.

Note that EOPNOTSUPP and ENOTSUP have the same value in Linux (refer to
errno(3)).

Signed-off-by: Minseo Kim <kimminss0@outlook.kr>
2024-11-29 18:32:32 +09:00
Jonathon Anderson 6e4298ee9e Update copy.DirCopy to not unlink sockets
- Closes #2113

`copy.DirCopy` contains code to create named sockets matching those on
the source; however, this operation closes the socket, removing it
implicitly from the destination and causing later chown and chmod
operations to fail.

This commit creates matching file system nodes directly without opening
a socket or invoking the auto-removal semantics of a listener.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
2024-10-30 11:57:36 -06:00
Kir Kolyshkin 83c0c077c5 all: remove old-style +build tags
Brought to you by

	go fix ./...

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-09-19 17:00:48 -07:00
Jan Rodák ebea1ea21d
Fix impossible comparison of interface value with untyped nil (SA4023)
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-06-17 15:13:44 +02:00
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 f0cd0b97b1
chrootarchive: use unshare to detect user namespace
use the function in containers/storage that has the same
functionalities.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-09-08 23:07:14 +02:00
Daniel J Walsh 3f8c0dc0de
Wrap errors properly with fmt.Errorf
Also returned errors should not begine with a capatalized errors.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-12 13:26:10 -04:00
Daniel J Walsh b3531c3df8
Vendor in opencontainers/runc v1.0.0
The RunningInUserNS Function was removed from libcontainer and is now
in contianerd.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-22 08:41:17 -04:00
Giuseppe Scrivano 4821b98b8a
copy, rootless: skip copying trusted.* xattr
unprivileged users cannot use the trusted.* xattrs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-06 16:55:18 +02:00
Giuseppe Scrivano 029896beb3
copy: create a unix socket with os.ModeSocket
os.ModeSocket refers to a UNIX socket, not a FIFO.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-12 15:20:37 +01:00
Giuseppe Scrivano 87b50c455a
drivers: new function CopyRegularToFile
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-09 15:35:34 +01:00
Giuseppe Scrivano 7ce64181a0
drivers: make copyRegular public
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-03-09 15:35:27 +01: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
Daniel J Walsh 632ac1df6f
Remove dead code
Coverity found this dead code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-11 17:37:45 -04: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 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
Valentin Rothberg f240cc75a0 drivers.DirCopy: fix filemode detection
We failed to detect char devices as those were not covered by the
`ModeDevice` check.  Fix this by using the entire FileMode mask as
suggested by the standard library.

Also change the "unknown file type" error to include the mode to
ease debugging potential regressions in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-04-05 15:12:54 +02:00
Nalin Dahyabhai 6a9fa6b66e drivers/copy: add a non-cgo fallback
The vfs driver already has logic that avoids use of the copy package
when we're not on Linux, so provide the same fallback in the copy
package for non-cgo cases.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-03-26 10:03:04 -04:00