diff --git a/api/src/bin/pistond.js b/api/src/bin/pistond.js index df22789..661767c 100755 --- a/api/src/bin/pistond.js +++ b/api/src/bin/pistond.js @@ -35,6 +35,7 @@ expressWs(app); } } }); + fss.chmodSync(path.join(config.data_directory, globals.data_directories.jobs), 0o711) logger.info('Loading packages'); diff --git a/api/src/job.js b/api/src/job.js index ab12402..d7e36b3 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -152,12 +152,17 @@ class Job { '--fsize=' + this.runtime.max_file_size, ]; + const timeout_call = [ + 'timeout', '-s', '9', Math.ceil(timeout / 1000), + ]; + if (memory_limit >= 0) { prlimit.push('--as=' + memory_limit); } const proc_call = [ 'nice', + ...timeout_call, ...prlimit, ...nonetwork, 'bash', @@ -362,13 +367,21 @@ class Job { const [_1, state, user_friendly] = state_line.split(/\s+/); - if (state == 'Z') - // Zombie process, just needs to be waited + const proc_id_int = parse_int(proc_id); + + // Skip over any processes that aren't ours. + if(ruid != this.uid && euid != this.uid) return -1; + + if (state == 'Z'){ + // Zombie process, just needs to be waited, regardless of the user id + if(!to_wait.includes(proc_id_int)) + to_wait.push(proc_id_int); + return -1; + } // We should kill in all other state (Sleep, Stopped & Running) - if (ruid == this.uid || euid == this.uid) - return parse_int(proc_id); + return proc_id_int; } catch { return -1; } diff --git a/cli/commands/execute.js b/cli/commands/execute.js index 0d906bc..ee468cf 100644 --- a/cli/commands/execute.js +++ b/cli/commands/execute.js @@ -246,11 +246,12 @@ async function run_non_interactively(files, argv) { exports.handler = async argv => { const files = [...(argv.files || []), argv.file].map(file_path => { const buffer = fs.readFileSync(file_path); + // Checks for � (the replacement character) after encoding the buffer to uf8 const encoding = (buffer .toString() .split('') - .some(x => x.charCodeAt(0) >= 128) && + .some(x => x.charCodeAt(0) === 65533) && 'base64') || 'utf8'; return { diff --git a/cli/package-lock.json b/cli/package-lock.json index 335ed21..3a73bbf 100644 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -19,9 +19,9 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { "node": ">=8" } @@ -116,9 +116,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz", - "integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==", + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", + "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==", "funding": [ { "type": "individual", @@ -316,9 +316,9 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "4.3.0", @@ -398,9 +398,9 @@ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, "follow-redirects": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz", - "integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==" + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz", + "integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==" }, "get-caller-file": { "version": "2.0.5", diff --git a/packages/emojicode/1.0.2/build.sh b/packages/emojicode/1.0.2/build.sh new file mode 100644 index 0000000..cf63d26 --- /dev/null +++ b/packages/emojicode/1.0.2/build.sh @@ -0,0 +1,15 @@ +curl -L https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -o emoji.tar.gz +tar xzf emoji.tar.gz + +mv Emojicode-1.0-beta.2-Linux-x86_64 emoji + +rm emoji.tar.gz + +cd emoji + +./install.sh + + +chmod +x emojicodec + +cd .. diff --git a/packages/emojicode/1.0.2/compile b/packages/emojicode/1.0.2/compile new file mode 100644 index 0000000..1ff67af --- /dev/null +++ b/packages/emojicode/1.0.2/compile @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +"$EMOJI_PATH"/emojicodec -S "$EMOJI_PATH"/packages "$1" -o "bruh.exe" +chmod +x "bruh.exe" diff --git a/packages/emojicode/1.0.2/environment b/packages/emojicode/1.0.2/environment new file mode 100644 index 0000000..4e32c1f --- /dev/null +++ b/packages/emojicode/1.0.2/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH +export EMOJI_PATH=$PWD/emoji diff --git a/packages/emojicode/1.0.2/metadata.json b/packages/emojicode/1.0.2/metadata.json new file mode 100644 index 0000000..6b2449a --- /dev/null +++ b/packages/emojicode/1.0.2/metadata.json @@ -0,0 +1,7 @@ +{ + "language": "emojicode", + "version": "1.0.2", + "aliases": [ + "emojic" + ] +} diff --git a/packages/emojicode/1.0.2/run b/packages/emojicode/1.0.2/run new file mode 100644 index 0000000..014c2c6 --- /dev/null +++ b/packages/emojicode/1.0.2/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +shift + +./"bruh.exe" "$@" diff --git a/packages/emojicode/1.0.2/test.emojic b/packages/emojicode/1.0.2/test.emojic new file mode 100644 index 0000000..f80f01b --- /dev/null +++ b/packages/emojicode/1.0.2/test.emojic @@ -0,0 +1,3 @@ +🏁 🍇 + 😀 🔤OK🔤❗️ +🍉 diff --git a/packages/forth/0.7.3/build.sh b/packages/forth/0.7.3/build.sh new file mode 100644 index 0000000..81c2182 --- /dev/null +++ b/packages/forth/0.7.3/build.sh @@ -0,0 +1,12 @@ +curl -L https://ftp.gnu.org/gnu/gforth/gforth-0.7.3.tar.gz -o forth.tar.gz +tar xzf forth.tar.gz +rm forth.tar.gz + +cd gforth-0.7.3/ +./BUILD-FROM-SCRATCH --host=x86_64 --build=x86_64 + +make +make install + +chmod +x ./gforth +cd .. diff --git a/packages/forth/0.7.3/environment b/packages/forth/0.7.3/environment new file mode 100644 index 0000000..10092be --- /dev/null +++ b/packages/forth/0.7.3/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH +export FORTH_PATH=$PWD/gforth-0.7.3 diff --git a/packages/forth/0.7.3/metadata.json b/packages/forth/0.7.3/metadata.json new file mode 100644 index 0000000..cd23825 --- /dev/null +++ b/packages/forth/0.7.3/metadata.json @@ -0,0 +1,7 @@ +{ + "language": "forth", + "version": "0.7.3", + "aliases": [ + "gforth" + ] +} diff --git a/packages/forth/0.7.3/run b/packages/forth/0.7.3/run new file mode 100644 index 0000000..5556ca3 --- /dev/null +++ b/packages/forth/0.7.3/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +$FORTH_PATH/gforth "$@" + diff --git a/packages/forth/0.7.3/test.forth b/packages/forth/0.7.3/test.forth new file mode 100644 index 0000000..c50ef0b --- /dev/null +++ b/packages/forth/0.7.3/test.forth @@ -0,0 +1 @@ +.( OK) bye diff --git a/packages/smalltalk/3.2.3/build.sh b/packages/smalltalk/3.2.3/build.sh new file mode 100644 index 0000000..5f2290e --- /dev/null +++ b/packages/smalltalk/3.2.3/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +curl -L https://ftp.gnu.org/gnu/smalltalk/smalltalk-3.2.3.tar.gz -o smalltalk-3.2.3.tar.gz +tar xzf smalltalk-3.2.3.tar.gz + +rm smalltalk-3.2.3.tar.gz + +cd smalltalk-3.2.3 + +./configure +rm libc.la + +make +make install + +chmod +x gst +cd .. diff --git a/packages/smalltalk/3.2.3/environment b/packages/smalltalk/3.2.3/environment new file mode 100644 index 0000000..df2907d --- /dev/null +++ b/packages/smalltalk/3.2.3/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH +export SMALLTALK_PATH=$PWD/smalltalk-3.2.3 diff --git a/packages/smalltalk/3.2.3/metadata.json b/packages/smalltalk/3.2.3/metadata.json new file mode 100644 index 0000000..accb078 --- /dev/null +++ b/packages/smalltalk/3.2.3/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "smalltalk", + "version": "3.2.3", + "aliases": ["st"] +} diff --git a/packages/smalltalk/3.2.3/run b/packages/smalltalk/3.2.3/run new file mode 100644 index 0000000..a1ac6fa --- /dev/null +++ b/packages/smalltalk/3.2.3/run @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +code_file=`pwd`/"$1" +shift + +cd $SMALLTALK_PATH +$SMALLTALK_PATH/gst "$code_file" -a "$@" + diff --git a/packages/smalltalk/3.2.3/test.st b/packages/smalltalk/3.2.3/test.st new file mode 100644 index 0000000..d7b2d24 --- /dev/null +++ b/packages/smalltalk/3.2.3/test.st @@ -0,0 +1 @@ +'OK' display diff --git a/packages/sqlite3/3.36.0/run b/packages/sqlite3/3.36.0/run new file mode 100644 index 0000000..3aff0c1 --- /dev/null +++ b/packages/sqlite3/3.36.0/run @@ -0,0 +1,19 @@ +#!/bin/bash + +code=`cat "$1"` + +shift + +argv_text="" + +for arg in "$@" +do + argv_text+='insert into argv (arg) values ("'"`echo "$arg" | sed 's/"/""/g'`"'"); +' +done + + +sqlite3 <<< "create table argv (arg text); +$argv_text +$code" + diff --git a/readme.md b/readme.md index a8e16a9..3f49dc6 100644 --- a/readme.md +++ b/readme.md @@ -71,6 +71,7 @@ The following are approved and endorsed extensions/utilities to the core Piston - [Pyston](https://github.com/ffaanngg/pyston), a Python wrapper for accessing the Piston API. - [Go-Piston](https://github.com/milindmadhukar/go-piston), a Golang wrapper for accessing the Piston API. - [piston_rs](https://github.com/Jonxslays/piston_rs), a Rust wrapper for accessing the Piston API. +- [piston_rspy](https://github.com/Jonxslays/piston_rspy), Python bindings for accessing the Piston API via `piston_rs`.
@@ -327,6 +328,7 @@ Content-Type: application/json `dragon`, `elixir`, `emacs`, +`emojicode`, `erlang`, `file`, `forte`, @@ -378,6 +380,7 @@ Content-Type: application/json `ruby`, `rust`, `scala`, +`smalltalk`, `sqlite3`, `swift`, `typescript`,