Commit Graph

27 Commits

Author SHA1 Message Date
Kir Kolyshkin c3ff7f58df Use any instead of interface{}
It's available since Go 1.18 (see https://pkg.go.dev/builtin#any).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 15:37:25 -07: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
Giuseppe Scrivano e024854ba3
pkg/archive: avoid user lookups when generating tarball
This change introduces a new approach to generating tar headers in a way
that avoids system-dependent lookups and potential calls to glibc, enhancing
portability and security.

The same logic is used by Moby, and the override function is based on
code from Moby.

Closes: https://github.com/containers/storage/issues/1836

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-23 09:21:03 +01: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
Miloslav Trmač fe82b4d4cc Use //nolint
Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:54 +02: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
Doug Rabson 6147ac0c31 pkg/archive: Add a wrapper for os.Link which does not follow symlinks
On FreeBSD, the link syscall follows symlinks which makes
TestUntarHardlinkToSymlink fail. We can match the expected semantics on
FreeBSD using linkat.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-09-27 17:47:09 +01:00
Doug Rabson 8ee124d1b4 pkg/system: Sync the return type of Mkdev with the dev argument of Mknod
This avoids code having to cast the value returned by Mkdev and coding
in assuptions on the type of Mknod's dev argument.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-09-27 15:57:08 +01:00
Daniel J Walsh a5fdf90395
Creating fifo files while non root should be supported
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-23 05:52:00 -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
Mateusz Kwiatkowski d12d56e47e Fix FreeBSD suport
Ref https://github.com/containers/skopeo/issues/1163
2021-01-29 14:26:39 +01:00
Giuseppe Scrivano be5932a4d8
storage: add option force_mask=
force_mask sets a permission mask used for the new files and
directories.

It is useful for using a NFS share for the rootless storage.  It
requires this change in fuse-overlayfs:

https://github.com/containers/fuse-overlayfs/pull/246

[storage]
  driver = "overlay"
  graphroot = "/mnt/nfs/home/storage"
  [storage.options]
    size = ""
    mountopt = "xattr_permissions=2"
   [storage.options.overlay]
     force_mask = "0755"
     ignore_chown_errors = "true"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-11 10:30:43 +01: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
Justas Brazauskas 927b334ebf Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Dmitry Vorobev 4102537cfd Fixes #9283. Consider hardlinks in image size.
Based on #8984. This patch fixes behavior when image size calculation
didn't consider hardlinks.

Signed-off-by: Dmitry Vorobev <dimahabr@gmail.com>
2015-10-17 12:24:05 +02:00
Phil Estes 442b45628e Add user namespace (mapping) support to the Docker engine
Adds support for the daemon to handle user namespace maps as a
per-daemon setting.

Support for handling uid/gid mapping is added to the builder,
archive/unarchive packages and functions, all graphdrivers (except
Windows), and the test suite is updated to handle user namespace daemon
rootgraph changes.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2015-10-09 17:47:37 -04:00
Icaro Seara 997ba4b0da Fix typo, "fil" -> "fill"
Signed-off-by: Icaro Seara <icaro.seara@gmail.com>
2015-08-19 21:50:54 -03:00
Stefan J. Wernli 230cfc6ed2 Fixing Tar functions to support Windows long paths.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2015-08-11 16:07:36 -07:00
unclejack 2f6e4fdb29 linting changes
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2015-06-17 01:16:57 +03:00
John Howard 8228ee4b0f Windows: Archive package changes for Windows daemon
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-20 08:55:54 -07:00
Tianon Gravi 576985a1dc Finally remove our copy of "archive/tar" now that Go 1.4 is the minimum!
IT'S ABOUT TIME. 🎉

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-05-01 16:01:10 -06:00
Jimmy Puckett ec5e22efe3 Changing bitflag checking style to preferred style. Fixes #11668
Signed-off-by: Jimmy Puckett <jimmy.puckett@spinen.com>
2015-03-24 21:09:25 -04:00
Ahmet Alp Balkan 1a22418f9f pkg/archive: adjust chmod bits on windows
This change modifies the chmod bits of build context archives built on
windows to preserve the execute bit and remove the r/w bits from
grp/others.

Also adjusted integ-cli tests to verify permissions based on the platform
the tests are running.

Fixes #11047.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-03-04 14:10:37 -08:00
Ahmet Alp Balkan 5ecab9e831 Support windows style dockerfile paths for build cmd
Currently TestBuildRenamedDockerfile fails since passing
custom dockerfile paths like:

    docker build -f dir/file .

fails on windows because those are unix paths. Instead, on
windows accept windows style paths like:

    docker build -f dir\file .

and convert them to unix style paths using the helper we
have in `pkg/archive` so that daemon can correctly locate
the path in the context.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-24 20:23:53 -08:00
Ahmet Alp Balkan 28842d3f09 pkg/archive: Canonicalize stored paths
Currently pkg/archive stores nested windows files with
backslashes (e.g. `dir\`, `dir\file.txt`) and this causes
tar not being correctly extracted on Linux daemon.

This change assures we canonicalize all paths to unix
paths and add them to tar with that name independent of platform.

Fixes the following test cases for Windows CI:
- TestBuildAddFileWithWhitespace
- TestBuildCopyFileWithWhitespace
- TestBuildAddDirContentToRoot
- TestBuildAddDirContentToExistingDir
- TestBuildCopyDirContentToRoot
- TestBuildCopyDirContentToExistDir
- TestBuildDockerignore
- TestBuildEnvUsage
- TestBuildEnvUsage2

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2015-02-17 16:51:04 -08:00
Ahmet Alp Balkan 2180aa4f6f Refactor pkg/archive with a platform-independent stat struct
pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00