Patch tar in grading.pl scripts
All checks were successful
continuous-integration/drone/push Build is passing

`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).
This commit is contained in:
Armin Friedl 2020-12-19 11:27:19 +01:00
parent efe5b75d03
commit 4fdaf40671

View file

@ -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 \ 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 | 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 # Setup working directory
RUN mkdir -p /class RUN mkdir -p /class
WORKDIR /class WORKDIR /class