Commit Graph

12 Commits

Author SHA1 Message Date
Jan Kaluza a0a9ac6380 Switch common, storage and image to monorepo.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-08-29 15:04:28 +02:00
Nalin Dahyabhai 738fa0d3c4 copier.Get(): ensure that directory entries end in "/"
Make sure that entries with Typeflag == TypeDir always end with a "/",
adding it as a suffix.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-08-11 14:10:16 -04:00
Kir Kolyshkin 95f2e1020f vendor: switch to moby/sys/capability
github.com/moby/sys/capability is a fork of the (no longer maintained)
github.com/syndtr/gocapability package.

For the list of changes since the fork took place, see
https://github.com/moby/sys/blob/main/capability/CHANGELOG.md

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-09-30 13:19:03 -07:00
Nalin Dahyabhai 8ae99121c1 CI: enable the gofumpt linter
Turn on the gofumpt linter.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-15 13:17:44 -04:00
Chris Evich 46eea31588
Replace io/ioutil calls with os calls
In golang 1.19, `io/ioutil` is fully deprecated preventing Buildah from
compiling.  Replace all calls with equivalent calls from the `os`
package.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-12-06 14:29:32 -05:00
Daniel J Walsh 8d5d763213
Fix stutters
Podman adds an Error: to every error message. So starting an error
message with "error" ends up being reported to the user as

Error: error ...

This patch removes the stutter.

Also ioutil.ReadFile errors report the Path, so wrapping the err message
with the path causes a stutter.

Signed-off-by: Daniel J Walsh dwalsh@redhat.com

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-19 07:11:44 -04:00
Eng Zer Jun 0c4b19ba83
test: use `T.TempDir` to create temporary test directory
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-20 21:13:27 +08:00
Sascha Grunert ce384684c0
Switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-07 11:41:47 +02:00
Kir Kolyshkin 3d93408a06 all: fix capabilities.NewPid deprecation warnings
Since commit 3eef1ed0bd (January 2019) using
capabilities.NewPid() is deprecated.

Replace with NewPid2().

Note that in chroot/run.go we used to load then clear all capabilities
bits. With NewPid2, this is no longer needed -- we do not load caps, so
there is no need to clear.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-01-18 12:56:35 -08:00
Nalin Dahyabhai 745cee8aa5 copier: add Remove()
Add copier.Remove().

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-20 14:09:50 -04:00
Nalin Dahyabhai 1dbf430563 copier: add GetOptions.NoCrossDevice
Add a NoCrossDevice flag to GetOptions, telling it to ignore
subdirectories on devices different than the top reference directory
that we start from, i.e., ignore the contents of mounted filesystems.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-14 10:19:19 -04:00
Nalin Dahyabhai 34ae47a226 copier: add GetOptions.IgnoreUnreadable
Add an IgnoreUnreadable flag to copier.GetOptions to suppress errors
from copier.Get() that would pass the os.IsPermission() test, if they're
encountered while attempting to read files or descend into directories.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-03-04 15:32:32 -05:00