Skip to contentSkip to conversation

docker: Don't mount ccache db if NOUSER=1

PATCH In review Fam Zheng 3 participants 4 messages Sep 25, 2017 – Sep 28, 2017

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 docker: Don't mount ccache db if NOUSER=1

With NOUSER=1 the container runs code as root, which may create privileged files that will not be be accssible next time. Skip ccache dir mount in this case.

---
 tests/docker/Makefile.include | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +4 -2
index 0e4f159619..6f9ea196a7 100644
@@ -143,9 +143,11 @@ docker-run: docker-qemu-src
 			-e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
 			-e V=$V -e J=$J -e DEBUG=$(DEBUG)		\
 			-e SHOW_ENV=$(SHOW_ENV) 			\
-			-e CCACHE_DIR=/var/tmp/ccache 			\
+			$(if $(NOUSER),,				\
+				-e CCACHE_DIR=/var/tmp/ccache 		\
+				-v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
+			)						\
 			-v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
-			-v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z 	\
 			$(IMAGE) 					\
 			/var/tmp/qemu/run 				\
 			$(TEST), "  RUN $(TEST) in ${IMAGE}")
Signature · 1 line
2.13.5
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Fam Zheng

With NOUSER=1 the container runs code as root, which may create privileged files that will not be be accssible next time. Skip ccache dir mount in this case.

Quoted 25 lines
---
 tests/docker/Makefile.include | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +4 -3
index 0e4f159619..6f9ea196a7 100644
@@ -143,9 +143,11 @@ docker-run: docker-qemu-src
                        -e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
                        -e V=$V -e J=$J -e DEBUG=$(DEBUG)               \
                        -e SHOW_ENV=$(SHOW_ENV)                         \
-                       -e CCACHE_DIR=/var/tmp/ccache                   \
+                       $(if $(NOUSER),,                                \
+                               -e CCACHE_DIR=/var/tmp/ccache           \
+                               -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
+                       )                                               \
                        -v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
-                       -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z       \
                        $(IMAGE)                                        \
                        /var/tmp/qemu/run                               \
                        $(TEST), "  RUN $(TEST) in ${IMAGE}")
--

2.13.5

Reviewed-by
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Fam Zheng

With NOUSER=1 the container runs code as root, which may create privileged files that will not be be accssible next time. Skip ccache dir mount in this case.

Makes sense:

Quoted 18 lines
Quoted 18 lines
---
 tests/docker/Makefile.include | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +4 -1
index 0e4f159619..6f9ea196a7 100644
@@ -143,9 +143,11 @@ docker-run: docker-qemu-src
                        -e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
                        -e V=$V -e J=$J -e DEBUG=$(DEBUG)               \
                        -e SHOW_ENV=$(SHOW_ENV)                         \
-                       -e CCACHE_DIR=/var/tmp/ccache                   \
+                       $(if $(NOUSER),,                                \
+                               -e CCACHE_DIR=/var/tmp/ccache           \
+                               -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
+                       )                                               \
Quoted 8 lines
Quoted 8 lines
tests/docker/Makefile.include +0 -2
                        -v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
-                       -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z       \
                        $(IMAGE)                                        \
                        /var/tmp/qemu/run                               \
                        $(TEST), "  RUN $(TEST) in ${IMAGE}")
--

2.13.5

--
Alex Bennée