From 460e393772127a0481e4f27db4249ae4381c1780 Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Wed, 19 Jun 2019 00:09:56 -0500 Subject: [PATCH] fix problem with multiple args --- lxc/executors/bash | 2 +- lxc/executors/c | 2 +- lxc/executors/cpp | 2 +- lxc/executors/csharp | 2 +- lxc/executors/go | 2 +- lxc/executors/java | 2 +- lxc/executors/nasm | 2 +- lxc/executors/node | 2 +- lxc/executors/php | 2 +- lxc/executors/python2 | 2 +- lxc/executors/python3 | 2 +- lxc/executors/r | 2 +- lxc/executors/ruby | 2 +- lxc/executors/rust | 2 +- lxc/executors/swift | 2 +- readme.md | 10 +++++----- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lxc/executors/bash b/lxc/executors/bash index 1aae8ca..07ee438 100755 --- a/lxc/executors/bash +++ b/lxc/executors/bash @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 bash code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 bash code.code" diff --git a/lxc/executors/c b/lxc/executors/c index 9752eab..0cd5424 100755 --- a/lxc/executors/c +++ b/lxc/executors/c @@ -1,3 +1,3 @@ cd /tmp/$2 timeout -s KILL 10 gcc -o binary -x c code.code -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ./binary" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/executors/cpp b/lxc/executors/cpp index 7d425a6..64a5157 100755 --- a/lxc/executors/cpp +++ b/lxc/executors/cpp @@ -1,3 +1,3 @@ cd /tmp/$2 timeout -s KILL 10 g++ -o binary -x c++ code.code -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ./binary" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/executors/csharp b/lxc/executors/csharp index a9850df..3124788 100755 --- a/lxc/executors/csharp +++ b/lxc/executors/csharp @@ -1,3 +1,3 @@ cd /tmp/$2 timeout -s KILL 10 mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 mono binary" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary" diff --git a/lxc/executors/go b/lxc/executors/go index cf3d7b9..5084a30 100755 --- a/lxc/executors/go +++ b/lxc/executors/go @@ -3,4 +3,4 @@ cp code.code interim.go file="interim.go" GOROOT=/usr/lib/go timeout -s KILL 10 go build $file file=${file%%.*} -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ./$file" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./$file" diff --git a/lxc/executors/java b/lxc/executors/java index a5855de..7c8d1ff 100755 --- a/lxc/executors/java +++ b/lxc/executors/java @@ -3,4 +3,4 @@ cp code.code interim.java name=$(cat interim.java | grep -Eo 'public\s+class\s+([A-Za-z0-9]+)' | sed -n 's/ */ /gp' | cut -d' ' -f3) mv interim.java $name.java timeout -s KILL 10 javac $name.java -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 java $name" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java $name" diff --git a/lxc/executors/nasm b/lxc/executors/nasm index 7bdfe69..661db6c 100755 --- a/lxc/executors/nasm +++ b/lxc/executors/nasm @@ -1,4 +1,4 @@ cd /tmp/$2 timeout -s KILL 10 nasm -f elf64 -o binary.o code.code timeout -s KILL 10 ld binary.o -o binary -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ./binary" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/executors/node b/lxc/executors/node index 6682176..73c2f80 100755 --- a/lxc/executors/node +++ b/lxc/executors/node @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 nodejs code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 nodejs code.code" diff --git a/lxc/executors/php b/lxc/executors/php index 2e4753a..5731b85 100755 --- a/lxc/executors/php +++ b/lxc/executors/php @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 php code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 php code.code" diff --git a/lxc/executors/python2 b/lxc/executors/python2 index 06437ed..8ccb484 100755 --- a/lxc/executors/python2 +++ b/lxc/executors/python2 @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 python2 code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 python2 code.code" diff --git a/lxc/executors/python3 b/lxc/executors/python3 index a9c7950..ef5b036 100755 --- a/lxc/executors/python3 +++ b/lxc/executors/python3 @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 python3.6 code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 python3.6 code.code" diff --git a/lxc/executors/r b/lxc/executors/r index e50da72..b12ee07 100755 --- a/lxc/executors/r +++ b/lxc/executors/r @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 Rscript code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 Rscript code.code" diff --git a/lxc/executors/ruby b/lxc/executors/ruby index ff54c41..11b12b2 100755 --- a/lxc/executors/ruby +++ b/lxc/executors/ruby @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ruby code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ruby code.code" diff --git a/lxc/executors/rust b/lxc/executors/rust index b5be0b0..46533c7 100755 --- a/lxc/executors/rust +++ b/lxc/executors/rust @@ -1,3 +1,3 @@ cd /tmp/$2 timeout -s KILL 10 rustc -o binary code.code -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 ./binary" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/executors/swift b/lxc/executors/swift index d07183b..cf8e2e0 100755 --- a/lxc/executors/swift +++ b/lxc/executors/swift @@ -1,2 +1,2 @@ cd /tmp/$2 -runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs timeout -s KILL 3 swift code.code" +runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 swift code.code" diff --git a/readme.md b/readme.md index 1ee8a33..3b42b13 100644 --- a/readme.md +++ b/readme.md @@ -30,6 +30,7 @@ lxc-create -t download -n piston -- --dist ubuntu --release bionic --arch amd64 ./shell # install all necessary piston dependencies +export HOME=/opt echo 'export PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin' >> /root/.bashrc echo 'export PATH=$PATH:/root/.cargo/bin' >> /root/.bashrc sed -i \ @@ -40,14 +41,13 @@ apt-get -y install git tzdata nano \ dpkg-dev build-essential python python3 \ ruby nodejs golang php7.2 r-base mono-complete \ nasm openjdk-8-jdk ubuntu-make bf -mkdir -p /root/.local/share/umake/swift/swift-lang umake swift -ln -s /root/.local/share/umake/swift/swift-lang/usr/bin/swift /usr/bin/swift -curl https://sh.rustup.rs -sSf | sh -ln -s /root/.cargo/bin/rustc /usr/bin/rustc +ln -s /opt/.local/share/umake/swift/swift-lang/usr/bin/swift /usr/bin/swift +curl https://sh.rustup.rs > rust.sh +sh rust.sh -y +ln -s /opt/.cargo/bin/rustc /usr/bin/rustc rm -rf /home/ubuntu chmod 777 /tmp -chmod 777 -R /root # create runnable users and apply limits for i in {1..150}; do