1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon
Tibor Vass 171538c190 daemon: fix docker cp when container source is /
Before 7a7357da, archive.TarResourceRebase was being used to copy files
and folders from the container. That function splits the source path
into a dirname + basename pair to support copying a file:
if you wanted to tar `dir/file` it would tar from `dir` the file `file`
(as part of the IncludedFiles option).

However, that path splitting logic was kept for folders as well, which
resulted in weird inputs to archive.TarWithOptions:
if you wanted to tar `dir1/dir2` it would tar from `dir1` the directory
`dir2` (as part of IncludedFiles option).

Although it was weird, it worked fine until we started chrooting into
the container rootfs when doing a `docker cp` with container source set
to `/` (cf 3029e765).

The fix is to only do the path splitting logic if the source is a file.

Unfortunately, 7a7357da added support for LCOW by duplicating some of
this subtle logic. Ideally we would need to do more refactoring of the
archive codebase to properly encapsulate these behaviors behind well-
documented APIs.

This fix does not do that. Instead, it fixes the issue inline.

Signed-off-by: Tibor Vass <tibor@docker.com>
2019-06-13 06:31:15 +00:00
..
cluster Merge pull request #38522 from cpuguy83/fix_timers 2019-06-07 13:16:46 +02:00
config Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
discovery Make sure timers are stopped after use. 2019-01-16 14:32:53 -08:00
events Add canonical import comment 2018-02-05 16:51:57 -05:00
exec Entropy cannot be saved 2019-06-07 11:54:45 +01:00
graphdriver Merge pull request #39270 from kolyshkin/moar-aufs-fixes 2019-06-11 20:43:50 +02:00
images Merge pull request #37534 from thaJeztah/fix-distribution-500 2019-03-13 08:29:16 +01:00
initlayer Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
links fix typo 2018-09-08 08:13:30 +08:00
listeners allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
logger Entropy cannot be saved 2019-06-07 11:54:45 +01:00
names Add canonical import comment 2018-02-05 16:51:57 -05:00
network Network: add support for 'dangling' filter 2019-02-27 15:08:44 -05:00
stats stats: avoid cgo in collector 2019-06-05 22:21:11 -07:00
testdata
apparmor_default.go Add canonical import comment 2018-02-05 16:51:57 -05:00
apparmor_default_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
archive.go daemon: fix docker cp when container source is / 2019-06-13 06:31:15 +00:00
archive_tarcopyoptions.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
archive_tarcopyoptions_unix.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
archive_tarcopyoptions_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
archive_unix.go Move mount parsing to separate package. 2018-04-19 06:35:54 -04:00
archive_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
attach.go daemon.ContainerLogs(): fix resource leak on follow 2018-09-06 11:47:42 -07:00
auth.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
changes.go c.RWLayer: check for nil before use 2018-02-09 11:24:09 -08:00
checkpoint.go Merge pull request #38405 from rst0git/enable-cr-tty 2019-03-21 14:12:49 -07:00
cluster.go Move network conversions out of API router 2018-06-27 17:11:29 -07:00
commit.go Windows: (WCOW) Generate OCI spec that remote runtime can escape 2019-03-12 18:41:55 -07:00
configs.go Merge configs/secrets in unix implementation 2018-02-16 11:25:14 -05:00
configs_linux.go Add canonical import comment 2018-02-05 16:51:57 -05:00
configs_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
configs_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
container.go Capabilities refactor 2019-01-22 21:50:41 +02:00
container_linux.go Add canonical import comment 2018-02-05 16:51:57 -05:00
container_operations.go Merge pull request #39137 from arkodg/attach-to-existing-network-error 2019-06-12 19:58:04 +02:00
container_operations_unix.go Merge pull request #38579 from thaJeztah/fix_net_host_systemd_resolved 2019-03-21 15:34:48 -07:00
container_operations_windows.go Move EnableServiceDiscoveryOnDefaultNetwork to container-operations 2019-03-20 18:45:20 +01:00
container_unix_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
container_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
create.go Merge pull request #38918 from thaJeztah/bump_selinux 2019-03-28 17:27:03 -07:00
create_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
create_unix.go Entropy cannot be saved 2019-06-07 11:54:45 +01:00
create_windows.go Entropy cannot be saved 2019-06-07 11:54:45 +01:00
daemon.go Merge pull request #38349 from wk8/wk8/os_version 2019-06-07 14:54:51 +02:00
daemon_linux.go build: buildkit now also uses systemd's resolv.conf 2019-06-04 16:04:10 +00:00
daemon_linux_test.go Export all spec generation opts 2019-04-10 15:38:36 -04:00
daemon_test.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
daemon_unix.go info: report cgroup driver as "none" when running rootless 2019-06-03 00:11:21 +09:00
daemon_unix_test.go bugfix: fetch the right device number which great than 255 2019-05-16 15:32:59 +08:00
daemon_unsupported.go Fixes for resolv.conf 2018-07-26 11:17:56 -07:00
daemon_windows.go Windows: Experimental: Allow containerd for runtime 2019-03-12 18:41:55 -07:00
daemon_windows_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
debugtrap_unix.go Add canonical import comment 2018-02-05 16:51:57 -05:00
debugtrap_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
debugtrap_windows.go Windows:Update dumpstack event name 2019-02-15 15:26:56 -08:00
delete.go Updates daemon's remove link method to use more verbose error output. 2019-04-25 13:08:08 -04:00
delete_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
dependency.go Add canonical import comment 2018-02-05 16:51:57 -05:00
devices_linux.go Add DeviceRequests to HostConfig to support NVIDIA GPUs 2019-03-18 17:19:45 +00:00
disk_usage.go Extract volume interaction to a volumes service 2018-05-25 14:21:07 -04:00
errors.go Merge pull request #38541 from Microsoft/jjh/containerd 2019-03-19 21:09:19 -07:00
events.go Image events 2018-02-21 18:26:16 -05:00
events_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
exec.go Merge pull request #38522 from cpuguy83/fix_timers 2019-06-07 13:16:46 +02:00
exec_linux.go Export all spec generation opts 2019-04-10 15:38:36 -04:00
exec_linux_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
exec_windows.go Windows: (WCOW) Generate OCI spec that remote runtime can escape 2019-03-12 18:41:55 -07:00
export.go Add chroot for tar packing operations 2019-06-03 09:45:29 -07:00
health.go Make sure timers are stopped after use. 2019-01-16 14:32:53 -08:00
health_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
info.go Adding OS version info to the nodes' Info struct 2019-06-06 22:40:10 +00:00
info_test.go Masking credentials from proxy URL 2018-10-01 14:06:00 -04:00
info_unix.go Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
info_unix_test.go Add containerd, runc, and docker-init versions to /version 2019-01-14 23:27:05 +01:00
info_windows.go Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
inspect.go Extract volume interaction to a volumes service 2018-05-25 14:21:07 -04:00
inspect_linux.go Add canonical import comment 2018-02-05 16:51:57 -05:00
inspect_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
inspect_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
keys.go Add canonical import comment 2018-02-05 16:51:57 -05:00
keys_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
kill.go Windows: Experimental: Allow containerd for runtime 2019-03-12 18:41:55 -07:00
licensing.go Expose license status in Info (#37612) 2018-08-17 17:05:21 -07:00
licensing_test.go go vet fix for TestfillLicense 2018-12-09 00:51:37 +00:00
links.go Add canonical import comment 2018-02-05 16:51:57 -05:00
list.go Fix some typos 2018-09-20 20:00:35 +08:00
list_test.go Switch to google/uuid 2019-03-13 14:13:58 +00:00
list_unix.go Add canonical import comment 2018-02-05 16:51:57 -05:00
list_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
logdrivers_linux.go Add new local log driver 2018-08-17 09:36:56 -07:00
logdrivers_windows.go enable gcplogs driver on windows 2018-08-23 20:02:04 +00:00
logs.go daemon.ContainerLogs(): fix resource leak on follow 2018-09-06 11:47:42 -07:00
logs_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
metrics.go Adding OS version info to the nodes' Info struct 2019-06-06 22:40:10 +00:00
metrics_unix.go Fix typo: adapater -> adapter 2018-10-08 19:15:38 +08:00
metrics_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
monitor.go Merge pull request #38541 from Microsoft/jjh/containerd 2019-03-19 21:09:19 -07:00
mounts.go Extract volume interaction to a volumes service 2018-05-25 14:21:07 -04:00
names.go Entropy cannot be saved 2019-06-07 11:54:45 +01:00
network.go Move EnableServiceDiscoveryOnDefaultNetwork to container-operations 2019-03-20 18:45:20 +01:00
nvidia_linux.go daemon: fix bug in nvidia device registration 2019-03-29 16:07:01 -07:00
oci_linux.go Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
oci_linux_test.go oci: add integration tests for kernel.domainname configuration 2018-11-30 19:44:50 +11:00
oci_utils.go LCOW:Reworking spec builder 2019-03-12 18:41:55 -07:00
oci_windows.go Merge pull request #38541 from Microsoft/jjh/containerd 2019-03-19 21:09:19 -07:00
oci_windows_test.go Making it possible to pass Windows credential specs directly to the engine 2019-03-15 19:20:19 -07:00
pause.go Add canonical import comment 2018-02-05 16:51:57 -05:00
prune.go Move network conversions out of API router 2018-06-27 17:11:29 -07:00
reload.go Fix possible segfault in config reload 2019-01-10 15:34:02 +01:00
reload_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
reload_unix.go Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
reload_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
rename.go docker rename enhancement 2018-09-21 09:43:06 +08:00
resize.go Merge pull request #38522 from cpuguy83/fix_timers 2019-06-07 13:16:46 +02:00
resize_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
restart.go Windows: Fix restart for Hyper-V containers 2019-02-22 10:37:39 -08:00
seccomp_disabled.go Export all spec generation opts 2019-04-10 15:38:36 -04:00
seccomp_linux.go Export all spec generation opts 2019-04-10 15:38:36 -04:00
seccomp_unsupported.go Export all spec generation opts 2019-04-10 15:38:36 -04:00
secrets.go Add canonical import comment 2018-02-05 16:51:57 -05:00
secrets_linux.go Add canonical import comment 2018-02-05 16:51:57 -05:00
secrets_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
secrets_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
selinux_linux.go Add canonical import comment 2018-02-05 16:51:57 -05:00
selinux_unsupported.go Add canonical import comment 2018-02-05 16:51:57 -05:00
start.go Delete stale containerd object on start failure 2019-02-14 11:46:44 -08:00
start_unix.go vendor: update containerd to 63522d9 2018-06-08 19:19:06 -07:00
start_windows.go LCOWv1:Remote lcow.kernel and lcow.initrd 2019-03-12 19:31:12 -07:00
stats.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
stats_collector.go Add canonical import comment 2018-02-05 16:51:57 -05:00
stats_unix.go Add canonical import comment 2018-02-05 16:51:57 -05:00
stats_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
stop.go daemon.ContainerStop(): fix for a negative timeout 2018-05-03 10:04:33 -07:00
top_unix.go ContainerTop: improve error message 2018-05-24 18:24:36 -07:00
top_unix_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00
top_windows.go Windows: Implement docker top for containerd 2019-03-12 18:41:55 -07:00
unpause.go daemon/*.go: fix some Wrap[f]/Warn[f] errors 2018-07-11 15:51:51 +02:00
update.go Add canonical import comment 2018-02-05 16:51:57 -05:00
update_linux.go Windows: Experimental: Allow containerd for runtime 2019-03-12 18:41:55 -07:00
update_windows.go Windows: Experimental: Allow containerd for runtime 2019-03-12 18:41:55 -07:00
util_test.go Remove inmemory container map 2019-04-05 15:48:07 -04:00
uuid.go Switch to google/uuid 2019-03-13 14:13:58 +00:00
volumes.go Fix relabeling local volume source dir 2018-08-30 15:58:49 -07:00
volumes_linux.go Fix the several typos detected by github.com/client9/misspell 2018-08-09 00:45:00 +09:00
volumes_linux_test.go Use rslave propagation for mounts from daemon root 2018-02-07 14:27:09 -05:00
volumes_unit_test.go Move mount parsing to separate package. 2018-04-19 06:35:54 -04:00
volumes_unix.go daemon/mountVolumes(): eliminate MakeRPrivate call 2019-04-09 12:58:38 -07:00
volumes_unix_test.go Move mount parsing to separate package. 2018-04-19 06:35:54 -04:00
volumes_windows.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
wait.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
workdir.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00