Skip to content

Commit 1f33e3c

Browse files
committed
R needs a TMPDIR during running of the submission
For the syntax check the current workdirectory `/compile` can be used. This is safe as it is not available during judging. Normally there is no writable directory during judgements, to make R work for submissions you need to set DOMJUDGE_CREATE_WRITABLE_TEMP_DIR to create a writable temporary directory with extra security risks.
1 parent cdc6603 commit 1f33e3c

File tree

1 file changed

+9
-1
lines changed
  • sql/files/defaultdata/r

1 file changed

+9
-1
lines changed

sql/files/defaultdata/r/run

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ if [ ! -r "$MAINSOURCE" ]; then
2727
fi
2828

2929
# Check syntax
30+
#
31+
# Store intermediate files in the current dir (/compile) as its only
32+
# available during compilation step.
33+
export TMPDIR=`pwd`
3034
Rscript -e "parse('"$@"')"
3135
EXITCODE=$?
3236
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE
@@ -45,10 +49,14 @@ fi
4549
# debugging.
4650
# export ONLINE_JUDGE=1 DOMJUDGE=1
4751
52+
# Rscript needs a temporary directory which is a security risk.
53+
# To make the language work you'll need to set DOMJUDGE_CREATE_WRITABLE_TEMP_DIR=1
54+
# as environment variable when starting the judgedaemon:
55+
# DOMJUDGE_CREATE_WRITABLE_TEMP_DIR=1 bin/judgedaemon
56+
4857
exec Rscript "$MAINSOURCE" "\$@"
4958
EOF
5059

5160
chmod a+x "$DEST"
5261

5362
exit 0
54-

0 commit comments

Comments
 (0)