From 4fdaf40671f71e03f653817c0d0de1f7ffe41ccf Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Sat, 19 Dec 2020 11:27:19 +0100 Subject: [PATCH] Patch tar in grading.pl scripts `grade.pl` scripts contain packed test data. The scripts extract the data to the `grading` folder in the respective `assignments/PA[2-4]J?` folders. When running tar as superuser it defaults to `--preserve-permission` `--same-owner`. Since the packed data is owned by sjt:operator, the folder may be inaccessible from the host. By patching in `-o` to the tar command we disable `--same-owner` which creates the `grading` folder with root:root (translated to the PID:GID of the user running the container at least in podman). --- Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index c1e9bcf..3eda9a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,17 @@ RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+ RUN wget -O - https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@asset+block@pa4-grading.pl \ | tee /usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl > /dev/null +# Patch tar arguments in submission scripts +# We add -o to tar command since --preserve-permissions and --same-owner +# are default in tar for superuser. Since we are running as root +# in the container this messes up ownership of the `grading` folders +# created by the `grade.pl` scripts +RUN sed -i 's/-zx/-ozx/g' \ + /usr/class/assignments/PA2J/grade.pl /usr/class/assignments/PA2/grade.pl \ + /usr/class/assignments/PA3J/grade.pl /usr/class/assignments/PA3/grade.pl \ + /usr/class/assignments/PA4J/grade.pl /usr/class/assignments/PA4/grade.pl \ + /usr/class/assignments/PA5J/grade.pl /usr/class/assignments/PA5/grade.pl + # Setup working directory RUN mkdir -p /class WORKDIR /class