Commit Graph

8 Commits

Author SHA1 Message Date
Nalin Dahyabhai 473656b9dd copier.Stat(): return owner UID and GID if available
Return owner information for items that we've stat'ed.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-08-11 15:49:28 -04:00
Nalin Dahyabhai dda8e65e84 copier: add Ensure and ConditionalRemove
Add copier.Ensure() and copier.ConditionalRemove(), for controlling the
permissions and datestamps we set on multiple items we create with one
call (along with any parents), and selectively removing multiple items
with one call.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-05-21 09:54:21 -04:00
Kir Kolyshkin e548eaf146 copier: fix unused warnings
Found when running golangci-lint with --tests=false, which results in:

> copier/syscall_unix.go:89:2: const `testModeMask` is unused (unused)
> 	testModeMask           = int64(os.ModePerm)
> 	^
> copier/syscall_unix.go:90:2: const `testIgnoreSymlinkDates` is unused (unused)
> 	testIgnoreSymlinkDates = false
> 	^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-07 13:01:56 -07:00
Kir Kolyshkin 24da18800e *: fix build tags
This change is generated by `go1.23rc2 fix ./...`.

Had to use go1.23rc2, since all released go versions have a bug
preventing it from working with `go 1.22.0` in go.mod (opened
https://github.com/golang/go/issues/68825,
https://github.com/golang/go/issues/68824 for awareness).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-08-09 17:05:30 -07: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 77a9d4ef06 copier: add an Eval function
Add copier.Eval(), for expanding paths using symbolic links in a
chrooted scope, without failing if a path component doesn't exist.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-03-02 16:29:42 -05:00
Nalin Dahyabhai 9b3e7b1f02 copier: don't assume we can chroot() on Unixy systems
Fall back to non-chroot behavior on Unixy systems when we're not started
as UID 0.  Break the unit tests that exercise chroot functionality into
a separate file so that we don't even try to run those cases on non-Unix
OSes.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2020-12-16 18:00:45 -05:00