From 3f8ef8f524972ef9f9af93e16309cfd2b5fa628f Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 7 Dec 2022 23:54:00 -0800 Subject: [PATCH 01/59] Add support for samarium (#1) * pkg(samarium-0.3.1): added samarium * fix: use pip3 * fix: set version explicitly --- packages/samarium/0.3.1/build.sh | 3 +++ packages/samarium/0.3.1/environment | 2 ++ packages/samarium/0.3.1/metadata.json | 5 +++++ packages/samarium/0.3.1/run | 1 + packages/samarium/0.3.1/test.sm | 3 +++ readme.md | 1 + 6 files changed, 15 insertions(+) create mode 100755 packages/samarium/0.3.1/build.sh create mode 100644 packages/samarium/0.3.1/environment create mode 100644 packages/samarium/0.3.1/metadata.json create mode 100644 packages/samarium/0.3.1/run create mode 100644 packages/samarium/0.3.1/test.sm diff --git a/packages/samarium/0.3.1/build.sh b/packages/samarium/0.3.1/build.sh new file mode 100755 index 0000000..84bf62a --- /dev/null +++ b/packages/samarium/0.3.1/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source ../../python/3.10.0/build.sh +python3 -m pip3 install samarium==0.3.1 diff --git a/packages/samarium/0.3.1/environment b/packages/samarium/0.3.1/environment new file mode 100644 index 0000000..b482830 --- /dev/null +++ b/packages/samarium/0.3.1/environment @@ -0,0 +1,2 @@ +#!/bin/bash +export PATH=$PWD/bin:$PATH diff --git a/packages/samarium/0.3.1/metadata.json b/packages/samarium/0.3.1/metadata.json new file mode 100644 index 0000000..9f3b810 --- /dev/null +++ b/packages/samarium/0.3.1/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "samarium", + "version": "0.3.1", + "aliases": ["sm"] +} diff --git a/packages/samarium/0.3.1/run b/packages/samarium/0.3.1/run new file mode 100644 index 0000000..d65533d --- /dev/null +++ b/packages/samarium/0.3.1/run @@ -0,0 +1 @@ +python3 -m samarium $1 diff --git a/packages/samarium/0.3.1/test.sm b/packages/samarium/0.3.1/test.sm new file mode 100644 index 0000000..57d4d5c --- /dev/null +++ b/packages/samarium/0.3.1/test.sm @@ -0,0 +1,3 @@ +=> * { + "OK"!; +} diff --git a/readme.md b/readme.md index 1135e90..7ef99b5 100644 --- a/readme.md +++ b/readme.md @@ -380,6 +380,7 @@ Content-Type: application/json `rscript`, `ruby`, `rust`, +`samarium`, `scala`, `smalltalk`, `sqlite3`, From 081ed1bac112521422fccb6b700b1ede2f14c711 Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Thu, 8 Dec 2022 00:04:32 -0800 Subject: [PATCH 02/59] pip3 -> pip --- packages/samarium/0.3.1/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/samarium/0.3.1/build.sh b/packages/samarium/0.3.1/build.sh index 84bf62a..cf666a9 100755 --- a/packages/samarium/0.3.1/build.sh +++ b/packages/samarium/0.3.1/build.sh @@ -1,3 +1,3 @@ #!/bin/bash source ../../python/3.10.0/build.sh -python3 -m pip3 install samarium==0.3.1 +python3 -m pip install samarium==0.3.1 From 5ae85c383f9c7e0ed4b843b2bb95fefe376110a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Dec 2022 22:59:05 +0000 Subject: [PATCH 03/59] build(deps): bump express from 4.17.1 to 4.17.3 in /api Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.17.3. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](https://github.com/expressjs/express/compare/4.17.1...4.17.3) --- updated-dependencies: - dependency-name: express dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- api/package-lock.json | 395 ++++++++++++++++++++++-------------------- api/package.json | 2 +- 2 files changed, 207 insertions(+), 190 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index 2b34fc4..549e28f 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "body-parser": "^1.19.0", "chownr": "^2.0.0", - "express": "^4.17.1", + "express": "^4.17.3", "express-ws": "^5.0.2", "is-docker": "^2.1.1", "logplease": "^1.2.15", @@ -23,12 +23,12 @@ } }, "node_modules/accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" @@ -40,29 +40,29 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, "node_modules/body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==", "dependencies": { - "bytes": "3.1.0", + "bytes": "3.1.2", "content-type": "~1.0.4", "debug": "2.6.9", "depd": "~1.1.2", - "http-errors": "1.7.2", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" + "qs": "6.9.7", + "raw-body": "2.4.3", + "type-is": "~1.6.18" }, "engines": { "node": ">= 0.8" } }, "node_modules/bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "engines": { "node": ">= 0.8" } @@ -76,11 +76,11 @@ } }, "node_modules/content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dependencies": { - "safe-buffer": "5.1.2" + "safe-buffer": "5.2.1" }, "engines": { "node": ">= 0.6" @@ -95,9 +95,9 @@ } }, "node_modules/cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", "engines": { "node": ">= 0.6" } @@ -126,7 +126,7 @@ "node_modules/destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "integrity": "sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==" }, "node_modules/ee-first": { "version": "1.1.1", @@ -149,22 +149,22 @@ "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", "engines": { "node": ">= 0.6" } }, "node_modules/express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "version": "4.17.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.3.tgz", + "integrity": "sha512-yuSQpz5I+Ch7gFrPCk4/c+dIBKlQUxtgwqzph132bsT6qhuzss6I8cLJQz7B3rFblzd6wtcI0ZbGltH/C4LjUg==", "dependencies": { - "accepts": "~1.3.7", + "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", + "body-parser": "1.19.2", + "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.0", + "cookie": "0.4.2", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", @@ -178,13 +178,13 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", + "proxy-addr": "~2.0.7", + "qs": "6.9.7", "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", @@ -226,9 +226,9 @@ } }, "node_modules/forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", "engines": { "node": ">= 0.6" } @@ -236,21 +236,21 @@ "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "engines": { "node": ">= 0.6" } }, "node_modules/http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "dependencies": { "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" }, "engines": { "node": ">= 0.6" @@ -268,9 +268,9 @@ } }, "node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/ipaddr.js": { "version": "1.9.1", @@ -340,19 +340,19 @@ } }, "node_modules/mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "mime-db": "1.46.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" @@ -364,9 +364,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "engines": { "node": ">= 0.6" } @@ -407,11 +407,11 @@ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "node_modules/proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "dependencies": { - "forwarded": "~0.1.2", + "forwarded": "0.2.0", "ipaddr.js": "1.9.1" }, "engines": { @@ -419,11 +419,14 @@ } }, "node_modules/qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==", "engines": { "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/range-parser": { @@ -435,12 +438,12 @@ } }, "node_modules/raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz", + "integrity": "sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==", "dependencies": { - "bytes": "3.1.0", - "http-errors": "1.7.2", + "bytes": "3.1.2", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, @@ -449,9 +452,23 @@ } }, "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/safer-buffer": { "version": "2.1.2", @@ -473,9 +490,9 @@ } }, "node_modules/send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "dependencies": { "debug": "2.6.9", "depd": "~1.1.2", @@ -484,9 +501,9 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" @@ -496,28 +513,28 @@ } }, "node_modules/send/node_modules/ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, "node_modules/statuses": { "version": "1.5.0", @@ -528,9 +545,9 @@ } }, "node_modules/toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "engines": { "node": ">=0.6" } @@ -611,12 +628,12 @@ }, "dependencies": { "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" } }, "array-flatten": { @@ -625,26 +642,26 @@ "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==", "requires": { - "bytes": "3.1.0", + "bytes": "3.1.2", "content-type": "~1.0.4", "debug": "2.6.9", "depd": "~1.1.2", - "http-errors": "1.7.2", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" + "qs": "6.9.7", + "raw-body": "2.4.3", + "type-is": "~1.6.18" } }, "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" }, "chownr": { "version": "2.0.0", @@ -652,11 +669,11 @@ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" }, "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "5.2.1" } }, "content-type": { @@ -665,9 +682,9 @@ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" }, "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" }, "cookie-signature": { "version": "1.0.6", @@ -690,7 +707,7 @@ "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "integrity": "sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==" }, "ee-first": { "version": "1.1.1", @@ -710,19 +727,19 @@ "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" }, "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "version": "4.17.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.3.tgz", + "integrity": "sha512-yuSQpz5I+Ch7gFrPCk4/c+dIBKlQUxtgwqzph132bsT6qhuzss6I8cLJQz7B3rFblzd6wtcI0ZbGltH/C4LjUg==", "requires": { - "accepts": "~1.3.7", + "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", + "body-parser": "1.19.2", + "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.0", + "cookie": "0.4.2", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "~1.1.2", @@ -736,13 +753,13 @@ "on-finished": "~2.3.0", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", + "proxy-addr": "~2.0.7", + "qs": "6.9.7", "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", "statuses": "~1.5.0", "type-is": "~1.6.18", "utils-merge": "1.0.1", @@ -772,25 +789,25 @@ } }, "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" }, "fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" }, "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", "requires": { "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "toidentifier": "1.0.1" } }, "iconv-lite": { @@ -802,9 +819,9 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ipaddr.js": { "version": "1.9.1", @@ -850,16 +867,16 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==" + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" }, "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "requires": { - "mime-db": "1.46.0" + "mime-db": "1.52.0" } }, "ms": { @@ -868,9 +885,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, "nocamel": { "version": "git+ssh://git@github.com/HexF/nocamel.git#89a5bfbbd07c72c302d968b967d0f4fe54846544", @@ -900,18 +917,18 @@ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "proxy-addr": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", - "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", "requires": { - "forwarded": "~0.1.2", + "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==" }, "range-parser": { "version": "1.2.1", @@ -919,20 +936,20 @@ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz", + "integrity": "sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==", "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", + "bytes": "3.1.2", + "http-errors": "1.8.1", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "safer-buffer": { "version": "2.1.2", @@ -948,9 +965,9 @@ } }, "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", + "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", "requires": { "debug": "2.6.9", "depd": "~1.1.2", @@ -959,36 +976,36 @@ "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "~1.7.2", + "http-errors": "1.8.1", "mime": "1.6.0", - "ms": "2.1.1", + "ms": "2.1.3", "on-finished": "~2.3.0", "range-parser": "~1.2.1", "statuses": "~1.5.0" }, "dependencies": { "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", + "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.1" + "send": "0.17.2" } }, "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, "statuses": { "version": "1.5.0", @@ -996,9 +1013,9 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, "type-is": { "version": "1.6.18", diff --git a/api/package.json b/api/package.json index fb107a5..366ce9f 100644 --- a/api/package.json +++ b/api/package.json @@ -6,7 +6,7 @@ "dependencies": { "body-parser": "^1.19.0", "chownr": "^2.0.0", - "express": "^4.17.1", + "express": "^4.17.3", "express-ws": "^5.0.2", "is-docker": "^2.1.1", "logplease": "^1.2.15", From e9426d6c03cbd8e7d1fb8cc8d1b8ec25e85abd66 Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Wed, 14 Dec 2022 17:42:55 -0800 Subject: [PATCH 04/59] fix: pip install from github --- packages/samarium/0.3.1/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/samarium/0.3.1/build.sh b/packages/samarium/0.3.1/build.sh index cf666a9..ca0240c 100755 --- a/packages/samarium/0.3.1/build.sh +++ b/packages/samarium/0.3.1/build.sh @@ -1,3 +1,3 @@ #!/bin/bash source ../../python/3.10.0/build.sh -python3 -m pip install samarium==0.3.1 +python3 -m pip install https://github.com/samarium-lang/Samarium/archive/refs/tags/0.3.1.zip From 9de88e2f6c5ac9356dec099bf6ac260152814c04 Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Sun, 18 Dec 2022 20:47:44 -0800 Subject: [PATCH 05/59] fix: install samarium from `python3.10` --- packages/samarium/0.3.1/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/samarium/0.3.1/build.sh b/packages/samarium/0.3.1/build.sh index ca0240c..7e2866a 100755 --- a/packages/samarium/0.3.1/build.sh +++ b/packages/samarium/0.3.1/build.sh @@ -1,3 +1,3 @@ #!/bin/bash source ../../python/3.10.0/build.sh -python3 -m pip install https://github.com/samarium-lang/Samarium/archive/refs/tags/0.3.1.zip +python3.10 -m pip install https://github.com/samarium-lang/Samarium/archive/refs/tags/0.3.1.zip From e86c19b0070ce2971a42fab9c300461769ede4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Barbi=C4=87?= Date: Wed, 11 Jan 2023 18:59:29 +0100 Subject: [PATCH 06/59] return 200 and piston ver on /, fix empty content-type header validation --- api/package.json | 2 +- api/src/api/v2.js | 2 +- api/src/index.js | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/package.json b/api/package.json index 366ce9f..0b91c01 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "piston-api", - "version": "3.1.0", + "version": "3.1.1", "description": "API for piston - a high performance code execution engine", "main": "src/index.js", "dependencies": { diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 4f0c3e2..38b7c85 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -163,7 +163,7 @@ router.use((req, res, next) => { return next(); } - if (!req.headers['content-type'].startsWith('application/json')) { + if (!req.headers['content-type']?.startsWith('application/json')) { return res.status(415).send({ message: 'requests must be of type application/json', }); diff --git a/api/src/index.js b/api/src/index.js index 2870902..8a21e57 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -79,6 +79,12 @@ expressWs(app); const api_v2 = require('./api/v2'); app.use('/api/v2', api_v2); + const { version } = require('../package.json'); + + app.get('/', (req, res, next) => { + return res.status(200).send({ message: `Piston v${version}` }); + }); + app.use((req, res, next) => { return res.status(404).send({ message: 'Not Found' }); }); From cbc4db7ada444d529ea6a9a2116d11e4a2d5786b Mon Sep 17 00:00:00 2001 From: Endercheif <45527309+Endercheif@users.noreply.github.com> Date: Sun, 5 Feb 2023 18:56:59 -0800 Subject: [PATCH 07/59] fix: installing samarium with pip --- packages/samarium/0.3.1/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/samarium/0.3.1/build.sh b/packages/samarium/0.3.1/build.sh index 7e2866a..b0f6ea0 100755 --- a/packages/samarium/0.3.1/build.sh +++ b/packages/samarium/0.3.1/build.sh @@ -1,3 +1,3 @@ #!/bin/bash source ../../python/3.10.0/build.sh -python3.10 -m pip install https://github.com/samarium-lang/Samarium/archive/refs/tags/0.3.1.zip +bin/pip3 install https://github.com/samarium-lang/Samarium/archive/refs/tags/0.3.1.zip From 32012483a30667e96296b14b5b9829715d0ef2a6 Mon Sep 17 00:00:00 2001 From: materemias Date: Fri, 17 Feb 2023 15:17:00 +0100 Subject: [PATCH 08/59] disable output coloring of deno --- packages/deno/1.16.2/run | 2 +- packages/deno/1.7.5/run | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/deno/1.16.2/run b/packages/deno/1.16.2/run index 288919f..530181f 100644 --- a/packages/deno/1.16.2/run +++ b/packages/deno/1.16.2/run @@ -1,3 +1,3 @@ #!/bin/bash -DENO_DIR=$PWD deno run $@ +DENO_DIR=$PWD NO_COLOR=true deno run $@ diff --git a/packages/deno/1.7.5/run b/packages/deno/1.7.5/run index d1b196f..fbbe106 100644 --- a/packages/deno/1.7.5/run +++ b/packages/deno/1.7.5/run @@ -1,2 +1,2 @@ #!/bin/bash -DENO_DIR=$PWD deno run "$@" \ No newline at end of file +DENO_DIR=$PWD NO_COLOR=true deno run "$@" \ No newline at end of file From 2a5e6a5012a5e2aad0b834f186f7d47556c8222d Mon Sep 17 00:00:00 2001 From: e-sp Date: Mon, 27 Feb 2023 23:54:52 +0100 Subject: [PATCH 09/59] bin(piston): Fix ./piston list-pkgs --- piston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piston b/piston index fd83727..b67f44d 100755 --- a/piston +++ b/piston @@ -78,7 +78,7 @@ case $1 in clean-pkgs) git clean -fqXd packages ;; clean-repo) git clean -fqXd repo ;; - list-pkgs) find packages -depth 2 | awk -F/ '$2 && $3{ print $2 "-" $3 }' | column ;; + list-pkgs) find packages -maxdepth 2 | awk -F/ '$2 && $3{ print $2 "-" $3 }' | column ;; build-pkg) PKGSLUG="$2-$3" From 4fcb2758920bf3df41dd49e611eeab2f72e125c0 Mon Sep 17 00:00:00 2001 From: Mohammed Keyvanzadeh Date: Sun, 2 Apr 2023 11:43:19 +0330 Subject: [PATCH 10/59] chore(actions): update GitHub workflow actions Update the actions in the GitHub Actions workflows to their latest versions. --- .github/workflows/api-push.yaml | 8 ++++---- .github/workflows/package-pr.yaml | 14 +++++++------- .github/workflows/package-push.yaml | 4 ++-- .github/workflows/repo-push.yaml | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/api-push.yaml b/.github/workflows/api-push.yaml index dec3bce..782554d 100644 --- a/.github/workflows/api-push.yaml +++ b/.github/workflows/api-push.yaml @@ -13,22 +13,22 @@ jobs: name: Build and Push Docker image to Github Packages steps: - name: Check out repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to GitHub registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: docker.pkg.github.com - name: Login to ghcr.io - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - name: Build and push API - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: context: api push: true diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index d5bfe78..7a550f2 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Get list of changed files uses: lots0logs/gh-action-get-changed-files@2.1.4 with: @@ -36,10 +36,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to GitHub registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -60,7 +60,7 @@ jobs: ls -la packages - name: Upload package as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: packages path: packages/*.pkg.tar.gz @@ -70,9 +70,9 @@ jobs: runs-on: ubuntu-latest needs: build-pkg steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: packages @@ -80,7 +80,7 @@ jobs: run: mv *.pkg.tar.gz packages/ - name: Login to GitHub registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/package-push.yaml b/.github/workflows/package-push.yaml index 9de6051..5dd30dc 100644 --- a/.github/workflows/package-push.yaml +++ b/.github/workflows/package-push.yaml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to GitHub registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/repo-push.yaml b/.github/workflows/repo-push.yaml index c887b01..107edfd 100644 --- a/.github/workflows/repo-push.yaml +++ b/.github/workflows/repo-push.yaml @@ -13,16 +13,16 @@ jobs: name: Build and Push Docker image to Github Packages steps: - name: Check out repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Login to GitHub registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: docker.pkg.github.com - name: Build and push repo - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: context: repo pull: true From ce36d4b0d07a418f3db48b2097b63ade9e8d6a3a Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Tue, 4 Apr 2023 07:07:16 +0200 Subject: [PATCH 11/59] Updated to `Node 18.15.0 LTS` --- packages/node/18.15.0/build.sh | 4 ++++ packages/node/18.15.0/environment | 1 + packages/node/18.15.0/metadata.json | 10 ++++++++++ packages/node/18.15.0/run | 3 +++ packages/node/18.15.0/test.js | 1 + 5 files changed, 19 insertions(+) create mode 100644 packages/node/18.15.0/build.sh create mode 100644 packages/node/18.15.0/environment create mode 100644 packages/node/18.15.0/metadata.json create mode 100644 packages/node/18.15.0/run create mode 100644 packages/node/18.15.0/test.js diff --git a/packages/node/18.15.0/build.sh b/packages/node/18.15.0/build.sh new file mode 100644 index 0000000..c347fe3 --- /dev/null +++ b/packages/node/18.15.0/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz" -o node.tar.xz +tar xf node.tar.xz --strip-components=1 +rm node.tar.xz \ No newline at end of file diff --git a/packages/node/18.15.0/environment b/packages/node/18.15.0/environment new file mode 100644 index 0000000..bd0ff98 --- /dev/null +++ b/packages/node/18.15.0/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/node/18.15.0/metadata.json b/packages/node/18.15.0/metadata.json new file mode 100644 index 0000000..381b3df --- /dev/null +++ b/packages/node/18.15.0/metadata.json @@ -0,0 +1,10 @@ +{ + "language": "node", + "version": "18.15.0", + "provides": [ + { + "language": "javascript", + "aliases": ["node-javascript", "node-js", "javascript", "js"] + } + ] +} \ No newline at end of file diff --git a/packages/node/18.15.0/run b/packages/node/18.15.0/run new file mode 100644 index 0000000..1c06140 --- /dev/null +++ b/packages/node/18.15.0/run @@ -0,0 +1,3 @@ +#!/bin/bash + +node "$@" \ No newline at end of file diff --git a/packages/node/18.15.0/test.js b/packages/node/18.15.0/test.js new file mode 100644 index 0000000..c963843 --- /dev/null +++ b/packages/node/18.15.0/test.js @@ -0,0 +1 @@ +console.log('OK'); \ No newline at end of file From 46a9478e6cba6ad12f1126770a488ab10216e2c6 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Tue, 4 Apr 2023 14:04:49 +0200 Subject: [PATCH 12/59] Changed newline from CRLF to LF --- packages/node/18.15.0/build.sh | 6 +++--- packages/node/18.15.0/metadata.json | 18 +++++++++--------- packages/node/18.15.0/run | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/node/18.15.0/build.sh b/packages/node/18.15.0/build.sh index c347fe3..08da779 100644 --- a/packages/node/18.15.0/build.sh +++ b/packages/node/18.15.0/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -curl "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz" -o node.tar.xz -tar xf node.tar.xz --strip-components=1 +#!/bin/bash +curl "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz" -o node.tar.xz +tar xf node.tar.xz --strip-components=1 rm node.tar.xz \ No newline at end of file diff --git a/packages/node/18.15.0/metadata.json b/packages/node/18.15.0/metadata.json index 381b3df..7dcc24d 100644 --- a/packages/node/18.15.0/metadata.json +++ b/packages/node/18.15.0/metadata.json @@ -1,10 +1,10 @@ -{ - "language": "node", - "version": "18.15.0", - "provides": [ - { - "language": "javascript", - "aliases": ["node-javascript", "node-js", "javascript", "js"] - } - ] +{ + "language": "node", + "version": "18.15.0", + "provides": [ + { + "language": "javascript", + "aliases": ["node-javascript", "node-js", "javascript", "js"] + } + ] } \ No newline at end of file diff --git a/packages/node/18.15.0/run b/packages/node/18.15.0/run index 1c06140..6d1fdee 100644 --- a/packages/node/18.15.0/run +++ b/packages/node/18.15.0/run @@ -1,3 +1,3 @@ -#!/bin/bash - +#!/bin/bash + node "$@" \ No newline at end of file From 7bd4acb3469a121d38e65ffb596e72798c6da5d3 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Fri, 7 Apr 2023 09:50:19 +0200 Subject: [PATCH 13/59] Add files via upload --- packages/rust/1.68.2/build.sh | 5 +++++ packages/rust/1.68.2/compile | 6 ++++++ packages/rust/1.68.2/environment | 5 +++++ packages/rust/1.68.2/metadata.json | 7 +++++++ packages/rust/1.68.2/run | 4 ++++ packages/rust/1.68.2/test.rs | 3 +++ 6 files changed, 30 insertions(+) create mode 100644 packages/rust/1.68.2/build.sh create mode 100644 packages/rust/1.68.2/compile create mode 100644 packages/rust/1.68.2/environment create mode 100644 packages/rust/1.68.2/metadata.json create mode 100644 packages/rust/1.68.2/run create mode 100644 packages/rust/1.68.2/test.rs diff --git a/packages/rust/1.68.2/build.sh b/packages/rust/1.68.2/build.sh new file mode 100644 index 0000000..bfd853f --- /dev/null +++ b/packages/rust/1.68.2/build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +curl -OL "https://static.rust-lang.org/dist/rust-1.68.2-x86_64-unknown-linux-gnu.tar.gz" +tar xzvf rust-1.68.2-x86_64-unknown-linux-gnu.tar.gz +rm rust-1.68.2-x86_64-unknown-linux-gnu.tar.gz \ No newline at end of file diff --git a/packages/rust/1.68.2/compile b/packages/rust/1.68.2/compile new file mode 100644 index 0000000..c4b591a --- /dev/null +++ b/packages/rust/1.68.2/compile @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# https://stackoverflow.com/questions/38041331/rust-compiler-cant-find-crate-for-std +# Rust compiler needs to find the stdlib to link against +rustc -o binary -L ${RUST_INSTALL_LOC}/rustc/lib -L ${RUST_INSTALL_LOC}/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib "$@" +chmod +x binary \ No newline at end of file diff --git a/packages/rust/1.68.2/environment b/packages/rust/1.68.2/environment new file mode 100644 index 0000000..77e21a4 --- /dev/null +++ b/packages/rust/1.68.2/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/rust-1.68.2-x86_64-unknown-linux-gnu/rustc/bin/:$PATH +export RUST_INSTALL_LOC=$PWD/rust-1.68.2-x86_64-unknown-linux-gnu \ No newline at end of file diff --git a/packages/rust/1.68.2/metadata.json b/packages/rust/1.68.2/metadata.json new file mode 100644 index 0000000..e0cdb7c --- /dev/null +++ b/packages/rust/1.68.2/metadata.json @@ -0,0 +1,7 @@ +{ + "language": "rust", + "version": "1.68.2", + "aliases": [ + "rs" + ] +} \ No newline at end of file diff --git a/packages/rust/1.68.2/run b/packages/rust/1.68.2/run new file mode 100644 index 0000000..bb85070 --- /dev/null +++ b/packages/rust/1.68.2/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +shift +./binary "$@" \ No newline at end of file diff --git a/packages/rust/1.68.2/test.rs b/packages/rust/1.68.2/test.rs new file mode 100644 index 0000000..f5524c7 --- /dev/null +++ b/packages/rust/1.68.2/test.rs @@ -0,0 +1,3 @@ +fn main() { + println!("OK"); +} \ No newline at end of file From 624db9549426320f773fd067ae4d3e252245f3eb Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Fri, 7 Apr 2023 10:17:13 +0200 Subject: [PATCH 14/59] Add files via upload --- packages/deno/1.32.3/build.sh | 5 +++++ packages/deno/1.32.3/environment | 3 +++ packages/deno/1.32.3/metadata.json | 20 ++++++++++++++++++++ packages/deno/1.32.3/run | 3 +++ packages/deno/1.32.3/test.deno.ts | 1 + 5 files changed, 32 insertions(+) create mode 100644 packages/deno/1.32.3/build.sh create mode 100644 packages/deno/1.32.3/environment create mode 100644 packages/deno/1.32.3/metadata.json create mode 100644 packages/deno/1.32.3/run create mode 100644 packages/deno/1.32.3/test.deno.ts diff --git a/packages/deno/1.32.3/build.sh b/packages/deno/1.32.3/build.sh new file mode 100644 index 0000000..8cda9bc --- /dev/null +++ b/packages/deno/1.32.3/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +curl -OL https://github.com/denoland/deno/releases/download/v1.32.3/deno-x86_64-unknown-linux-gnu.zip +unzip -o deno-x86_64-unknown-linux-gnu.zip +rm deno-x86_64-unknown-linux-gnu.zip \ No newline at end of file diff --git a/packages/deno/1.32.3/environment b/packages/deno/1.32.3/environment new file mode 100644 index 0000000..0d5a1f7 --- /dev/null +++ b/packages/deno/1.32.3/environment @@ -0,0 +1,3 @@ +#!/bin/bash + +export PATH=$PWD:$PATH \ No newline at end of file diff --git a/packages/deno/1.32.3/metadata.json b/packages/deno/1.32.3/metadata.json new file mode 100644 index 0000000..2dc0a7c --- /dev/null +++ b/packages/deno/1.32.3/metadata.json @@ -0,0 +1,20 @@ +{ + "language": "deno", + "version": "1.32.3", + "dependencies": {}, + "provides": [ + { + "language": "typescript", + "aliases": [ + "deno", + "deno-ts" + ] + }, + { + "language": "javascript", + "aliases": [ + "deno-js" + ] + } + ] +} \ No newline at end of file diff --git a/packages/deno/1.32.3/run b/packages/deno/1.32.3/run new file mode 100644 index 0000000..5c9cfb6 --- /dev/null +++ b/packages/deno/1.32.3/run @@ -0,0 +1,3 @@ +#!/bin/bash + +DENO_DIR=$PWD NO_COLOR=true deno run $@ \ No newline at end of file diff --git a/packages/deno/1.32.3/test.deno.ts b/packages/deno/1.32.3/test.deno.ts new file mode 100644 index 0000000..56ed4a0 --- /dev/null +++ b/packages/deno/1.32.3/test.deno.ts @@ -0,0 +1 @@ +console.log("OK") \ No newline at end of file From dfd5368fe35e34de1c46552250df4fea8f643190 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:24:15 +0200 Subject: [PATCH 15/59] Updated to `Typescript 5.0.3` --- packages/typescript/5.0.3/build.sh | 7 +++++++ packages/typescript/5.0.3/compile | 7 +++++++ packages/typescript/5.0.3/environment | 4 ++++ packages/typescript/5.0.3/metadata.json | 5 +++++ packages/typescript/5.0.3/run | 8 ++++++++ packages/typescript/5.0.3/test.ts | 1 + 6 files changed, 32 insertions(+) create mode 100644 packages/typescript/5.0.3/build.sh create mode 100644 packages/typescript/5.0.3/compile create mode 100644 packages/typescript/5.0.3/environment create mode 100644 packages/typescript/5.0.3/metadata.json create mode 100644 packages/typescript/5.0.3/run create mode 100644 packages/typescript/5.0.3/test.ts diff --git a/packages/typescript/5.0.3/build.sh b/packages/typescript/5.0.3/build.sh new file mode 100644 index 0000000..c753c69 --- /dev/null +++ b/packages/typescript/5.0.3/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +source ../../node/18.15.0/build.sh + +source ./environment + +bin/npm install -g typescript@5.0.3 \ No newline at end of file diff --git a/packages/typescript/5.0.3/compile b/packages/typescript/5.0.3/compile new file mode 100644 index 0000000..d674bb0 --- /dev/null +++ b/packages/typescript/5.0.3/compile @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Put instructions to compile source code, remove this file if the language does not require this stage + +rename 's/$/\.ts/' "$@" # Add .ts extension + +tsc *.ts \ No newline at end of file diff --git a/packages/typescript/5.0.3/environment b/packages/typescript/5.0.3/environment new file mode 100644 index 0000000..c6ab089 --- /dev/null +++ b/packages/typescript/5.0.3/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/typescript/5.0.3/metadata.json b/packages/typescript/5.0.3/metadata.json new file mode 100644 index 0000000..912e308 --- /dev/null +++ b/packages/typescript/5.0.3/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "typescript", + "version": "4.2.3", + "aliases": ["ts", "node-ts", "tsc", "typescript5", "ts5"] +} \ No newline at end of file diff --git a/packages/typescript/5.0.3/run b/packages/typescript/5.0.3/run new file mode 100644 index 0000000..4ce91c5 --- /dev/null +++ b/packages/typescript/5.0.3/run @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime + +CODE=$1.js +shift + +node $CODE "$@" \ No newline at end of file diff --git a/packages/typescript/5.0.3/test.ts b/packages/typescript/5.0.3/test.ts new file mode 100644 index 0000000..c963843 --- /dev/null +++ b/packages/typescript/5.0.3/test.ts @@ -0,0 +1 @@ +console.log('OK'); \ No newline at end of file From 2c7073310e75e420e13efc838a28f2193f352a4a Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:32:48 +0200 Subject: [PATCH 16/59] Changed metadata ts version --- packages/typescript/5.0.3/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript/5.0.3/metadata.json b/packages/typescript/5.0.3/metadata.json index 912e308..0a57acf 100644 --- a/packages/typescript/5.0.3/metadata.json +++ b/packages/typescript/5.0.3/metadata.json @@ -1,5 +1,5 @@ { "language": "typescript", - "version": "4.2.3", + "version": "5.0.3", "aliases": ["ts", "node-ts", "tsc", "typescript5", "ts5"] } \ No newline at end of file From 91d4d402de94b05fc30fe3262a2a19eebe8cda7b Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Fri, 7 Apr 2023 19:40:10 +0200 Subject: [PATCH 17/59] Updated to `PHP 8.2.3` --- packages/php/8.2.3/build.sh | 20 ++++++++++++++++++++ packages/php/8.2.3/environment | 1 + packages/php/8.2.3/metadata.json | 5 +++++ packages/php/8.2.3/run | 3 +++ packages/php/8.2.3/test.php | 1 + 5 files changed, 30 insertions(+) create mode 100644 packages/php/8.2.3/build.sh create mode 100644 packages/php/8.2.3/environment create mode 100644 packages/php/8.2.3/metadata.json create mode 100644 packages/php/8.2.3/run create mode 100644 packages/php/8.2.3/test.php diff --git a/packages/php/8.2.3/build.sh b/packages/php/8.2.3/build.sh new file mode 100644 index 0000000..ee85017 --- /dev/null +++ b/packages/php/8.2.3/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build/php +cd build + +curl "https://www.php.net/distributions/php-8.2.3.tar.gz" -o php.tar.gz +tar xzf php.tar.gz --strip-components=1 -C php + +cd php + + +./configure --prefix "$PREFIX" + +make -j$(nproc) +make install -j$(nproc) + +cd ../../ +rm -rf build \ No newline at end of file diff --git a/packages/php/8.2.3/environment b/packages/php/8.2.3/environment new file mode 100644 index 0000000..bd0ff98 --- /dev/null +++ b/packages/php/8.2.3/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/php/8.2.3/metadata.json b/packages/php/8.2.3/metadata.json new file mode 100644 index 0000000..5f256e0 --- /dev/null +++ b/packages/php/8.2.3/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "php", + "version": "8.2.3", + "aliases": [] +} \ No newline at end of file diff --git a/packages/php/8.2.3/run b/packages/php/8.2.3/run new file mode 100644 index 0000000..1261d95 --- /dev/null +++ b/packages/php/8.2.3/run @@ -0,0 +1,3 @@ +#!/bin/bash + +php "$@" \ No newline at end of file diff --git a/packages/php/8.2.3/test.php b/packages/php/8.2.3/test.php new file mode 100644 index 0000000..a0aba93 --- /dev/null +++ b/packages/php/8.2.3/test.php @@ -0,0 +1 @@ +OK \ No newline at end of file From 2ae73c5daea80f15b3a7ba8a9156c3a55eb751c0 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:03:57 +0200 Subject: [PATCH 18/59] Updated `Mono 6.12.0 build.sh` --- packages/mono/6.12.0/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mono/6.12.0/build.sh b/packages/mono/6.12.0/build.sh index 7bb4b63..d74fca6 100755 --- a/packages/mono/6.12.0/build.sh +++ b/packages/mono/6.12.0/build.sh @@ -5,7 +5,7 @@ PREFIX=$(realpath $(dirname $0)) mkdir -p build/mono build/mono-basic cd build -curl "https://download.mono-project.com/sources/mono/mono-6.12.0.122.tar.xz" -o mono.tar.xz +curl "https://download.mono-project.com/sources/mono/mono-6.12.0.182.tar.xz" -o mono.tar.xz curl -L "https://github.com/mono/mono-basic/archive/refs/tags/4.7.tar.gz" -o mono-basic.tar.gz tar xf mono.tar.xz --strip-components=1 -C mono tar xf mono-basic.tar.gz --strip-components=1 -C mono-basic From 314a96a8d4d2e816362649f761747abce30d0c7f Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:52:41 +0200 Subject: [PATCH 19/59] Updated to `Bash 5.2.0` --- packages/bash/5.2.0/build.sh | 20 ++++++++++++++++++++ packages/bash/5.2.0/environment | 4 ++++ packages/bash/5.2.0/metadata.json | 5 +++++ packages/bash/5.2.0/run | 4 ++++ packages/bash/5.2.0/test.bash.sh | 1 + 5 files changed, 34 insertions(+) create mode 100644 packages/bash/5.2.0/build.sh create mode 100644 packages/bash/5.2.0/environment create mode 100644 packages/bash/5.2.0/metadata.json create mode 100644 packages/bash/5.2.0/run create mode 100644 packages/bash/5.2.0/test.bash.sh diff --git a/packages/bash/5.2.0/build.sh b/packages/bash/5.2.0/build.sh new file mode 100644 index 0000000..bddce57 --- /dev/null +++ b/packages/bash/5.2.0/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Put instructions to build your package in here +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl "https://ftp.gnu.org/gnu/bash/bash-5.2.tar.gz" -o bash.tar.gz + +tar xzf bash.tar.gz --strip-components=1 + +# === autoconf based === +./configure --prefix "$PREFIX" + +make -j$(nproc) +make install -j$(nproc) +cd ../ +rm -rf build \ No newline at end of file diff --git a/packages/bash/5.2.0/environment b/packages/bash/5.2.0/environment new file mode 100644 index 0000000..c6ab089 --- /dev/null +++ b/packages/bash/5.2.0/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/bash/5.2.0/metadata.json b/packages/bash/5.2.0/metadata.json new file mode 100644 index 0000000..5082f8c --- /dev/null +++ b/packages/bash/5.2.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "bash", + "version": "5.2.0", + "aliases": ["sh"] +} \ No newline at end of file diff --git a/packages/bash/5.2.0/run b/packages/bash/5.2.0/run new file mode 100644 index 0000000..d20b2ba --- /dev/null +++ b/packages/bash/5.2.0/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +bash "$@" \ No newline at end of file diff --git a/packages/bash/5.2.0/test.bash.sh b/packages/bash/5.2.0/test.bash.sh new file mode 100644 index 0000000..727518f --- /dev/null +++ b/packages/bash/5.2.0/test.bash.sh @@ -0,0 +1 @@ +echo "OK" \ No newline at end of file From 6524db168fa3da1a7a0c9d3e91b9297d2ca578c8 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:05:11 +0200 Subject: [PATCH 20/59] Updated to `Julia 1.8.5` --- packages/julia/1.8.5/build.sh | 21 +++++++++++++++++++++ packages/julia/1.8.5/environment | 4 ++++ packages/julia/1.8.5/metadata.json | 5 +++++ packages/julia/1.8.5/run | 4 ++++ packages/julia/1.8.5/test.jl | 1 + 5 files changed, 35 insertions(+) create mode 100644 packages/julia/1.8.5/build.sh create mode 100644 packages/julia/1.8.5/environment create mode 100644 packages/julia/1.8.5/metadata.json create mode 100644 packages/julia/1.8.5/run create mode 100644 packages/julia/1.8.5/test.jl diff --git a/packages/julia/1.8.5/build.sh b/packages/julia/1.8.5/build.sh new file mode 100644 index 0000000..752d902 --- /dev/null +++ b/packages/julia/1.8.5/build.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Install location +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build +cd build + +# Download and extract Julia source +curl -L "https://github.com/JuliaLang/julia/releases/download/v1.8.5/julia-1.8.5.tar.gz" -o julia.tar.gz +tar xzf julia.tar.gz --strip-components=1 + +# Build +echo "JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1) +prefix=$PREFIX" > Make.user +make -j$(nproc) +make install -j$(nproc) + +# Cleanup +cd .. +rm -rf build \ No newline at end of file diff --git a/packages/julia/1.8.5/environment b/packages/julia/1.8.5/environment new file mode 100644 index 0000000..7eadd1a --- /dev/null +++ b/packages/julia/1.8.5/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Add Julia binary to path +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/julia/1.8.5/metadata.json b/packages/julia/1.8.5/metadata.json new file mode 100644 index 0000000..5c6fd40 --- /dev/null +++ b/packages/julia/1.8.5/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "julia", + "version": "1.8.5", + "aliases": ["jl"] +} \ No newline at end of file diff --git a/packages/julia/1.8.5/run b/packages/julia/1.8.5/run new file mode 100644 index 0000000..a803c0a --- /dev/null +++ b/packages/julia/1.8.5/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Run without startup or history file +julia --startup-file=no --history-file=no "$@" \ No newline at end of file diff --git a/packages/julia/1.8.5/test.jl b/packages/julia/1.8.5/test.jl new file mode 100644 index 0000000..450f23e --- /dev/null +++ b/packages/julia/1.8.5/test.jl @@ -0,0 +1 @@ +println("OK") \ No newline at end of file From b65c5f84dfe6be7a69aee455d1259b0fa64299a6 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 11:58:48 +0200 Subject: [PATCH 21/59] Updated to `Lua 5.4.4` --- packages/lua/5.4.4/build.sh | 14 ++++++++++++++ packages/lua/5.4.4/environment | 4 ++++ packages/lua/5.4.4/metadata.json | 5 +++++ packages/lua/5.4.4/run | 4 ++++ packages/lua/5.4.4/test.lua | 1 + 5 files changed, 28 insertions(+) create mode 100644 packages/lua/5.4.4/build.sh create mode 100644 packages/lua/5.4.4/environment create mode 100644 packages/lua/5.4.4/metadata.json create mode 100644 packages/lua/5.4.4/run create mode 100644 packages/lua/5.4.4/test.lua diff --git a/packages/lua/5.4.4/build.sh b/packages/lua/5.4.4/build.sh new file mode 100644 index 0000000..979fefe --- /dev/null +++ b/packages/lua/5.4.4/build.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Put instructions to build your package in here +curl -R -O -L http://www.lua.org/ftp/lua-5.4.4.tar.gz +tar zxf lua-5.4.4.tar.gz +rm lua-5.4.4.tar.gz + +cd lua-5.4.4 +# Building Lua +make linux +# To check that Lua has been built correctly +make test +# Installing Lua +make linux install \ No newline at end of file diff --git a/packages/lua/5.4.4/environment b/packages/lua/5.4.4/environment new file mode 100644 index 0000000..db702d4 --- /dev/null +++ b/packages/lua/5.4.4/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH="$PWD/lua-5.4.4/src:$PATH" \ No newline at end of file diff --git a/packages/lua/5.4.4/metadata.json b/packages/lua/5.4.4/metadata.json new file mode 100644 index 0000000..a2a51b7 --- /dev/null +++ b/packages/lua/5.4.4/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "lua", + "version": "5.4.4", + "aliases": [] +} \ No newline at end of file diff --git a/packages/lua/5.4.4/run b/packages/lua/5.4.4/run new file mode 100644 index 0000000..d826943 --- /dev/null +++ b/packages/lua/5.4.4/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +lua "$@" \ No newline at end of file diff --git a/packages/lua/5.4.4/test.lua b/packages/lua/5.4.4/test.lua new file mode 100644 index 0000000..3f2688f --- /dev/null +++ b/packages/lua/5.4.4/test.lua @@ -0,0 +1 @@ +print("OK") \ No newline at end of file From df553c80eaf10a1b352e440f0bc46495624c527c Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 13:12:10 +0200 Subject: [PATCH 22/59] Updated to `Nim 1.6.2` --- packages/nim/1.6.2/build.sh | 18 ++++++++++++++++++ packages/nim/1.6.2/compile | 5 +++++ packages/nim/1.6.2/environment | 1 + packages/nim/1.6.2/metadata.json | 5 +++++ packages/nim/1.6.2/run | 4 ++++ packages/nim/1.6.2/test.nim | 1 + 6 files changed, 34 insertions(+) create mode 100644 packages/nim/1.6.2/build.sh create mode 100644 packages/nim/1.6.2/compile create mode 100644 packages/nim/1.6.2/environment create mode 100644 packages/nim/1.6.2/metadata.json create mode 100644 packages/nim/1.6.2/run create mode 100644 packages/nim/1.6.2/test.nim diff --git a/packages/nim/1.6.2/build.sh b/packages/nim/1.6.2/build.sh new file mode 100644 index 0000000..20a9b65 --- /dev/null +++ b/packages/nim/1.6.2/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +# Prebuilt binary - source *can* be built, but it requires gcc +curl -L "https://nim-lang.org/download/nim-1.6.2-linux_x64.tar.xz" -o nim.tar.xz +tar xf nim.tar.xz --strip-components=1 +rm nim.tar.xz + +./install.sh "$PREFIX" + +cd ../ + +rm -rf build \ No newline at end of file diff --git a/packages/nim/1.6.2/compile b/packages/nim/1.6.2/compile new file mode 100644 index 0000000..1162cb3 --- /dev/null +++ b/packages/nim/1.6.2/compile @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Compile nim file(s) +nim --hints:off --out:out --nimcache:./ c "$@" +chmod +x out \ No newline at end of file diff --git a/packages/nim/1.6.2/environment b/packages/nim/1.6.2/environment new file mode 100644 index 0000000..872a1f3 --- /dev/null +++ b/packages/nim/1.6.2/environment @@ -0,0 +1 @@ +export PATH=$PWD/nim/bin:$PATH \ No newline at end of file diff --git a/packages/nim/1.6.2/metadata.json b/packages/nim/1.6.2/metadata.json new file mode 100644 index 0000000..facb421 --- /dev/null +++ b/packages/nim/1.6.2/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "nim", + "version": "1.6.2", + "aliases": [] +} \ No newline at end of file diff --git a/packages/nim/1.6.2/run b/packages/nim/1.6.2/run new file mode 100644 index 0000000..eb7e9c3 --- /dev/null +++ b/packages/nim/1.6.2/run @@ -0,0 +1,4 @@ +#!/bin/bash + +shift # Filename is only used to compile +./out "$@" \ No newline at end of file diff --git a/packages/nim/1.6.2/test.nim b/packages/nim/1.6.2/test.nim new file mode 100644 index 0000000..6c57628 --- /dev/null +++ b/packages/nim/1.6.2/test.nim @@ -0,0 +1 @@ +echo("OK") \ No newline at end of file From 7ae50eaef79ef9c9c6d8adaee50cc16c018577bb Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 13:31:16 +0200 Subject: [PATCH 23/59] Updated to `Octave 8.1.0` --- packages/octave/8.1.0/build.sh | 22 ++++++++++++++++++++++ packages/octave/8.1.0/environment | 4 ++++ packages/octave/8.1.0/metadata.json | 5 +++++ packages/octave/8.1.0/run | 4 ++++ packages/octave/8.1.0/test.octave | 1 + 5 files changed, 36 insertions(+) create mode 100644 packages/octave/8.1.0/build.sh create mode 100644 packages/octave/8.1.0/environment create mode 100644 packages/octave/8.1.0/metadata.json create mode 100644 packages/octave/8.1.0/run create mode 100644 packages/octave/8.1.0/test.octave diff --git a/packages/octave/8.1.0/build.sh b/packages/octave/8.1.0/build.sh new file mode 100644 index 0000000..f835f2e --- /dev/null +++ b/packages/octave/8.1.0/build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Build octave from source +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl -L "https://ftpmirror.gnu.org/octave/octave-8.1.0.tar.gz" -o octave.tar.gz + +tar xzf octave.tar.gz --strip-components=1 + +# === autoconf based === +# Disable support for GUI, HDF5 and Java +./configure --prefix "$PREFIX" --without-opengl --without-qt --without-x --without-hdf5 --disable-java + +make -j$(nproc) +make install -j$(nproc) + +cd ../ +rm -rf build \ No newline at end of file diff --git a/packages/octave/8.1.0/environment b/packages/octave/8.1.0/environment new file mode 100644 index 0000000..6eb8659 --- /dev/null +++ b/packages/octave/8.1.0/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Path to octave binary +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/octave/8.1.0/metadata.json b/packages/octave/8.1.0/metadata.json new file mode 100644 index 0000000..9e0023d --- /dev/null +++ b/packages/octave/8.1.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "octave", + "version": "8.1.0", + "aliases": ["matlab", "m"] +} \ No newline at end of file diff --git a/packages/octave/8.1.0/run b/packages/octave/8.1.0/run new file mode 100644 index 0000000..42cf092 --- /dev/null +++ b/packages/octave/8.1.0/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Run octave scripts without gui, history, init scripts and initial message +octave --no-gui --no-window-system --no-history --no-init-file --no-site-file --norc --quiet "$@" \ No newline at end of file diff --git a/packages/octave/8.1.0/test.octave b/packages/octave/8.1.0/test.octave new file mode 100644 index 0000000..a94310b --- /dev/null +++ b/packages/octave/8.1.0/test.octave @@ -0,0 +1 @@ +disp('OK') \ No newline at end of file From 28314f16ab2885185717fa3bcce8b5a87a46dac0 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 13:52:48 +0200 Subject: [PATCH 24/59] Updated to `Dart 2.19.6` --- packages/dart/2.19.6/build.sh | 11 +++++++++++ packages/dart/2.19.6/environment | 4 ++++ packages/dart/2.19.6/metadata.json | 5 +++++ packages/dart/2.19.6/run | 4 ++++ packages/dart/2.19.6/test.dart | 3 +++ 5 files changed, 27 insertions(+) create mode 100644 packages/dart/2.19.6/build.sh create mode 100644 packages/dart/2.19.6/environment create mode 100644 packages/dart/2.19.6/metadata.json create mode 100644 packages/dart/2.19.6/run create mode 100644 packages/dart/2.19.6/test.dart diff --git a/packages/dart/2.19.6/build.sh b/packages/dart/2.19.6/build.sh new file mode 100644 index 0000000..ec04ab1 --- /dev/null +++ b/packages/dart/2.19.6/build.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +curl -L "https://storage.googleapis.com/dart-archive/channels/stable/release/2.19.6/sdk/dartsdk-linux-x64-release.zip" -o dart.zip + +unzip dart.zip +rm dart.zip + +cp -r dart-sdk/* . +rm -rf dart-sdk + +chmod -R +rx bin \ No newline at end of file diff --git a/packages/dart/2.19.6/environment b/packages/dart/2.19.6/environment new file mode 100644 index 0000000..c6ab089 --- /dev/null +++ b/packages/dart/2.19.6/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/dart/2.19.6/metadata.json b/packages/dart/2.19.6/metadata.json new file mode 100644 index 0000000..ab0c1a2 --- /dev/null +++ b/packages/dart/2.19.6/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "dart", + "version": "2.19.6", + "aliases": [] +} \ No newline at end of file diff --git a/packages/dart/2.19.6/run b/packages/dart/2.19.6/run new file mode 100644 index 0000000..062d7c6 --- /dev/null +++ b/packages/dart/2.19.6/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +dart run "$@" \ No newline at end of file diff --git a/packages/dart/2.19.6/test.dart b/packages/dart/2.19.6/test.dart new file mode 100644 index 0000000..27e87b2 --- /dev/null +++ b/packages/dart/2.19.6/test.dart @@ -0,0 +1,3 @@ +void main() { + print('OK'); +} \ No newline at end of file From 0c253a667d5fe09d9c66909b2b6030c67b89c274 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 17:35:00 +0200 Subject: [PATCH 25/59] Updated to `Kotlin 1.8.20` --- packages/kotlin/1.8.20/build.sh | 13 +++++++++++++ packages/kotlin/1.8.20/compile | 6 ++++++ packages/kotlin/1.8.20/environment | 4 ++++ packages/kotlin/1.8.20/metadata.json | 5 +++++ packages/kotlin/1.8.20/run | 5 +++++ packages/kotlin/1.8.20/test.kt | 3 +++ 6 files changed, 36 insertions(+) create mode 100644 packages/kotlin/1.8.20/build.sh create mode 100644 packages/kotlin/1.8.20/compile create mode 100644 packages/kotlin/1.8.20/environment create mode 100644 packages/kotlin/1.8.20/metadata.json create mode 100644 packages/kotlin/1.8.20/run create mode 100644 packages/kotlin/1.8.20/test.kt diff --git a/packages/kotlin/1.8.20/build.sh b/packages/kotlin/1.8.20/build.sh new file mode 100644 index 0000000..2574b8d --- /dev/null +++ b/packages/kotlin/1.8.20/build.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Download and extract JDK8 +curl -L "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz" -o jdk.tar.gz +tar xzf jdk.tar.gz --strip-components=1 +rm jdk.tar.gz + +# Download and extract Kotlin +curl -L "https://github.com/JetBrains/kotlin/releases/download/v1.8.20/kotlin-compiler-1.8.20.zip" -o kotlin.zip +unzip kotlin.zip +rm kotlin.zip +cp -r kotlinc/* . +rm -rf kotlinc \ No newline at end of file diff --git a/packages/kotlin/1.8.20/compile b/packages/kotlin/1.8.20/compile new file mode 100644 index 0000000..7ef1cff --- /dev/null +++ b/packages/kotlin/1.8.20/compile @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +rename 's/$/\.kt/' "$@" # Add .kt extension + +# Compile Kotlin code to a jar file +kotlinc *.kt -include-runtime -d code.jar \ No newline at end of file diff --git a/packages/kotlin/1.8.20/environment b/packages/kotlin/1.8.20/environment new file mode 100644 index 0000000..9f25b86 --- /dev/null +++ b/packages/kotlin/1.8.20/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Add java and kotlinc to path +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/kotlin/1.8.20/metadata.json b/packages/kotlin/1.8.20/metadata.json new file mode 100644 index 0000000..7a4321e --- /dev/null +++ b/packages/kotlin/1.8.20/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "kotlin", + "version": "1.8.20", + "aliases": ["kt"] +} \ No newline at end of file diff --git a/packages/kotlin/1.8.20/run b/packages/kotlin/1.8.20/run new file mode 100644 index 0000000..a719220 --- /dev/null +++ b/packages/kotlin/1.8.20/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Run jar file +shift +java -jar code.jar "$@" \ No newline at end of file diff --git a/packages/kotlin/1.8.20/test.kt b/packages/kotlin/1.8.20/test.kt new file mode 100644 index 0000000..31acf7b --- /dev/null +++ b/packages/kotlin/1.8.20/test.kt @@ -0,0 +1,3 @@ +fun main() { + println("OK") +} \ No newline at end of file From 334e7820ffcebbd2e8582771e141494d4a16c900 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 18:21:15 +0200 Subject: [PATCH 26/59] Updated to `Scala 3.2.2` --- packages/scala/3.2.2/build.sh | 11 +++++++++++ packages/scala/3.2.2/compile | 14 ++++++++++++++ packages/scala/3.2.2/environment | 5 +++++ packages/scala/3.2.2/metadata.json | 5 +++++ packages/scala/3.2.2/run | 5 +++++ packages/scala/3.2.2/test.scala | 3 +++ 6 files changed, 43 insertions(+) create mode 100644 packages/scala/3.2.2/build.sh create mode 100644 packages/scala/3.2.2/compile create mode 100644 packages/scala/3.2.2/environment create mode 100644 packages/scala/3.2.2/metadata.json create mode 100644 packages/scala/3.2.2/run create mode 100644 packages/scala/3.2.2/test.scala diff --git a/packages/scala/3.2.2/build.sh b/packages/scala/3.2.2/build.sh new file mode 100644 index 0000000..2feef19 --- /dev/null +++ b/packages/scala/3.2.2/build.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Download and extract JDK8 +curl -L "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz" -o jdk.tar.gz +tar xzf jdk.tar.gz --strip-components=1 +rm jdk.tar.gz + +# Download and extract Scala 3 +curl -L "https://github.com/lampepfl/dotty/releases/download/3.2.2/scala3-3.2.2.tar.gz" -o scala.tar.gz +tar -xzf scala.tar.gz --strip-components=1 +rm scala.tar.gz \ No newline at end of file diff --git a/packages/scala/3.2.2/compile b/packages/scala/3.2.2/compile new file mode 100644 index 0000000..4d9cf66 --- /dev/null +++ b/packages/scala/3.2.2/compile @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Compile scala classes into a jar file +scalac "$@" -d out.jar + +# Create the Manifest and include scala lib jars: +# NOTE: - entry point will only consider @main and App traits from the main file +# - scala lib jars will be added to the class path in order to run the jar properly +echo "Main-Class: $(grep -oP '\@main\s+def\s+\K[a-zA-Z][a-zA-Z0-9]*|object\s+\K[a-zA-Z][a-zA-Z0-9]*(?=\s+extends\s+App)' $1) +Class-Path: $(echo $JAVA_HOME/lib/*.jar | sed 's/\s/\n /g') +" > manifest.txt + +# Update the jar with the manifest +jar ufm out.jar manifest.txt \ No newline at end of file diff --git a/packages/scala/3.2.2/environment b/packages/scala/3.2.2/environment new file mode 100644 index 0000000..588262f --- /dev/null +++ b/packages/scala/3.2.2/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Scala requires JAVA_HOME to be set +export JAVA_HOME=$PWD +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/scala/3.2.2/metadata.json b/packages/scala/3.2.2/metadata.json new file mode 100644 index 0000000..545c824 --- /dev/null +++ b/packages/scala/3.2.2/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "scala", + "version": "3.2.2", + "aliases": ["sc"] +} \ No newline at end of file diff --git a/packages/scala/3.2.2/run b/packages/scala/3.2.2/run new file mode 100644 index 0000000..accfd16 --- /dev/null +++ b/packages/scala/3.2.2/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Run jar file +shift +java -jar out.jar "$@" \ No newline at end of file diff --git a/packages/scala/3.2.2/test.scala b/packages/scala/3.2.2/test.scala new file mode 100644 index 0000000..bf4cabc --- /dev/null +++ b/packages/scala/3.2.2/test.scala @@ -0,0 +1,3 @@ +@main def run(): Unit = { + println("OK") +} \ No newline at end of file From 6a48428970011dcd1bb345cda4ab916c00a0bdaf Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 19:32:44 +0200 Subject: [PATCH 27/59] Updated to `Freebasic 1.9.0` --- packages/freebasic/1.9.0/build.sh | 5 +++++ packages/freebasic/1.9.0/compile | 4 ++++ packages/freebasic/1.9.0/environment | 4 ++++ packages/freebasic/1.9.0/metadata.json | 5 +++++ packages/freebasic/1.9.0/run | 5 +++++ packages/freebasic/1.9.0/test.bas | 1 + 6 files changed, 24 insertions(+) create mode 100644 packages/freebasic/1.9.0/build.sh create mode 100644 packages/freebasic/1.9.0/compile create mode 100644 packages/freebasic/1.9.0/environment create mode 100644 packages/freebasic/1.9.0/metadata.json create mode 100644 packages/freebasic/1.9.0/run create mode 100644 packages/freebasic/1.9.0/test.bas diff --git a/packages/freebasic/1.9.0/build.sh b/packages/freebasic/1.9.0/build.sh new file mode 100644 index 0000000..7f33fff --- /dev/null +++ b/packages/freebasic/1.9.0/build.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +curl -L "https://sourceforge.net/projects/fbc/files/FreeBASIC-1.09.0/Binaries-Linux/FreeBASIC-1.09.0-linux-x86_64.tar.gz/download" -o freebasic.tar.gz +tar xf freebasic.tar.gz --strip-components=1 +rm freebasic.tar.gz \ No newline at end of file diff --git a/packages/freebasic/1.9.0/compile b/packages/freebasic/1.9.0/compile new file mode 100644 index 0000000..20842d6 --- /dev/null +++ b/packages/freebasic/1.9.0/compile @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Compile bas files +fbc -lang qb -b "$@" -x out \ No newline at end of file diff --git a/packages/freebasic/1.9.0/environment b/packages/freebasic/1.9.0/environment new file mode 100644 index 0000000..8064d82 --- /dev/null +++ b/packages/freebasic/1.9.0/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Path to fbc compiler +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/freebasic/1.9.0/metadata.json b/packages/freebasic/1.9.0/metadata.json new file mode 100644 index 0000000..d0c3eb9 --- /dev/null +++ b/packages/freebasic/1.9.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "freebasic", + "version": "1.9.0", + "aliases": ["bas", "fbc", "basic", "qbasic", "quickbasic"] +} \ No newline at end of file diff --git a/packages/freebasic/1.9.0/run b/packages/freebasic/1.9.0/run new file mode 100644 index 0000000..6f7b53d --- /dev/null +++ b/packages/freebasic/1.9.0/run @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Run output file from compile with arguments +shift +./out "$@" \ No newline at end of file diff --git a/packages/freebasic/1.9.0/test.bas b/packages/freebasic/1.9.0/test.bas new file mode 100644 index 0000000..b13a0ef --- /dev/null +++ b/packages/freebasic/1.9.0/test.bas @@ -0,0 +1 @@ +PRINT "OK" \ No newline at end of file From 8a778f70331dc2b770d480f2ebf0496cd4379399 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 22:07:40 +0200 Subject: [PATCH 28/59] Updated to `Pascal 3.2.2` --- packages/pascal/3.2.2/build.sh | 25 +++++++++++++++++++++++++ packages/pascal/3.2.2/compile | 5 +++++ packages/pascal/3.2.2/environment | 1 + packages/pascal/3.2.2/metadata.json | 5 +++++ packages/pascal/3.2.2/run | 4 ++++ packages/pascal/3.2.2/test.pp | 5 +++++ 6 files changed, 45 insertions(+) create mode 100644 packages/pascal/3.2.2/build.sh create mode 100644 packages/pascal/3.2.2/compile create mode 100644 packages/pascal/3.2.2/environment create mode 100644 packages/pascal/3.2.2/metadata.json create mode 100644 packages/pascal/3.2.2/run create mode 100644 packages/pascal/3.2.2/test.pp diff --git a/packages/pascal/3.2.2/build.sh b/packages/pascal/3.2.2/build.sh new file mode 100644 index 0000000..aa4ad60 --- /dev/null +++ b/packages/pascal/3.2.2/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build +curl -L "https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/fpc-3.2.2.x86_64-linux.tar/download" -o pascal.tar +tar xf pascal.tar --strip-components=1 + +# FreePascal uses an interactive installer +./install.sh << ANSWERS +$PREFIX +n +n +n +ANSWERS + +cd .. +rm -rf build + +# A sample config (needed for each "project") is written to /etc +# We'll copy that into the local lib dir (fpc searches there too on compile) +mkdir lib/fpc/etc +cp -r /etc/fp* lib/fpc/etc/ \ No newline at end of file diff --git a/packages/pascal/3.2.2/compile b/packages/pascal/3.2.2/compile new file mode 100644 index 0000000..20b1280 --- /dev/null +++ b/packages/pascal/3.2.2/compile @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Compile pascal files +fpc -oout -v0 "$@" +chmod +x out \ No newline at end of file diff --git a/packages/pascal/3.2.2/environment b/packages/pascal/3.2.2/environment new file mode 100644 index 0000000..bd0ff98 --- /dev/null +++ b/packages/pascal/3.2.2/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/pascal/3.2.2/metadata.json b/packages/pascal/3.2.2/metadata.json new file mode 100644 index 0000000..cd85425 --- /dev/null +++ b/packages/pascal/3.2.2/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "pascal", + "version": "3.2.2", + "aliases": ["freepascal", "pp", "pas"] +} \ No newline at end of file diff --git a/packages/pascal/3.2.2/run b/packages/pascal/3.2.2/run new file mode 100644 index 0000000..eb7e9c3 --- /dev/null +++ b/packages/pascal/3.2.2/run @@ -0,0 +1,4 @@ +#!/bin/bash + +shift # Filename is only used to compile +./out "$@" \ No newline at end of file diff --git a/packages/pascal/3.2.2/test.pp b/packages/pascal/3.2.2/test.pp new file mode 100644 index 0000000..3c5165d --- /dev/null +++ b/packages/pascal/3.2.2/test.pp @@ -0,0 +1,5 @@ +program test; + + begin + writeln('OK'); + end. \ No newline at end of file From 1da99d47f18c4a57eee5db1048eb383ceeab74a4 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sat, 8 Apr 2023 22:29:44 +0200 Subject: [PATCH 29/59] Updated to `Perl 5.36.0` --- packages/perl/5.36.0/build.sh | 18 ++++++++++++++++++ packages/perl/5.36.0/environment | 1 + packages/perl/5.36.0/metadata.json | 5 +++++ packages/perl/5.36.0/run | 3 +++ packages/perl/5.36.0/test.pl | 1 + 5 files changed, 28 insertions(+) create mode 100644 packages/perl/5.36.0/build.sh create mode 100644 packages/perl/5.36.0/environment create mode 100644 packages/perl/5.36.0/metadata.json create mode 100644 packages/perl/5.36.0/run create mode 100644 packages/perl/5.36.0/test.pl diff --git a/packages/perl/5.36.0/build.sh b/packages/perl/5.36.0/build.sh new file mode 100644 index 0000000..a5aeacb --- /dev/null +++ b/packages/perl/5.36.0/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl "https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz" -o perl.tar.gz +tar xzf perl.tar.gz --strip-components=1 +./Configure -des -Dprefix="$PREFIX" + +make -j$(nproc) +make install -j$(nproc) + +cd .. + +rm -rf build \ No newline at end of file diff --git a/packages/perl/5.36.0/environment b/packages/perl/5.36.0/environment new file mode 100644 index 0000000..bd0ff98 --- /dev/null +++ b/packages/perl/5.36.0/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/perl/5.36.0/metadata.json b/packages/perl/5.36.0/metadata.json new file mode 100644 index 0000000..3e30158 --- /dev/null +++ b/packages/perl/5.36.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "perl", + "version": "5.36.0", + "aliases": ["pl"] +} \ No newline at end of file diff --git a/packages/perl/5.36.0/run b/packages/perl/5.36.0/run new file mode 100644 index 0000000..3b8d77c --- /dev/null +++ b/packages/perl/5.36.0/run @@ -0,0 +1,3 @@ +#!/bin/bash + +perl "$@" \ No newline at end of file diff --git a/packages/perl/5.36.0/test.pl b/packages/perl/5.36.0/test.pl new file mode 100644 index 0000000..3f2688f --- /dev/null +++ b/packages/perl/5.36.0/test.pl @@ -0,0 +1 @@ +print("OK") \ No newline at end of file From 4c45648a7962b46347ca88f3e763096e5f618ab8 Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Sun, 9 Apr 2023 12:24:30 +0200 Subject: [PATCH 30/59] Updated to `Vlang 0.3.3` --- packages/vlang/0.3.3/build.sh | 8 ++++++++ packages/vlang/0.3.3/environment | 4 ++++ packages/vlang/0.3.3/metadata.json | 5 +++++ packages/vlang/0.3.3/run | 14 ++++++++++++++ packages/vlang/0.3.3/test.v | 3 +++ 5 files changed, 34 insertions(+) create mode 100644 packages/vlang/0.3.3/build.sh create mode 100644 packages/vlang/0.3.3/environment create mode 100644 packages/vlang/0.3.3/metadata.json create mode 100644 packages/vlang/0.3.3/run create mode 100644 packages/vlang/0.3.3/test.v diff --git a/packages/vlang/0.3.3/build.sh b/packages/vlang/0.3.3/build.sh new file mode 100644 index 0000000..127bac9 --- /dev/null +++ b/packages/vlang/0.3.3/build.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Cloning vlang source +git clone https://github.com/vlang/v +cd v + +# Building and installing vlang +make \ No newline at end of file diff --git a/packages/vlang/0.3.3/environment b/packages/vlang/0.3.3/environment new file mode 100644 index 0000000..638b0c2 --- /dev/null +++ b/packages/vlang/0.3.3/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH="$PWD/v:$PATH" \ No newline at end of file diff --git a/packages/vlang/0.3.3/metadata.json b/packages/vlang/0.3.3/metadata.json new file mode 100644 index 0000000..4cdd7fd --- /dev/null +++ b/packages/vlang/0.3.3/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "vlang", + "version": "0.3.3", + "aliases": ["v"] +} \ No newline at end of file diff --git a/packages/vlang/0.3.3/run b/packages/vlang/0.3.3/run new file mode 100644 index 0000000..f608902 --- /dev/null +++ b/packages/vlang/0.3.3/run @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Export environment variables +export VMODULES="$PWD" +export TMPDIR="$PWD" + +# Put instructions to run the runtime + +filename=$1 + +rename 's/$/\.v/' $filename # Add .v extension + +shift +v run $filename.v "$@" \ No newline at end of file diff --git a/packages/vlang/0.3.3/test.v b/packages/vlang/0.3.3/test.v new file mode 100644 index 0000000..fb5de5e --- /dev/null +++ b/packages/vlang/0.3.3/test.v @@ -0,0 +1,3 @@ +fn main() { + println('OK') +} \ No newline at end of file From ec22c2bbef68e4d81c2406af7daefecbb941844e Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Tue, 18 Apr 2023 14:27:44 +0200 Subject: [PATCH 31/59] Updated to `Zig 0.10.1` --- packages/zig/0.10.1/build.sh | 10 ++++++++++ packages/zig/0.10.1/compile | 6 ++++++ packages/zig/0.10.1/environment | 4 ++++ packages/zig/0.10.1/metadata.json | 8 ++++++++ packages/zig/0.10.1/run | 4 ++++ packages/zig/0.10.1/test.zig | 6 ++++++ 6 files changed, 38 insertions(+) create mode 100644 packages/zig/0.10.1/build.sh create mode 100644 packages/zig/0.10.1/compile create mode 100644 packages/zig/0.10.1/environment create mode 100644 packages/zig/0.10.1/metadata.json create mode 100644 packages/zig/0.10.1/run create mode 100644 packages/zig/0.10.1/test.zig diff --git a/packages/zig/0.10.1/build.sh b/packages/zig/0.10.1/build.sh new file mode 100644 index 0000000..d653709 --- /dev/null +++ b/packages/zig/0.10.1/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +mkdir -p bin +cd bin/ + +curl -L "https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz" -o zig.tar.xz +tar xf zig.tar.xz --strip-components=1 +rm zig.tar.xz + +cd ../ \ No newline at end of file diff --git a/packages/zig/0.10.1/compile b/packages/zig/0.10.1/compile new file mode 100644 index 0000000..c0b03d1 --- /dev/null +++ b/packages/zig/0.10.1/compile @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# optimizing for small programs +rename 's/$/\.zig/' "$@" # Add .zig extension + +zig build-exe -O ReleaseSafe --color off --cache-dir . --global-cache-dir . --name out *.zig \ No newline at end of file diff --git a/packages/zig/0.10.1/environment b/packages/zig/0.10.1/environment new file mode 100644 index 0000000..8752bdb --- /dev/null +++ b/packages/zig/0.10.1/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# compiler path +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/zig/0.10.1/metadata.json b/packages/zig/0.10.1/metadata.json new file mode 100644 index 0000000..9ecb955 --- /dev/null +++ b/packages/zig/0.10.1/metadata.json @@ -0,0 +1,8 @@ +{ + "language": "zig", + "version": "0.10.1", + "aliases": [], + "limit_overrides": { + "compile_timeout": 15000 + } +} \ No newline at end of file diff --git a/packages/zig/0.10.1/run b/packages/zig/0.10.1/run new file mode 100644 index 0000000..70376eb --- /dev/null +++ b/packages/zig/0.10.1/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +shift # Filename is only used in compile step, so we can take it out here +./out "$@" \ No newline at end of file diff --git a/packages/zig/0.10.1/test.zig b/packages/zig/0.10.1/test.zig new file mode 100644 index 0000000..f0e287e --- /dev/null +++ b/packages/zig/0.10.1/test.zig @@ -0,0 +1,6 @@ +const std = @import("std"); + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + try stdout.print("OK\n", .{}); +} \ No newline at end of file From 57076ee17678bef45d8f7f7f74aa0b1769a37e5d Mon Sep 17 00:00:00 2001 From: RVG|lory <87276663+LoryPelli@users.noreply.github.com> Date: Wed, 24 May 2023 18:20:30 +0200 Subject: [PATCH 32/59] Updated to `Matl 22.7.4` --- packages/MATL/22.7.4/build.sh | 9 +++++++++ packages/MATL/22.7.4/environment | 5 +++++ packages/MATL/22.7.4/metadata.json | 5 +++++ packages/MATL/22.7.4/run | 13 +++++++++++++ packages/MATL/22.7.4/test.matl | 1 + 5 files changed, 33 insertions(+) create mode 100644 packages/MATL/22.7.4/build.sh create mode 100644 packages/MATL/22.7.4/environment create mode 100644 packages/MATL/22.7.4/metadata.json create mode 100644 packages/MATL/22.7.4/run create mode 100644 packages/MATL/22.7.4/test.matl diff --git a/packages/MATL/22.7.4/build.sh b/packages/MATL/22.7.4/build.sh new file mode 100644 index 0000000..106de4b --- /dev/null +++ b/packages/MATL/22.7.4/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# build octave as dependency +source ../../octave/6.2.0/build.sh + +# curl MATL 22.7.4 +curl -L "https://github.com/lmendo/MATL/archive/refs/tags/22.7.4.tar.gz" -o MATL.tar.xz +tar xf MATL.tar.xz --strip-components=1 +rm MATL.tar.xz \ No newline at end of file diff --git a/packages/MATL/22.7.4/environment b/packages/MATL/22.7.4/environment new file mode 100644 index 0000000..015acc2 --- /dev/null +++ b/packages/MATL/22.7.4/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Path to MATL binary +export PATH=$PWD/bin:$PATH +export MATL_PATH=$PWD \ No newline at end of file diff --git a/packages/MATL/22.7.4/metadata.json b/packages/MATL/22.7.4/metadata.json new file mode 100644 index 0000000..88a707d --- /dev/null +++ b/packages/MATL/22.7.4/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "matl", + "version": "22.7.4", + "aliases": [] +} \ No newline at end of file diff --git a/packages/MATL/22.7.4/run b/packages/MATL/22.7.4/run new file mode 100644 index 0000000..b0eb268 --- /dev/null +++ b/packages/MATL/22.7.4/run @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# get file as first argument +file="$1" + +# remove the file from $@ +shift + +# use the rest of the arguments as stdin +stdin=`printf "%s\n" "$@"` + +# pass stdin into octave which will run MATL +echo "$stdin" | octave -W -p "$MATL_PATH" --eval "matl -of '$file'" \ No newline at end of file diff --git a/packages/MATL/22.7.4/test.matl b/packages/MATL/22.7.4/test.matl new file mode 100644 index 0000000..97791fa --- /dev/null +++ b/packages/MATL/22.7.4/test.matl @@ -0,0 +1 @@ +'OK' \ No newline at end of file From 11841b320265bcd66af8756c16b5c1d29e5b2e84 Mon Sep 17 00:00:00 2001 From: Pablo Pozo Date: Fri, 14 Jul 2023 13:55:40 +0300 Subject: [PATCH 33/59] Backport engineer-man#519 parallel requests fix --- api/src/api/v2.js | 29 ++++--- api/src/job.js | 195 +++++++++++++++++++++++++--------------------- 2 files changed, 119 insertions(+), 105 deletions(-) diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 38b7c85..3dfa3ee 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -174,9 +174,9 @@ router.use((req, res, next) => { router.ws('/connect', async (ws, req) => { let job = null; - let eventBus = new events.EventEmitter(); + let event_bus = new events.EventEmitter(); - eventBus.on('stdout', data => + event_bus.on('stdout', data => ws.send( JSON.stringify({ type: 'data', @@ -185,7 +185,7 @@ router.ws('/connect', async (ws, req) => { }) ) ); - eventBus.on('stderr', data => + event_bus.on('stderr', data => ws.send( JSON.stringify({ type: 'data', @@ -194,10 +194,10 @@ router.ws('/connect', async (ws, req) => { }) ) ); - eventBus.on('stage', stage => + event_bus.on('stage', stage => ws.send(JSON.stringify({ type: 'stage', stage })) ); - eventBus.on('exit', (stage, status) => + event_bus.on('exit', (stage, status) => ws.send(JSON.stringify({ type: 'exit', stage, ...status })) ); @@ -220,7 +220,8 @@ router.ws('/connect', async (ws, req) => { }) ); - await job.execute_interactive(eventBus); + await job.execute(event_bus); + await job.cleanup(); ws.close(4999, 'Job Completed'); } else { @@ -230,7 +231,7 @@ router.ws('/connect', async (ws, req) => { case 'data': if (job !== null) { if (msg.stream === 'stdin') { - eventBus.emit('stdin', msg.data); + event_bus.emit('stdin', msg.data); } else { ws.close(4004, 'Can only write to stdin'); } @@ -241,7 +242,7 @@ router.ws('/connect', async (ws, req) => { case 'signal': if (job !== null) { if (SIGNALS.includes(msg.signal)) { - eventBus.emit('signal', msg.signal); + event_bus.emit('signal', msg.signal); } else { ws.close(4005, 'Invalid signal'); } @@ -257,12 +258,6 @@ router.ws('/connect', async (ws, req) => { } }); - ws.on('close', async () => { - if (job !== null) { - await job.cleanup(); - } - }); - setTimeout(() => { //Terminate the socket after 1 second, if not initialized. if (job === null) ws.close(4001, 'Initialization Timeout'); @@ -275,7 +270,11 @@ router.post('/execute', async (req, res) => { await job.prime(); - const result = await job.execute(); + let result = await job.execute(); + // Backward compatibility when the run stage is not started + if (result.run === undefined) { + result.run = result.compile; + } await job.cleanup(); diff --git a/api/src/job.js b/api/src/job.js index ecc19e5..f4a8c05 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -19,16 +19,12 @@ let uid = 0; let gid = 0; let remaining_job_spaces = config.max_concurrent_jobs; -let jobQueue = []; - -setInterval(() => { - // Every 10ms try resolve a new job, if there is an available slot - if (jobQueue.length > 0 && remaining_job_spaces > 0) { - jobQueue.shift()(); - } -}, 10); +let job_queue = []; class Job { + #active_timeouts; + #active_parent_processes; + constructor({ runtime, files, args, stdin, timeouts, memory_limits }) { this.uuid = uuidv4(); @@ -45,6 +41,13 @@ class Job { this.args = args; this.stdin = stdin; + // Add a trailing newline if it doesn't exist + if (this.stdin.slice(-1) !== '\n') { + this.stdin += '\n'; + } + + this.#active_timeouts = []; + this.#active_parent_processes = []; this.timeouts = timeouts; this.memory_limits = memory_limits; @@ -72,10 +75,9 @@ class Job { if (remaining_job_spaces < 1) { this.logger.info(`Awaiting job slot`); await new Promise(resolve => { - jobQueue.push(resolve); + job_queue.push(resolve); }); } - this.logger.info(`Priming job`); remaining_job_spaces--; this.logger.debug('Writing files to job cache'); @@ -110,7 +112,31 @@ class Job { this.logger.debug('Primed job'); } - async safe_call(file, args, timeout, memory_limit, eventBus = null) { + exit_cleanup() { + for (const timeout of this.#active_timeouts) { + clear_timeout(timeout); + } + this.#active_timeouts = []; + this.logger.debug('Cleared the active timeouts'); + + this.cleanup_processes(); + this.logger.debug(`Finished exit cleanup`); + } + + close_cleanup() { + for (const proc of this.#active_parent_processes) { + proc.stderr.destroy(); + if (!proc.stdin.destroyed) { + proc.stdin.end(); + proc.stdin.destroy(); + } + proc.stdout.destroy(); + } + this.#active_parent_processes = []; + this.logger.debug('Destroyed processes writables'); + } + + async safe_call(file, args, timeout, memory_limit, event_bus = null) { return new Promise((resolve, reject) => { const nonetwork = config.disable_networking ? ['nosocket'] : []; @@ -122,7 +148,10 @@ class Job { ]; const timeout_call = [ - 'timeout', '-s', '9', Math.ceil(timeout / 1000), + 'timeout', + '-s', + '9', + Math.ceil(timeout / 1000), ]; if (memory_limit >= 0) { @@ -155,16 +184,18 @@ class Job { detached: true, //give this process its own process group }); - if (eventBus === null) { + this.#active_parent_processes.push(proc); + + if (event_bus === null) { proc.stdin.write(this.stdin); proc.stdin.end(); proc.stdin.destroy(); } else { - eventBus.on('stdin', data => { + event_bus.on('stdin', data => { proc.stdin.write(data); }); - eventBus.on('kill', signal => { + event_bus.on('kill', signal => { proc.kill(signal); }); } @@ -176,10 +207,11 @@ class Job { process.kill(proc.pid, 'SIGKILL'); }, timeout)) || null; + this.#active_timeouts.push(kill_timeout); proc.stderr.on('data', async data => { - if (eventBus !== null) { - eventBus.emit('stderr', data); + if (event_bus !== null) { + event_bus.emit('stderr', data); } else if (stderr.length > this.runtime.output_max_size) { this.logger.info(`stderr length exceeded`); process.kill(proc.pid, 'SIGKILL'); @@ -190,8 +222,8 @@ class Job { }); proc.stdout.on('data', async data => { - if (eventBus !== null) { - eventBus.emit('stdout', data); + if (event_bus !== null) { + event_bus.emit('stdout', data); } else if (stdout.length > this.runtime.output_max_size) { this.logger.info(`stdout length exceeded`); process.kill(proc.pid, 'SIGKILL'); @@ -201,31 +233,24 @@ class Job { } }); - const exit_cleanup = () => { - clear_timeout(kill_timeout); + proc.on('exit', () => this.exit_cleanup()); - proc.stderr.destroy(); - proc.stdout.destroy(); - - this.cleanup_processes(); - this.logger.debug(`Finished exit cleanup`); - }; - - proc.on('exit', (code, signal) => { - exit_cleanup(); + proc.on('close', (code, signal) => { + this.close_cleanup(); resolve({ stdout, stderr, code, signal, output }); }); proc.on('error', err => { - exit_cleanup(); + this.exit_cleanup(); + this.close_cleanup(); reject({ error: err, stdout, stderr, output }); }); }); } - async execute() { + async execute(event_bus = null) { if (this.state !== job_states.PRIMED) { throw new Error( 'Job must be in primed state, current state: ' + @@ -242,24 +267,54 @@ class Job { this.logger.debug('Compiling'); let compile; + let compile_errored = false; + const { emit_event_bus_result, emit_event_bus_stage } = + event_bus === null + ? { + emit_event_bus_result: () => {}, + emit_event_bus_stage: () => {}, + } + : { + emit_event_bus_result: (stage, result, event_bus) => { + const { error, code, signal } = result; + event_bus.emit('exit', stage, { + error, + code, + signal, + }); + }, + emit_event_bus_stage: (stage, event_bus) => { + event_bus.emit('stage', stage); + }, + }; if (this.runtime.compiled) { + this.logger.debug('Compiling'); + emit_event_bus_stage('compile', event_bus); compile = await this.safe_call( path.join(this.runtime.pkgdir, 'compile'), code_files.map(x => x.name), this.timeouts.compile, - this.memory_limits.compile + this.memory_limits.compile, + event_bus ); + emit_event_bus_result('compile', compile, event_bus); + compile_errored = compile.code !== 0; } - this.logger.debug('Running'); - - const run = await this.safe_call( - path.join(this.runtime.pkgdir, 'run'), - [code_files[0].name, ...this.args], - this.timeouts.run, - this.memory_limits.run - ); + let run; + if (!compile_errored) { + this.logger.debug('Running'); + emit_event_bus_stage('run', event_bus); + run = await this.safe_call( + path.join(this.runtime.pkgdir, 'run'), + [code_files[0].name, ...this.args], + this.timeouts.run, + this.memory_limits.run, + event_bus + ); + emit_event_bus_result('run', run, event_bus); + } this.state = job_states.EXECUTED; @@ -271,50 +326,6 @@ class Job { }; } - async execute_interactive(eventBus) { - if (this.state !== job_states.PRIMED) { - throw new Error( - 'Job must be in primed state, current state: ' + - this.state.toString() - ); - } - - this.logger.info( - `Interactively executing job runtime=${this.runtime.toString()}` - ); - - const code_files = - (this.runtime.language === 'file' && this.files) || - this.files.filter(file => file.encoding == 'utf8'); - - if (this.runtime.compiled) { - eventBus.emit('stage', 'compile'); - const { error, code, signal } = await this.safe_call( - path.join(this.runtime.pkgdir, 'compile'), - code_files.map(x => x.name), - this.timeouts.compile, - this.memory_limits.compile, - eventBus - ); - - eventBus.emit('exit', 'compile', { error, code, signal }); - } - - this.logger.debug('Running'); - eventBus.emit('stage', 'run'); - const { error, code, signal } = await this.safe_call( - path.join(this.runtime.pkgdir, 'run'), - [code_files[0].name, ...this.args], - this.timeouts.run, - this.memory_limits.run, - eventBus - ); - - eventBus.emit('exit', 'run', { error, code, signal }); - - this.state = job_states.EXECUTED; - } - cleanup_processes(dont_wait = []) { let processes = [1]; const to_wait = []; @@ -345,11 +356,11 @@ class Job { 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 (ruid != this.uid && euid != this.uid) return -1; - if (state == 'Z'){ + if (state == 'Z') { // Zombie process, just needs to be waited, regardless of the user id - if(!to_wait.includes(proc_id_int)) + if (!to_wait.includes(proc_id_int)) to_wait.push(proc_id_int); return -1; @@ -386,7 +397,7 @@ class Job { // Then clear them out of the process tree try { process.kill(proc, 'SIGKILL'); - } catch(e) { + } catch { // Could already be dead and just needs to be waited on this.logger.debug( `Got error while SIGKILLing process ${proc}:`, @@ -440,10 +451,14 @@ class Job { async cleanup() { this.logger.info(`Cleaning up job`); - this.cleanup_processes(); // Run process janitor, just incase there are any residual processes somehow + this.exit_cleanup(); // Run process janitor, just incase there are any residual processes somehow + this.close_cleanup(); await this.cleanup_filesystem(); remaining_job_spaces++; + if (job_queue.length > 0) { + job_queue.shift()(); + } } } From ce852aa20d16e7f66ff6ba7f4de38f8768486ace Mon Sep 17 00:00:00 2001 From: Cory Date: Sat, 5 Aug 2023 21:53:50 +1000 Subject: [PATCH 34/59] add some additional py packages --- packages/python/3.10.0/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/python/3.10.0/build.sh b/packages/python/3.10.0/build.sh index 00c839a..62fef92 100755 --- a/packages/python/3.10.0/build.sh +++ b/packages/python/3.10.0/build.sh @@ -18,4 +18,4 @@ cd .. rm -rf build -bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib sympy +bin/pip3 install numpy scipy pandas pycrypto whoosh bcrypt passlib sympy xxhash base58 cryptography PyNaCl From f70ecdd8b4f93497bbd8c0d6397326e256db7ad2 Mon Sep 17 00:00:00 2001 From: devnote-dev Date: Sun, 3 Sep 2023 20:29:22 +0100 Subject: [PATCH 35/59] feat(packages): replace old crystal version --- packages/crystal/{0.36.1 => 1.9.2}/build.sh | 2 +- packages/crystal/{0.36.1 => 1.9.2}/compile | 0 packages/crystal/{0.36.1 => 1.9.2}/environment | 0 packages/crystal/{0.36.1 => 1.9.2}/metadata.json | 2 +- packages/crystal/{0.36.1 => 1.9.2}/run | 0 packages/crystal/{0.36.1 => 1.9.2}/test.cr | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename packages/crystal/{0.36.1 => 1.9.2}/build.sh (72%) mode change 100755 => 100644 rename packages/crystal/{0.36.1 => 1.9.2}/compile (100%) rename packages/crystal/{0.36.1 => 1.9.2}/environment (100%) rename packages/crystal/{0.36.1 => 1.9.2}/metadata.json (71%) rename packages/crystal/{0.36.1 => 1.9.2}/run (100%) rename packages/crystal/{0.36.1 => 1.9.2}/test.cr (100%) diff --git a/packages/crystal/0.36.1/build.sh b/packages/crystal/1.9.2/build.sh old mode 100755 new mode 100644 similarity index 72% rename from packages/crystal/0.36.1/build.sh rename to packages/crystal/1.9.2/build.sh index ba10f3f..e95779c --- a/packages/crystal/0.36.1/build.sh +++ b/packages/crystal/1.9.2/build.sh @@ -2,6 +2,6 @@ PREFIX=$(realpath $(dirname $0)) -curl -L "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-linux-x86_64.tar.gz" -o crystal.tar.gz +curl -L "https://github.com/crystal-lang/crystal/releases/download/1.9.2/crystal-1.9.2-1-linux-x86_64.tar.gz" -o crystal.tar.gz tar xzf crystal.tar.gz --strip-components=1 rm crystal.tar.gz diff --git a/packages/crystal/0.36.1/compile b/packages/crystal/1.9.2/compile similarity index 100% rename from packages/crystal/0.36.1/compile rename to packages/crystal/1.9.2/compile diff --git a/packages/crystal/0.36.1/environment b/packages/crystal/1.9.2/environment similarity index 100% rename from packages/crystal/0.36.1/environment rename to packages/crystal/1.9.2/environment diff --git a/packages/crystal/0.36.1/metadata.json b/packages/crystal/1.9.2/metadata.json similarity index 71% rename from packages/crystal/0.36.1/metadata.json rename to packages/crystal/1.9.2/metadata.json index ee995eb..09a23ad 100644 --- a/packages/crystal/0.36.1/metadata.json +++ b/packages/crystal/1.9.2/metadata.json @@ -1,5 +1,5 @@ { "language": "crystal", - "version": "0.36.1", + "version": "1.9.2", "aliases": ["crystal", "cr"] } diff --git a/packages/crystal/0.36.1/run b/packages/crystal/1.9.2/run similarity index 100% rename from packages/crystal/0.36.1/run rename to packages/crystal/1.9.2/run diff --git a/packages/crystal/0.36.1/test.cr b/packages/crystal/1.9.2/test.cr similarity index 100% rename from packages/crystal/0.36.1/test.cr rename to packages/crystal/1.9.2/test.cr From fe2fc374aa0b4f1a6631047651511af98445da13 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 15 Sep 2023 16:48:35 +0300 Subject: [PATCH 36/59] Improve normal execution error handling - Properly differentiate between bad requests and internal server errors - Avoid clean up evasion by putting the cleanup in the finally block --- api/src/api/v2.js | 20 +++++++++++++++----- packages/bash/5.2.0/build.sh | 0 2 files changed, 15 insertions(+), 5 deletions(-) mode change 100644 => 100755 packages/bash/5.2.0/build.sh diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 3dfa3ee..ad07494 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -265,9 +265,13 @@ router.ws('/connect', async (ws, req) => { }); router.post('/execute', async (req, res) => { + let job; + try { + job = await get_job(req.body); + } catch (error) { + return res.status(400).json(error); + } try { - const job = await get_job(req.body); - await job.prime(); let result = await job.execute(); @@ -276,11 +280,17 @@ router.post('/execute', async (req, res) => { result.run = result.compile; } - await job.cleanup(); - return res.status(200).send(result); } catch (error) { - return res.status(400).json(error); + logger.error(`Error executing job: ${job.uuid}:\n${error}`); + return res.status(500).send(); + } finally { + try { + await job.cleanup(); + } catch (error) { + logger.error(`Error cleaning up job: ${job.uuid}:\n${error}`); + return res.status(500).send(); + } } }); diff --git a/packages/bash/5.2.0/build.sh b/packages/bash/5.2.0/build.sh old mode 100644 new mode 100755 From 040e19fdc2e03e241519e81d5bd7b4c866cf8b6b Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 15 Sep 2023 20:39:15 +0300 Subject: [PATCH 37/59] Interactive execution: run job cleanup regardless of errors --- api/src/api/v2.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/api/src/api/v2.js b/api/src/api/v2.js index ad07494..1b015b5 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -210,19 +210,26 @@ router.ws('/connect', async (ws, req) => { if (job === null) { job = await get_job(msg); - await job.prime(); + try { + await job.prime(); - ws.send( - JSON.stringify({ - type: 'runtime', - language: job.runtime.language, - version: job.runtime.version.raw, - }) - ); - - await job.execute(event_bus); - await job.cleanup(); + ws.send( + JSON.stringify({ + type: 'runtime', + language: job.runtime.language, + version: job.runtime.version.raw, + }) + ); + await job.execute(event_bus); + } catch (error) { + logger.error( + `Error cleaning up job: ${job.uuid}:\n${error}` + ); + throw error; + } finally { + await job.cleanup(); + } ws.close(4999, 'Job Completed'); } else { ws.close(4000, 'Already Initialized'); From 6a47869578b89212c0e7f2a37d395e804c924d81 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sat, 16 Sep 2023 21:37:09 +0300 Subject: [PATCH 38/59] Comments explaining the try-catch flow --- api/src/api/v2.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 1b015b5..032fd51 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -230,7 +230,7 @@ router.ws('/connect', async (ws, req) => { } finally { await job.cleanup(); } - ws.close(4999, 'Job Completed'); + ws.close(4999, 'Job Completed'); // Will not execute if an error is thrown above } else { ws.close(4000, 'Already Initialized'); } @@ -293,10 +293,10 @@ router.post('/execute', async (req, res) => { return res.status(500).send(); } finally { try { - await job.cleanup(); + await job.cleanup(); // This gets executed before the returns in try/catch } catch (error) { logger.error(`Error cleaning up job: ${job.uuid}:\n${error}`); - return res.status(500).send(); + return res.status(500).send(); // On error, this replaces the return in the outer try-catch } } }); From fef00b96f169c1b1508d871ae901359d2ced82d2 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Tue, 3 Oct 2023 13:59:23 +0300 Subject: [PATCH 39/59] Improve containers stopping performance by handling SIGTERM --- api/src/index.js | 12 ++++++++++-- repo/Dockerfile | 2 +- repo/entrypoint.sh | 6 +++--- repo/serve.py | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 repo/serve.py diff --git a/api/src/index.js b/api/src/index.js index 8a21e57..6ad9390 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -35,7 +35,10 @@ expressWs(app); } } }); - fss.chmodSync(path.join(config.data_directory, globals.data_directories.jobs), 0o711) + fss.chmodSync( + path.join(config.data_directory, globals.data_directories.jobs), + 0o711 + ); logger.info('Loading packages'); const pkgdir = path.join( @@ -92,7 +95,12 @@ expressWs(app); logger.debug('Calling app.listen'); const [address, port] = config.bind_address.split(':'); - app.listen(port, address, () => { + const server = app.listen(port, address, () => { logger.info('API server started on', config.bind_address); }); + + process.on('SIGTERM', () => { + server.close(); + process.exit(0) + }); })(); diff --git a/repo/Dockerfile b/repo/Dockerfile index fe61a6f..86be49a 100644 --- a/repo/Dockerfile +++ b/repo/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-d rm -rf /var/lib/apt/lists/* && \ update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2 -ADD entrypoint.sh mkindex.sh / +ADD entrypoint.sh mkindex.sh serve.py / ENTRYPOINT ["bash","/entrypoint.sh"] CMD ["--no-build"] diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh index 6c47e37..1565143 100755 --- a/repo/entrypoint.sh +++ b/repo/entrypoint.sh @@ -27,7 +27,7 @@ do echo "Done with package $pkg" elif [[ $CI -eq 1 ]]; then echo "Commit SHA: $pkg" - + cd .. echo "Changed files:" git diff --name-only $pkg^1 $pkg @@ -52,8 +52,8 @@ echo "Index created" if [[ $SERVER -eq 1 ]]; then echo "Starting index server.." - python3 -m http.server + exec python3 /serve.py else echo "Skipping starting index server" fi -exit 0 \ No newline at end of file +exit 0 diff --git a/repo/serve.py b/repo/serve.py new file mode 100644 index 0000000..a821219 --- /dev/null +++ b/repo/serve.py @@ -0,0 +1,18 @@ +import signal +import sys +import http.server +import socketserver + +PORT = 8000 + +Handler = http.server.SimpleHTTPRequestHandler + + +def signal_handler(sig, frame): + sys.exit(0) + +signal.signal(signal.SIGTERM, signal_handler) + +with socketserver.TCPServer(("", PORT), Handler) as httpd: + print("serving at port", PORT) + httpd.serve_forever() From 016a8c086f7c9cc9d785f8ccc2ffb6975cb4a4da Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Tue, 3 Oct 2023 15:21:48 +0300 Subject: [PATCH 40/59] exec comment --- repo/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/repo/entrypoint.sh b/repo/entrypoint.sh index 1565143..c167463 100755 --- a/repo/entrypoint.sh +++ b/repo/entrypoint.sh @@ -52,6 +52,7 @@ echo "Index created" if [[ $SERVER -eq 1 ]]; then echo "Starting index server.." + # We want the child process to replace the shell to handle signals exec python3 /serve.py else echo "Skipping starting index server" From 18743a33690a3849d2b12263e62027950b86bf0c Mon Sep 17 00:00:00 2001 From: Aetheridon Date: Wed, 18 Oct 2023 19:43:32 +0100 Subject: [PATCH 41/59] Added files for Python 3.11.0 --- packages/python/3.11.0/build.sh | 21 +++++++++++++++++++++ packages/python/3.11.0/environment | 1 + packages/python/3.11.0/metadata.json | 5 +++++ packages/python/3.11.0/run | 3 +++ packages/python/3.11.0/test.py | 7 +++++++ 5 files changed, 37 insertions(+) create mode 100644 packages/python/3.11.0/build.sh create mode 100644 packages/python/3.11.0/environment create mode 100644 packages/python/3.11.0/metadata.json create mode 100644 packages/python/3.11.0/run create mode 100644 packages/python/3.11.0/test.py diff --git a/packages/python/3.11.0/build.sh b/packages/python/3.11.0/build.sh new file mode 100644 index 0000000..8db680c --- /dev/null +++ b/packages/python/3.11.0/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl "https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz" -o python.tar.gz +tar xzf python.tar.gz --strip-components=1 +rm python.tar.gz + +./configure --prefix "$PREFIX" --with-ensurepip=install +make -j$(nproc) +make install -j$(nproc) + +cd .. + +rm -rf build + +bin/pip3 install numpy scipy pandas pycryptodome whoosh bcrypt passlib sympy xxhash base58 cryptography PyNaCl diff --git a/packages/python/3.11.0/environment b/packages/python/3.11.0/environment new file mode 100644 index 0000000..977a5e8 --- /dev/null +++ b/packages/python/3.11.0/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH diff --git a/packages/python/3.11.0/metadata.json b/packages/python/3.11.0/metadata.json new file mode 100644 index 0000000..c169a60 --- /dev/null +++ b/packages/python/3.11.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "python", + "version": "3.11.0", + "aliases": ["py", "py3", "python3", "python3.11"] +} diff --git a/packages/python/3.11.0/run b/packages/python/3.11.0/run new file mode 100644 index 0000000..cf38089 --- /dev/null +++ b/packages/python/3.11.0/run @@ -0,0 +1,3 @@ +#!/bin/bash + +python3.11 "$@" diff --git a/packages/python/3.11.0/test.py b/packages/python/3.11.0/test.py new file mode 100644 index 0000000..1784bfa --- /dev/null +++ b/packages/python/3.11.0/test.py @@ -0,0 +1,7 @@ +working = True + +match working: + case True: + print("OK") + case False: + print() From dc4bb294b613e9c4e5e92ebb8fc855f88083f4b7 Mon Sep 17 00:00:00 2001 From: Shubham Sahai Date: Thu, 26 Oct 2023 02:42:28 +0800 Subject: [PATCH 42/59] bugfix: catch error - "e is not defined" --- api/src/job.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index f4a8c05..00ee14f 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -146,7 +146,7 @@ class Job { '--nofile=' + this.runtime.max_open_files, '--fsize=' + this.runtime.max_file_size, ]; - + const timeout_call = [ 'timeout', '-s', @@ -158,7 +158,7 @@ class Job { prlimit.push('--as=' + memory_limit); } - const proc_call = [ + const proc_call = [ 'nice', ...timeout_call, ...prlimit, @@ -254,7 +254,7 @@ class Job { if (this.state !== job_states.PRIMED) { throw new Error( 'Job must be in primed state, current state: ' + - this.state.toString() + this.state.toString() ); } @@ -271,22 +271,22 @@ class Job { const { emit_event_bus_result, emit_event_bus_stage } = event_bus === null ? { - emit_event_bus_result: () => {}, - emit_event_bus_stage: () => {}, - } + emit_event_bus_result: () => { }, + emit_event_bus_stage: () => { }, + } : { - emit_event_bus_result: (stage, result, event_bus) => { - const { error, code, signal } = result; - event_bus.emit('exit', stage, { - error, - code, - signal, - }); - }, - emit_event_bus_stage: (stage, event_bus) => { - event_bus.emit('stage', stage); - }, - }; + emit_event_bus_result: (stage, result, event_bus) => { + const { error, code, signal } = result; + event_bus.emit('exit', stage, { + error, + code, + signal, + }); + }, + emit_event_bus_stage: (stage, event_bus) => { + event_bus.emit('stage', stage); + }, + }; if (this.runtime.compiled) { this.logger.debug('Compiling'); @@ -352,9 +352,9 @@ class Job { const [_, ruid, euid, suid, fuid] = uid_line.split(/\s+/); const [_1, state, user_friendly] = state_line.split(/\s+/); - + 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; @@ -362,7 +362,7 @@ class Job { // 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) @@ -397,7 +397,7 @@ class Job { // Then clear them out of the process tree try { process.kill(proc, 'SIGKILL'); - } catch { + } catch (e) { // Could already be dead and just needs to be waited on this.logger.debug( `Got error while SIGKILLing process ${proc}:`, From d8af1ee301abf1eff0a008f7625600b6b743b5b8 Mon Sep 17 00:00:00 2001 From: Shubham Sahai Date: Mon, 30 Oct 2023 20:09:01 +0800 Subject: [PATCH 43/59] Try-Catch process kills to handle dead processes --- api/src/job.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 00ee14f..46efe27 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -204,7 +204,16 @@ class Job { (timeout >= 0 && set_timeout(async _ => { this.logger.info(`Timeout exceeded timeout=${timeout}`); - process.kill(proc.pid, 'SIGKILL'); + try { + process.kill(proc.pid, 'SIGKILL'); + } + catch (e) { + // Could already be dead and just needs to be waited on + this.logger.debug( + `Got error while SIGKILLing process ${proc}:`, + e + ); + } }, timeout)) || null; this.#active_timeouts.push(kill_timeout); @@ -214,7 +223,16 @@ class Job { event_bus.emit('stderr', data); } else if (stderr.length > this.runtime.output_max_size) { this.logger.info(`stderr length exceeded`); - process.kill(proc.pid, 'SIGKILL'); + try { + process.kill(proc.pid, 'SIGKILL'); + } + catch (e) { + // Could already be dead and just needs to be waited on + this.logger.debug( + `Got error while SIGKILLing process ${proc}:`, + e + ); + } } else { stderr += data; output += data; @@ -226,7 +244,16 @@ class Job { event_bus.emit('stdout', data); } else if (stdout.length > this.runtime.output_max_size) { this.logger.info(`stdout length exceeded`); - process.kill(proc.pid, 'SIGKILL'); + try { + process.kill(proc.pid, 'SIGKILL'); + } + catch (e) { + // Could already be dead and just needs to be waited on + this.logger.debug( + `Got error while SIGKILLing process ${proc}:`, + e + ); + } } else { stdout += data; output += data; From c97324beb34570b99e95aef40cf2a68d62acf41a Mon Sep 17 00:00:00 2001 From: Aetheridon Date: Wed, 1 Nov 2023 21:29:36 +0000 Subject: [PATCH 44/59] Python 3.12.0 support --- packages/python/3.12.0/build.sh | 21 +++++++++++++++++++++ packages/python/3.12.0/environment | 1 + packages/python/3.12.0/metadata.json | 5 +++++ packages/python/3.12.0/run | 3 +++ packages/python/3.12.0/test.py | 7 +++++++ 5 files changed, 37 insertions(+) create mode 100644 packages/python/3.12.0/build.sh create mode 100644 packages/python/3.12.0/environment create mode 100644 packages/python/3.12.0/metadata.json create mode 100644 packages/python/3.12.0/run create mode 100644 packages/python/3.12.0/test.py diff --git a/packages/python/3.12.0/build.sh b/packages/python/3.12.0/build.sh new file mode 100644 index 0000000..4de24a7 --- /dev/null +++ b/packages/python/3.12.0/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +PREFIX=$(realpath $(dirname $0)) + +mkdir -p build + +cd build + +curl "https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz" -o python.tar.gz +tar xzf python.tar.gz --strip-components=1 +rm python.tar.gz + +./configure --prefix "$PREFIX" --with-ensurepip=install +make -j$(nproc) +make install -j$(nproc) + +cd .. + +rm -rf build + +bin/pip3 install numpy scipy pandas pycryptodome whoosh bcrypt passlib sympy xxhash base58 cryptography PyNaCl diff --git a/packages/python/3.12.0/environment b/packages/python/3.12.0/environment new file mode 100644 index 0000000..977a5e8 --- /dev/null +++ b/packages/python/3.12.0/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH diff --git a/packages/python/3.12.0/metadata.json b/packages/python/3.12.0/metadata.json new file mode 100644 index 0000000..59d257a --- /dev/null +++ b/packages/python/3.12.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "python", + "version": "3.12.0", + "aliases": ["py", "py3", "python3", "python3.12"] +} diff --git a/packages/python/3.12.0/run b/packages/python/3.12.0/run new file mode 100644 index 0000000..6f77990 --- /dev/null +++ b/packages/python/3.12.0/run @@ -0,0 +1,3 @@ +#!/bin/bash + +python3.12 "$@" diff --git a/packages/python/3.12.0/test.py b/packages/python/3.12.0/test.py new file mode 100644 index 0000000..1784bfa --- /dev/null +++ b/packages/python/3.12.0/test.py @@ -0,0 +1,7 @@ +working = True + +match working: + case True: + print("OK") + case False: + print() From 647bc3a7c735a02ecd97d2b849340dc022dcee61 Mon Sep 17 00:00:00 2001 From: Ahmed Wael Date: Fri, 26 Jan 2024 08:41:28 +0200 Subject: [PATCH 45/59] handle stdout and stderr limits properly (#643) * handle stdout and stderr limits proberly Co-authored-by: Omar Brikaa * added environment to docker compose --------- Co-authored-by: Omar Brikaa --- api/src/job.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 46efe27..a2641f9 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -221,7 +221,7 @@ class Job { proc.stderr.on('data', async data => { if (event_bus !== null) { event_bus.emit('stderr', data); - } else if (stderr.length > this.runtime.output_max_size) { + } else if ((stderr.length + data.length) > this.runtime.output_max_size) { this.logger.info(`stderr length exceeded`); try { process.kill(proc.pid, 'SIGKILL'); @@ -242,7 +242,7 @@ class Job { proc.stdout.on('data', async data => { if (event_bus !== null) { event_bus.emit('stdout', data); - } else if (stdout.length > this.runtime.output_max_size) { + } else if ((stdout.length + data.length) > this.runtime.output_max_size) { this.logger.info(`stdout length exceeded`); try { process.kill(proc.pid, 'SIGKILL'); From 684b47d2a2e3c7aa9c1c3af0e5482888ba5bee76 Mon Sep 17 00:00:00 2001 From: Kodie Date: Thu, 18 Apr 2024 23:38:20 +1200 Subject: [PATCH 46/59] pkg(node-20.11.0) Added Node 20.11.0 (#646) --- packages/node/20.11.1/build.sh | 4 ++++ packages/node/20.11.1/environment | 1 + packages/node/20.11.1/metadata.json | 10 ++++++++++ packages/node/20.11.1/run | 3 +++ packages/node/20.11.1/test.js | 1 + 5 files changed, 19 insertions(+) create mode 100644 packages/node/20.11.1/build.sh create mode 100644 packages/node/20.11.1/environment create mode 100644 packages/node/20.11.1/metadata.json create mode 100644 packages/node/20.11.1/run create mode 100644 packages/node/20.11.1/test.js diff --git a/packages/node/20.11.1/build.sh b/packages/node/20.11.1/build.sh new file mode 100644 index 0000000..4c7a3af --- /dev/null +++ b/packages/node/20.11.1/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +curl "https://nodejs.org/dist/v20.11.1/node-v20.11.1-linux-x64.tar.xz" -o node.tar.xz +tar xf node.tar.xz --strip-components=1 +rm node.tar.xz \ No newline at end of file diff --git a/packages/node/20.11.1/environment b/packages/node/20.11.1/environment new file mode 100644 index 0000000..bd0ff98 --- /dev/null +++ b/packages/node/20.11.1/environment @@ -0,0 +1 @@ +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/node/20.11.1/metadata.json b/packages/node/20.11.1/metadata.json new file mode 100644 index 0000000..d401ad5 --- /dev/null +++ b/packages/node/20.11.1/metadata.json @@ -0,0 +1,10 @@ +{ + "language": "node", + "version": "20.11.1", + "provides": [ + { + "language": "javascript", + "aliases": ["node-javascript", "node-js", "javascript", "js"] + } + ] +} \ No newline at end of file diff --git a/packages/node/20.11.1/run b/packages/node/20.11.1/run new file mode 100644 index 0000000..6d1fdee --- /dev/null +++ b/packages/node/20.11.1/run @@ -0,0 +1,3 @@ +#!/bin/bash + +node "$@" \ No newline at end of file diff --git a/packages/node/20.11.1/test.js b/packages/node/20.11.1/test.js new file mode 100644 index 0000000..c963843 --- /dev/null +++ b/packages/node/20.11.1/test.js @@ -0,0 +1 @@ +console.log('OK'); \ No newline at end of file From c4cf018be2e73a378de9bfd64f36b7804804f164 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 18 Apr 2024 17:25:14 +0545 Subject: [PATCH 47/59] add Dart 3.0.1 package (#602) --- packages/dart/3.0.1/build.sh | 11 +++++++++++ packages/dart/3.0.1/environment | 4 ++++ packages/dart/3.0.1/metadata.json | 5 +++++ packages/dart/3.0.1/run | 4 ++++ packages/dart/3.0.1/test.dart | 3 +++ 5 files changed, 27 insertions(+) create mode 100755 packages/dart/3.0.1/build.sh create mode 100644 packages/dart/3.0.1/environment create mode 100644 packages/dart/3.0.1/metadata.json create mode 100644 packages/dart/3.0.1/run create mode 100644 packages/dart/3.0.1/test.dart diff --git a/packages/dart/3.0.1/build.sh b/packages/dart/3.0.1/build.sh new file mode 100755 index 0000000..02e9f7e --- /dev/null +++ b/packages/dart/3.0.1/build.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +curl -L "https://storage.googleapis.com/dart-archive/channels/stable/release/3.0.1/sdk/dartsdk-linux-x64-release.zip" -o dart.zip + +unzip dart.zip +rm dart.zip + +cp -r dart-sdk/* . +rm -rf dart-sdk + +chmod -R +rx bin \ No newline at end of file diff --git a/packages/dart/3.0.1/environment b/packages/dart/3.0.1/environment new file mode 100644 index 0000000..c6ab089 --- /dev/null +++ b/packages/dart/3.0.1/environment @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/dart/3.0.1/metadata.json b/packages/dart/3.0.1/metadata.json new file mode 100644 index 0000000..afc3ae2 --- /dev/null +++ b/packages/dart/3.0.1/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "dart", + "version": "3.0.1", + "aliases": [] +} \ No newline at end of file diff --git a/packages/dart/3.0.1/run b/packages/dart/3.0.1/run new file mode 100644 index 0000000..062d7c6 --- /dev/null +++ b/packages/dart/3.0.1/run @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Put instructions to run the runtime +dart run "$@" \ No newline at end of file diff --git a/packages/dart/3.0.1/test.dart b/packages/dart/3.0.1/test.dart new file mode 100644 index 0000000..27e87b2 --- /dev/null +++ b/packages/dart/3.0.1/test.dart @@ -0,0 +1,3 @@ +void main() { + print('OK'); +} \ No newline at end of file From 59338eee333606af6b7e5aa459ce63b6a3da2757 Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Mon, 24 Jun 2024 18:59:19 -0500 Subject: [PATCH 48/59] Update readme.md (#660) --- readme.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 7ef99b5..040e74d 100644 --- a/readme.md +++ b/readme.md @@ -89,11 +89,10 @@ GET https://emkc.org/api/v2/piston/runtimes POST https://emkc.org/api/v2/piston/execute ``` -> Important Note: The Piston API is rate limited to 5 requests per second. If you have a need for more requests than that -> and it's for a good cause, please reach out to me (EngineerMan#0001) on [Discord](https://discord.gg/engineerman) -> so we can discuss potentially getting you an unlimited key. What is and isn't a good cause is up to me, but, in general -> if your project is a) open source, b) helping people at no cost to them, and c) not likely to use tons of resources -> thereby impairing another's ability to enjoy Piston, you'll likely be granted a key. +> Important Note: The Piston API is rate limited to 5 requests per second. Effective May 7, 2024, no additional +> unlimited keys will be granted and existing keys will be revoked on Jan 1, 2025. The public instance is at +> capacity and the public limit is already very generous. For usage beyond 5 requests/second, you should +> consider self hosting.
From bd42fe335707768e6adfbd5a95afa082c80c9378 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sun, 8 Sep 2024 04:58:40 +0300 Subject: [PATCH 49/59] Improve isolation, execution limits and execution metrics by using Isolate (#683) * Initial: use Isolate for isolation * Continue: use Isolate for isolation * Bug fixes * timeout is wall-time for backward compatibility * Documentation, signal names, reported time in ms * Report memory usage in bytes * Add privileged flags where needed * Remove tmpfs * Remove tmpfs * Fix package installation * Fix path, fix Zig: CRLF -> LF --- .github/workflows/package-pr.yaml | 2 +- api/Dockerfile | 25 +- api/src/api/v2.js | 79 +--- api/src/config.js | 16 +- api/src/docker-entrypoint.sh | 13 + api/src/globals.js | 66 +++- api/src/index.js | 4 - api/src/job.js | 612 ++++++++++++++---------------- api/src/package.js | 6 +- api/src/runtime.js | 15 + builder/build.sh | 8 +- docker-compose.dev.yaml | 5 +- docker-compose.yaml | 2 +- docs/configuration.md | 19 +- packages/zig/0.10.1/compile | 12 +- packages/zig/0.10.1/environment | 8 +- packages/zig/0.10.1/metadata.json | 17 +- packages/zig/0.10.1/run | 8 +- packages/zig/0.10.1/test.zig | 12 +- packages/zig/0.8.0/metadata.json | 3 +- packages/zig/0.9.1/metadata.json | 3 +- readme.md | 27 +- 22 files changed, 508 insertions(+), 454 deletions(-) create mode 100755 api/src/docker-entrypoint.sh diff --git a/.github/workflows/package-pr.yaml b/.github/workflows/package-pr.yaml index 7a550f2..e0c5e12 100644 --- a/.github/workflows/package-pr.yaml +++ b/.github/workflows/package-pr.yaml @@ -92,7 +92,7 @@ jobs: docker run -v $(pwd)'/repo:/piston/repo' -v $(pwd)'/packages:/piston/packages' -d --name repo docker.pkg.github.com/engineer-man/piston/repo-builder --no-build docker pull docker.pkg.github.com/engineer-man/piston/api docker build -t piston-api api - docker run --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api + docker run --privileged --network container:repo -v $(pwd)'/data:/piston' -e PISTON_LOG_LEVEL=DEBUG -e 'PISTON_REPO_URL=http://localhost:8000/index' -d --name api piston-api echo Waiting for API to start.. docker run --network container:api appropriate/curl -s --retry 10 --retry-connrefused http://localhost:2000/api/v2/runtimes diff --git a/api/Dockerfile b/api/Dockerfile index ec0d2a8..51367f0 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,20 +1,29 @@ -FROM node:15.10.0-buster-slim +FROM buildpack-deps:bookworm AS isolate +RUN apt-get update && \ + apt-get install -y --no-install-recommends git libcap-dev && \ + rm -rf /var/lib/apt/lists/* && \ + git clone https://github.com/envicutor/isolate.git /tmp/isolate/ && \ + cd /tmp/isolate && \ + git checkout af6db68042c3aa0ded80787fbb78bc0846ea2114 && \ + make -j$(nproc) install && \ + rm -rf /tmp/* + +FROM node:20-bookworm-slim ENV DEBIAN_FRONTEND=noninteractive RUN dpkg-reconfigure -p critical dash -RUN for i in $(seq 1001 1500); do \ - groupadd -g $i runner$i && \ - useradd -M runner$i -g $i -u $i ; \ - done RUN apt-get update && \ apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev \ binutils build-essential locales libpcre3-dev libevent-dev libgmp3-dev \ libncurses6 libncurses5 libedit-dev libseccomp-dev rename procps python3 \ libreadline-dev libblas-dev liblapack-dev libpcre3-dev libarpack2-dev \ libfftw3-dev libglpk-dev libqhull-dev libqrupdate-dev libsuitesparse-dev \ - libsundials-dev libpcre2-dev && \ + libsundials-dev libpcre2-dev libcap-dev && \ rm -rf /var/lib/apt/lists/* +RUN useradd -M piston +COPY --from=isolate /usr/local/bin/isolate /usr/local/bin +COPY --from=isolate /usr/local/etc/isolate /usr/local/etc/isolate RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen @@ -23,7 +32,5 @@ COPY ["package.json", "package-lock.json", "./"] RUN npm install COPY ./src ./src -RUN make -C ./src/nosocket/ all && make -C ./src/nosocket/ install - -CMD [ "node", "src"] +CMD ["/piston_api/src/docker-entrypoint.sh"] EXPOSE 2000/tcp diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 032fd51..f8e2b57 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -6,50 +6,9 @@ const events = require('events'); const runtime = require('../runtime'); const { Job } = require('../job'); const package = require('../package'); +const globals = require('../globals'); const logger = require('logplease').create('api/v2'); -const SIGNALS = [ - 'SIGABRT', - 'SIGALRM', - 'SIGBUS', - 'SIGCHLD', - 'SIGCLD', - 'SIGCONT', - 'SIGEMT', - 'SIGFPE', - 'SIGHUP', - 'SIGILL', - 'SIGINFO', - 'SIGINT', - 'SIGIO', - 'SIGIOT', - 'SIGKILL', - 'SIGLOST', - 'SIGPIPE', - 'SIGPOLL', - 'SIGPROF', - 'SIGPWR', - 'SIGQUIT', - 'SIGSEGV', - 'SIGSTKFLT', - 'SIGSTOP', - 'SIGTSTP', - 'SIGSYS', - 'SIGTERM', - 'SIGTRAP', - 'SIGTTIN', - 'SIGTTOU', - 'SIGUNUSED', - 'SIGURG', - 'SIGUSR1', - 'SIGUSR2', - 'SIGVTALRM', - 'SIGXCPU', - 'SIGXFSZ', - 'SIGWINCH', -]; -// ref: https://man7.org/linux/man-pages/man7/signal.7.html - function get_job(body) { let { language, @@ -61,6 +20,8 @@ function get_job(body) { run_memory_limit, run_timeout, compile_timeout, + run_cpu_time, + compile_cpu_time, } = body; return new Promise((resolve, reject) => { @@ -106,7 +67,7 @@ function get_job(body) { }); } - for (const constraint of ['memory_limit', 'timeout']) { + for (const constraint of ['memory_limit', 'timeout', 'cpu_time']) { for (const type of ['compile', 'run']) { const constraint_name = `${type}_${constraint}`; const constraint_value = body[constraint_name]; @@ -135,23 +96,23 @@ function get_job(body) { } } - compile_timeout = compile_timeout || rt.timeouts.compile; - run_timeout = run_timeout || rt.timeouts.run; - compile_memory_limit = compile_memory_limit || rt.memory_limits.compile; - run_memory_limit = run_memory_limit || rt.memory_limits.run; resolve( new Job({ runtime: rt, - args: args || [], - stdin: stdin || '', + args: args ?? [], + stdin: stdin ?? '', files, timeouts: { - run: run_timeout, - compile: compile_timeout, + run: run_timeout ?? rt.timeouts.run, + compile: compile_timeout ?? rt.timeouts.compile, + }, + cpu_times: { + run: run_cpu_time ?? rt.cpu_times.run, + compile: compile_cpu_time ?? rt.cpu_times.compile, }, memory_limits: { - run: run_memory_limit, - compile: compile_memory_limit, + run: run_memory_limit ?? rt.memory_limits.run, + compile: compile_memory_limit ?? rt.memory_limits.compile, }, }) ); @@ -211,7 +172,7 @@ router.ws('/connect', async (ws, req) => { job = await get_job(msg); try { - await job.prime(); + const box = await job.prime(); ws.send( JSON.stringify({ @@ -221,7 +182,7 @@ router.ws('/connect', async (ws, req) => { }) ); - await job.execute(event_bus); + await job.execute(box, event_bus); } catch (error) { logger.error( `Error cleaning up job: ${job.uuid}:\n${error}` @@ -248,7 +209,9 @@ router.ws('/connect', async (ws, req) => { break; case 'signal': if (job !== null) { - if (SIGNALS.includes(msg.signal)) { + if ( + Object.values(globals.SIGNALS).includes(msg.signal) + ) { event_bus.emit('signal', msg.signal); } else { ws.close(4005, 'Invalid signal'); @@ -279,9 +242,9 @@ router.post('/execute', async (req, res) => { return res.status(400).json(error); } try { - await job.prime(); + const box = await job.prime(); - let result = await job.execute(); + let result = await job.execute(box); // Backward compatibility when the run stage is not started if (result.run === undefined) { result.run = result.compile; diff --git a/api/src/config.js b/api/src/config.js index b8fa97d..034e3b6 100644 --- a/api/src/config.js +++ b/api/src/config.js @@ -90,6 +90,18 @@ const options = { parser: parse_int, validators: [(x, raw) => !is_nan(x) || `${raw} is not a number`], }, + compile_cpu_time: { + desc: 'Max CPU time allowed for compile stage in milliseconds', + default: 10000, // 10 seconds + parser: parse_int, + validators: [(x, raw) => !is_nan(x) || `${raw} is not a number`], + }, + run_cpu_time: { + desc: 'Max CPU time allowed for run stage in milliseconds', + default: 3000, // 3 seconds + parser: parse_int, + validators: [(x, raw) => !is_nan(x) || `${raw} is not a number`], + }, compile_memory_limit: { desc: 'Max memory usage for compile stage in bytes (set to -1 for no limit)', default: -1, // no limit @@ -117,7 +129,7 @@ const options = { limit_overrides: { desc: 'Per-language exceptions in JSON format for each of:\ max_process_count, max_open_files, max_file_size, compile_memory_limit,\ - run_memory_limit, compile_timeout, run_timeout, output_max_size', + run_memory_limit, compile_timeout, run_timeout, compile_cpu_time, run_cpu_time, output_max_size', default: {}, parser: parse_overrides, validators: [ @@ -165,6 +177,8 @@ function parse_overrides(overrides_string) { 'run_memory_limit', 'compile_timeout', 'run_timeout', + 'compile_cpu_time', + 'run_cpu_time', 'output_max_size', ].includes(key) ) { diff --git a/api/src/docker-entrypoint.sh b/api/src/docker-entrypoint.sh new file mode 100755 index 0000000..7cf37e3 --- /dev/null +++ b/api/src/docker-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cd /sys/fs/cgroup && \ +mkdir isolate/ && \ +echo 1 > isolate/cgroup.procs && \ +echo '+cpuset +cpu +io +memory +pids' > cgroup.subtree_control && \ +cd isolate && \ +mkdir init && \ +echo 1 > init/cgroup.procs && \ +echo '+cpuset +memory' > cgroup.subtree_control && \ +echo "Initialized cgroup" && \ +chown -R piston:piston /piston && \ +exec su -- piston -c 'ulimit -n 65536 && node /piston_api/src' diff --git a/api/src/globals.js b/api/src/globals.js index 933d2ca..c2fef42 100644 --- a/api/src/globals.js +++ b/api/src/globals.js @@ -7,14 +7,78 @@ const platform = `${is_docker() ? 'docker' : 'baremetal'}-${fs .split('\n') .find(x => x.startsWith('ID')) .replace('ID=', '')}`; +const SIGNALS = { + 1: 'SIGHUP', + 2: 'SIGINT', + 3: 'SIGQUIT', + 4: 'SIGILL', + 5: 'SIGTRAP', + 6: 'SIGABRT', + 7: 'SIGBUS', + 8: 'SIGFPE', + 9: 'SIGKILL', + 10: 'SIGUSR1', + 11: 'SIGSEGV', + 12: 'SIGUSR2', + 13: 'SIGPIPE', + 14: 'SIGALRM', + 15: 'SIGTERM', + 16: 'SIGSTKFLT', + 17: 'SIGCHLD', + 18: 'SIGCONT', + 19: 'SIGSTOP', + 20: 'SIGTSTP', + 21: 'SIGTTIN', + 22: 'SIGTTOU', + 23: 'SIGURG', + 24: 'SIGXCPU', + 25: 'SIGXFSZ', + 26: 'SIGVTALRM', + 27: 'SIGPROF', + 28: 'SIGWINCH', + 29: 'SIGIO', + 30: 'SIGPWR', + 31: 'SIGSYS', + 34: 'SIGRTMIN', + 35: 'SIGRTMIN+1', + 36: 'SIGRTMIN+2', + 37: 'SIGRTMIN+3', + 38: 'SIGRTMIN+4', + 39: 'SIGRTMIN+5', + 40: 'SIGRTMIN+6', + 41: 'SIGRTMIN+7', + 42: 'SIGRTMIN+8', + 43: 'SIGRTMIN+9', + 44: 'SIGRTMIN+10', + 45: 'SIGRTMIN+11', + 46: 'SIGRTMIN+12', + 47: 'SIGRTMIN+13', + 48: 'SIGRTMIN+14', + 49: 'SIGRTMIN+15', + 50: 'SIGRTMAX-14', + 51: 'SIGRTMAX-13', + 52: 'SIGRTMAX-12', + 53: 'SIGRTMAX-11', + 54: 'SIGRTMAX-10', + 55: 'SIGRTMAX-9', + 56: 'SIGRTMAX-8', + 57: 'SIGRTMAX-7', + 58: 'SIGRTMAX-6', + 59: 'SIGRTMAX-5', + 60: 'SIGRTMAX-4', + 61: 'SIGRTMAX-3', + 62: 'SIGRTMAX-2', + 63: 'SIGRTMAX-1', + 64: 'SIGRTMAX', +}; module.exports = { data_directories: { packages: 'packages', - jobs: 'jobs', }, version: require('../package.json').version, platform, pkg_installed_file: '.ppman-installed', //Used as indication for if a package was installed clean_directories: ['/dev/shm', '/run/lock', '/tmp', '/var/tmp'], + SIGNALS, }; diff --git a/api/src/index.js b/api/src/index.js index 6ad9390..4a6dd42 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -35,10 +35,6 @@ expressWs(app); } } }); - fss.chmodSync( - path.join(config.data_directory, globals.data_directories.jobs), - 0o711 - ); logger.info('Loading packages'); const pkgdir = path.join( diff --git a/api/src/job.js b/api/src/job.js index a2641f9..e573843 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -1,13 +1,10 @@ const logplease = require('logplease'); -const logger = logplease.create('job'); const { v4: uuidv4 } = require('uuid'); const cp = require('child_process'); const path = require('path'); const config = require('./config'); -const globals = require('./globals'); const fs = require('fs/promises'); -const fss = require('fs'); -const wait_pid = require('waitpid'); +const globals = require('./globals'); const job_states = { READY: Symbol('Ready to be primed'), @@ -15,17 +12,26 @@ const job_states = { EXECUTED: Symbol('Executed and ready for cleanup'), }; -let uid = 0; -let gid = 0; +const MAX_BOX_ID = 999; +const ISOLATE_PATH = '/usr/local/bin/isolate'; +let box_id = 0; let remaining_job_spaces = config.max_concurrent_jobs; let job_queue = []; -class Job { - #active_timeouts; - #active_parent_processes; +const get_next_box_id = () => ++box_id % MAX_BOX_ID; - constructor({ runtime, files, args, stdin, timeouts, memory_limits }) { +class Job { + #dirty_boxes; + constructor({ + runtime, + files, + args, + stdin, + timeouts, + cpu_times, + memory_limits, + }) { this.uuid = uuidv4(); this.logger = logplease.create(`job/${this.uuid}`); @@ -46,29 +52,39 @@ class Job { this.stdin += '\n'; } - this.#active_timeouts = []; - this.#active_parent_processes = []; - this.timeouts = timeouts; + this.cpu_times = cpu_times; this.memory_limits = memory_limits; - this.uid = config.runner_uid_min + uid; - this.gid = config.runner_gid_min + gid; - - uid++; - gid++; - - uid %= config.runner_uid_max - config.runner_uid_min + 1; - gid %= config.runner_gid_max - config.runner_gid_min + 1; - - this.logger.debug(`Assigned uid=${this.uid} gid=${this.gid}`); - this.state = job_states.READY; - this.dir = path.join( - config.data_directory, - globals.data_directories.jobs, - this.uuid - ); + this.#dirty_boxes = []; + } + + async #create_isolate_box() { + const box_id = get_next_box_id(); + const metadata_file_path = `/tmp/${box_id}-metadata.txt`; + return new Promise((res, rej) => { + cp.exec( + `isolate --init --cg -b${box_id}`, + (error, stdout, stderr) => { + if (error) { + rej( + `Failed to run isolate --init: ${error.message}\nstdout: ${stdout}\nstderr: ${stderr}` + ); + } + if (stdout === '') { + rej('Received empty stdout from isolate --init'); + } + const box = { + id: box_id, + metadata_file_path, + dir: `${stdout.trim()}/box`, + }; + this.#dirty_boxes.push(box); + res(box); + } + ); + }); } async prime() { @@ -80,208 +96,235 @@ class Job { } this.logger.info(`Priming job`); remaining_job_spaces--; - this.logger.debug('Writing files to job cache'); - - this.logger.debug(`Transfering ownership`); - - await fs.mkdir(this.dir, { mode: 0o700 }); - await fs.chown(this.dir, this.uid, this.gid); + this.logger.debug('Running isolate --init'); + const box = await this.#create_isolate_box(); + this.logger.debug(`Creating submission files in Isolate box`); + const submission_dir = path.join(box.dir, 'submission'); + await fs.mkdir(submission_dir); for (const file of this.files) { - const file_path = path.join(this.dir, file.name); - const rel = path.relative(this.dir, file_path); - const file_content = Buffer.from(file.content, file.encoding); + const file_path = path.join(submission_dir, file.name); + const rel = path.relative(submission_dir, file_path); if (rel.startsWith('..')) throw Error( `File path "${file.name}" tries to escape parent directory: ${rel}` ); + const file_content = Buffer.from(file.content, file.encoding); + await fs.mkdir(path.dirname(file_path), { recursive: true, mode: 0o700, }); - await fs.chown(path.dirname(file_path), this.uid, this.gid); - await fs.write_file(file_path, file_content); - await fs.chown(file_path, this.uid, this.gid); } this.state = job_states.PRIMED; this.logger.debug('Primed job'); + return box; } - exit_cleanup() { - for (const timeout of this.#active_timeouts) { - clear_timeout(timeout); - } - this.#active_timeouts = []; - this.logger.debug('Cleared the active timeouts'); + async safe_call( + box, + file, + args, + timeout, + cpu_time, + memory_limit, + event_bus = null + ) { + let stdout = ''; + let stderr = ''; + let output = ''; + let memory = null; + let code = null; + let signal = null; + let message = null; + let status = null; + let cpu_time_stat = null; + let wall_time_stat = null; - this.cleanup_processes(); - this.logger.debug(`Finished exit cleanup`); - } - - close_cleanup() { - for (const proc of this.#active_parent_processes) { - proc.stderr.destroy(); - if (!proc.stdin.destroyed) { - proc.stdin.end(); - proc.stdin.destroy(); - } - proc.stdout.destroy(); - } - this.#active_parent_processes = []; - this.logger.debug('Destroyed processes writables'); - } - - async safe_call(file, args, timeout, memory_limit, event_bus = null) { - return new Promise((resolve, reject) => { - const nonetwork = config.disable_networking ? ['nosocket'] : []; - - const prlimit = [ - 'prlimit', - '--nproc=' + this.runtime.max_process_count, - '--nofile=' + this.runtime.max_open_files, - '--fsize=' + this.runtime.max_file_size, - ]; - - const timeout_call = [ - 'timeout', + const proc = cp.spawn( + ISOLATE_PATH, + [ + '--run', + `-b${box.id}`, + `--meta=${box.metadata_file_path}`, + '--cg', '-s', - '9', - Math.ceil(timeout / 1000), - ]; - - if (memory_limit >= 0) { - prlimit.push('--as=' + memory_limit); - } - - const proc_call = [ - 'nice', - ...timeout_call, - ...prlimit, - ...nonetwork, - 'bash', + '-c', + '/box/submission', + '-e', + `--dir=/runtime=${this.runtime.pkgdir}`, + `--dir=/etc:noexec`, + `--processes=${this.runtime.max_process_count}`, + `--open-files=${this.runtime.max_open_files}`, + `--fsize=${Math.floor(this.runtime.max_file_size / 1000)}`, + `--wall-time=${timeout / 1000}`, + `--time=${cpu_time / 1000}`, + `--extra-time=0`, + ...(memory_limit >= 0 + ? [`--cg-mem=${Math.floor(memory_limit / 1000)}`] + : []), + ...(config.disable_networking ? [] : ['--share-net']), + '--', + '/bin/bash', file, ...args, - ]; - - var stdout = ''; - var stderr = ''; - var output = ''; - - const proc = cp.spawn(proc_call[0], proc_call.splice(1), { + ], + { env: { ...this.runtime.env_vars, PISTON_LANGUAGE: this.runtime.language, }, stdio: 'pipe', - cwd: this.dir, - uid: this.uid, - gid: this.gid, - detached: true, //give this process its own process group - }); - - this.#active_parent_processes.push(proc); - - if (event_bus === null) { - proc.stdin.write(this.stdin); - proc.stdin.end(); - proc.stdin.destroy(); - } else { - event_bus.on('stdin', data => { - proc.stdin.write(data); - }); - - event_bus.on('kill', signal => { - proc.kill(signal); - }); } + ); - const kill_timeout = - (timeout >= 0 && - set_timeout(async _ => { - this.logger.info(`Timeout exceeded timeout=${timeout}`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } - }, timeout)) || - null; - this.#active_timeouts.push(kill_timeout); - - proc.stderr.on('data', async data => { - if (event_bus !== null) { - event_bus.emit('stderr', data); - } else if ((stderr.length + data.length) > this.runtime.output_max_size) { - this.logger.info(`stderr length exceeded`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } - } else { - stderr += data; - output += data; - } + if (event_bus === null) { + proc.stdin.write(this.stdin); + proc.stdin.end(); + proc.stdin.destroy(); + } else { + event_bus.on('stdin', data => { + proc.stdin.write(data); }); - proc.stdout.on('data', async data => { - if (event_bus !== null) { - event_bus.emit('stdout', data); - } else if ((stdout.length + data.length) > this.runtime.output_max_size) { - this.logger.info(`stdout length exceeded`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } - } else { - stdout += data; - output += data; - } + event_bus.on('kill', signal => { + proc.kill(signal); }); + } - proc.on('exit', () => this.exit_cleanup()); + proc.stderr.on('data', async data => { + if (event_bus !== null) { + event_bus.emit('stderr', data); + } else if ( + stderr.length + data.length > + this.runtime.output_max_size + ) { + message = 'stderr length exceeded'; + this.logger.info(message); + try { + process.kill(proc.pid, 'SIGABRT'); + } catch (e) { + // Could already be dead and just needs to be waited on + this.logger.debug( + `Got error while SIGABRTing process ${proc}:`, + e + ); + } + } else { + stderr += data; + output += data; + } + }); - proc.on('close', (code, signal) => { - this.close_cleanup(); + proc.stdout.on('data', async data => { + if (event_bus !== null) { + event_bus.emit('stdout', data); + } else if ( + stdout.length + data.length > + this.runtime.output_max_size + ) { + message = 'stdout length exceeded'; + this.logger.info(message); + try { + process.kill(proc.pid, 'SIGABRT'); + } catch (e) { + // Could already be dead and just needs to be waited on + this.logger.debug( + `Got error while SIGABRTing process ${proc}:`, + e + ); + } + } else { + stdout += data; + output += data; + } + }); - resolve({ stdout, stderr, code, signal, output }); + const data = await new Promise((res, rej) => { + proc.on('exit', (_, signal) => { + res({ + signal, + }); }); proc.on('error', err => { - this.exit_cleanup(); - this.close_cleanup(); - - reject({ error: err, stdout, stderr, output }); + rej({ + error: err, + }); }); }); + + try { + const metadata_str = ( + await fs.read_file(box.metadata_file_path) + ).toString(); + const metadata_lines = metadata_str.split('\n'); + for (const line of metadata_lines) { + if (!line) continue; + + const [key, value] = line.split(':'); + if (key === undefined || value === undefined) { + throw new Error( + `Failed to parse metadata file, received: ${line}` + ); + } + switch (key) { + case 'cg-mem': + memory = parse_int(value) * 1000; + break; + case 'exitcode': + code = parse_int(value); + break; + case 'exitsig': + signal = globals.SIGNALS[parse_int(value)] ?? null; + break; + case 'message': + message = message || value; + break; + case 'status': + status = value; + break; + case 'time': + cpu_time_stat = parse_float(value) * 1000; + break; + case 'time-wall': + wall_time_stat = parse_float(value) * 1000; + break; + default: + break; + } + } + } catch (e) { + throw new Error( + `Error reading metadata file: ${box.metadata_file_path}\nError: ${e.message}\nIsolate run stdout: ${stdout}\nIsolate run stderr: ${stderr}` + ); + } + + return { + ...data, + stdout, + stderr, + code, + signal, + output, + memory, + message, + status, + cpu_time: cpu_time_stat, + wall_time: wall_time_stat, + }; } - async execute(event_bus = null) { + async execute(box, event_bus = null) { if (this.state !== job_states.PRIMED) { throw new Error( 'Job must be in primed state, current state: ' + - this.state.toString() + this.state.toString() ); } @@ -298,49 +341,61 @@ class Job { const { emit_event_bus_result, emit_event_bus_stage } = event_bus === null ? { - emit_event_bus_result: () => { }, - emit_event_bus_stage: () => { }, - } + emit_event_bus_result: () => {}, + emit_event_bus_stage: () => {}, + } : { - emit_event_bus_result: (stage, result, event_bus) => { - const { error, code, signal } = result; - event_bus.emit('exit', stage, { - error, - code, - signal, - }); - }, - emit_event_bus_stage: (stage, event_bus) => { - event_bus.emit('stage', stage); - }, - }; + emit_event_bus_result: (stage, result) => { + const { error, code, signal } = result; + event_bus.emit('exit', stage, { + error, + code, + signal, + }); + }, + emit_event_bus_stage: stage => { + event_bus.emit('stage', stage); + }, + }; if (this.runtime.compiled) { this.logger.debug('Compiling'); - emit_event_bus_stage('compile', event_bus); + emit_event_bus_stage('compile'); compile = await this.safe_call( - path.join(this.runtime.pkgdir, 'compile'), + box, + '/runtime/compile', code_files.map(x => x.name), this.timeouts.compile, + this.cpu_times.compile, this.memory_limits.compile, event_bus ); - emit_event_bus_result('compile', compile, event_bus); + emit_event_bus_result('compile', compile); compile_errored = compile.code !== 0; + if (!compile_errored) { + const old_box_dir = box.dir; + box = await this.#create_isolate_box(); + await fs.rename( + path.join(old_box_dir, 'submission'), + path.join(box.dir, 'submission') + ); + } } let run; if (!compile_errored) { this.logger.debug('Running'); - emit_event_bus_stage('run', event_bus); + emit_event_bus_stage('run'); run = await this.safe_call( - path.join(this.runtime.pkgdir, 'run'), + box, + '/runtime/run', [code_files[0].name, ...this.args], this.timeouts.run, + this.cpu_times.run, this.memory_limits.run, event_bus ); - emit_event_bus_result('run', run, event_bus); + emit_event_bus_result('run', run); } this.state = job_states.EXECUTED; @@ -353,139 +408,34 @@ class Job { }; } - cleanup_processes(dont_wait = []) { - let processes = [1]; - const to_wait = []; - this.logger.debug(`Cleaning up processes`); - - while (processes.length > 0) { - processes = []; - - const proc_ids = fss.readdir_sync('/proc'); - - processes = proc_ids.map(proc_id => { - if (isNaN(proc_id)) return -1; - try { - const proc_status = fss.read_file_sync( - path.join('/proc', proc_id, 'status') - ); - const proc_lines = proc_status.to_string().split('\n'); - const state_line = proc_lines.find(line => - line.starts_with('State:') - ); - const uid_line = proc_lines.find(line => - line.starts_with('Uid:') - ); - const [_, ruid, euid, suid, fuid] = uid_line.split(/\s+/); - - const [_1, state, user_friendly] = state_line.split(/\s+/); - - 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) - - return proc_id_int; - } catch { - return -1; - } - - return -1; - }); - - processes = processes.filter(p => p > 0); - - if (processes.length > 0) - this.logger.debug(`Got processes to kill: ${processes}`); - - for (const proc of processes) { - // First stop the processes, but keep their resources allocated so they cant re-fork - try { - process.kill(proc, 'SIGSTOP'); - } catch (e) { - // Could already be dead - this.logger.debug( - `Got error while SIGSTOPping process ${proc}:`, - e - ); - } - } - - for (const proc of processes) { - // Then clear them out of the process tree - try { - process.kill(proc, 'SIGKILL'); - } catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } - - to_wait.push(proc); - } - } - - this.logger.debug( - `Finished kill-loop, calling wait_pid to end any zombie processes` - ); - - for (const proc of to_wait) { - if (dont_wait.includes(proc)) continue; - - wait_pid(proc); - } - - this.logger.debug(`Cleaned up processes`); - } - - async cleanup_filesystem() { - for (const clean_path of globals.clean_directories) { - const contents = await fs.readdir(clean_path); - - for (const file of contents) { - const file_path = path.join(clean_path, file); - - try { - const stat = await fs.stat(file_path); - - if (stat.uid === this.uid) { - await fs.rm(file_path, { - recursive: true, - force: true, - }); - } - } catch (e) { - // File was somehow deleted in the time that we read the dir to when we checked the file - this.logger.warn(`Error removing file ${file_path}: ${e}`); - } - } - } - - await fs.rm(this.dir, { recursive: true, force: true }); - } - async cleanup() { this.logger.info(`Cleaning up job`); - this.exit_cleanup(); // Run process janitor, just incase there are any residual processes somehow - this.close_cleanup(); - await this.cleanup_filesystem(); - remaining_job_spaces++; if (job_queue.length > 0) { job_queue.shift()(); } + await Promise.all( + this.#dirty_boxes.map(async box => { + cp.exec( + `isolate --cleanup --cg -b${box.id}`, + (error, stdout, stderr) => { + if (error) { + this.logger.error( + `Failed to run isolate --cleanup: ${error.message} on box #${box.id}\nstdout: ${stdout}\nstderr: ${stderr}` + ); + } + } + ); + try { + await fs.rm(box.metadata_file_path); + } catch (e) { + this.logger.error( + `Failed to remove the metadata directory of box #${box.id}. Error: ${e.message}` + ); + } + }) + ); } } diff --git a/api/src/package.js b/api/src/package.js index 11e4f34..8edb008 100644 --- a/api/src/package.js +++ b/api/src/package.js @@ -145,7 +145,11 @@ class Package { await fs.write_file(path.join(this.install_path, '.env'), filtered_env); logger.debug('Changing Ownership of package directory'); - await util.promisify(chownr)(this.install_path, 0, 0); + await util.promisify(chownr)( + this.install_path, + process.getuid(), + process.getgid() + ); logger.debug('Writing installed state to disk'); await fs.write_file( diff --git a/api/src/runtime.js b/api/src/runtime.js index 6c6f10e..1d4a8fc 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -15,6 +15,7 @@ class Runtime { pkgdir, runtime, timeouts, + cpu_times, memory_limits, max_process_count, max_open_files, @@ -27,6 +28,7 @@ class Runtime { this.pkgdir = pkgdir; this.runtime = runtime; this.timeouts = timeouts; + this.cpu_times = cpu_times; this.memory_limits = memory_limits; this.max_process_count = max_process_count; this.max_open_files = max_open_files; @@ -62,6 +64,18 @@ class Runtime { language_limit_overrides ), }, + cpu_times: { + compile: this.compute_single_limit( + language_name, + 'compile_cpu_time', + language_limit_overrides + ), + run: this.compute_single_limit( + language_name, + 'run_cpu_time', + language_limit_overrides + ), + }, memory_limits: { compile: this.compute_single_limit( language_name, @@ -171,6 +185,7 @@ class Runtime { .split('\n') .map(line => line.split('=', 2)) .forEach(([key, val]) => { + val = val.replace_all(this.pkgdir, '/runtime'); this._env_vars[key.trim()] = val.trim(); }); } diff --git a/builder/build.sh b/builder/build.sh index eaae21d..8087e9f 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -23,20 +23,20 @@ fetch_packages(){ mkdir build # Start a piston container docker run \ + --privileged \ -v "$PWD/build":'/piston/packages' \ - --tmpfs /piston/jobs \ -dit \ -p $port:2000 \ --name builder_piston_instance \ ghcr.io/engineer-man/piston - + # Ensure the CLI is installed cd ../cli npm i cd - # Evalulate the specfile - ../cli/index.js -u "http://127.0.0.1:$port" ppman spec $1 + ../cli/index.js -u "http://127.0.0.1:$port" ppman spec $1 } build_container(){ @@ -61,4 +61,4 @@ fetch_packages $SPEC_FILE build_container $TAG echo "Start your custom piston container with" -echo "$ docker run --tmpfs /piston/jobs -dit -p 2000:2000 $TAG" +echo "$ docker run --privileged -dit -p 2000:2000 $TAG" diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index 8a0d385..33f615d 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -4,8 +4,7 @@ services: api: build: api container_name: piston_api - cap_add: - - CAP_SYS_ADMIN + privileged: true restart: always ports: - 2000:2000 @@ -13,8 +12,6 @@ services: - ./data/piston/packages:/piston/packages environment: - PISTON_REPO_URL=http://repo:8000/index - tmpfs: - - /piston/jobs:exec,uid=1000,gid=1000,mode=711 repo: # Local testing of packages build: repo diff --git a/docker-compose.yaml b/docker-compose.yaml index 839b340..ea62b06 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,10 +5,10 @@ services: image: ghcr.io/engineer-man/piston container_name: piston_api restart: always + privileged: true ports: - 2000:2000 volumes: - ./data/piston/packages:/piston/packages tmpfs: - - /piston/jobs:exec,uid=1000,gid=1000,mode=711 - /tmp:exec diff --git a/docs/configuration.md b/docs/configuration.md index 1a6f5bd..163cd08 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -135,8 +135,21 @@ key: default: 3000 ``` -The maximum time that is allowed to be taken by a stage in milliseconds. -Use -1 for unlimited time. +The maximum time that is allowed to be taken by a stage in milliseconds. This is the wall-time of the stage. The time that the CPU does not spend working on the stage (e.g, due to context switches or IO) is counted. + +## Compile/Run CPU-Time + +```yaml +key: + - PISTON_COMPILE_CPU_TIME +default: 10000 + +key: + - PISTON_RUN_CPU_TIME +default: 3000 +``` + +The maximum CPU-time that is allowed to be consumed by a stage in milliseconds. The time that the CPU does not spend working on the stage (e.g, IO and context switches) is not counted. This option is typically used in algorithm contests. ## Compile/Run memory limits @@ -178,7 +191,7 @@ default: {} ``` Per-language overrides/exceptions for the each of `max_process_count`, `max_open_files`, `max_file_size`, -`compile_memory_limit`, `run_memory_limit`, `compile_timeout`, `run_timeout`, `output_max_size`. Defined as follows: +`compile_memory_limit`, `run_memory_limit`, `compile_timeout`, `run_timeout`, `compile_cpu_time`, `run_cpu_time`, `output_max_size`. Defined as follows: ``` PISTON_LIMIT_OVERRIDES={"c++":{"max_process_count":128}} diff --git a/packages/zig/0.10.1/compile b/packages/zig/0.10.1/compile index c0b03d1..75ee6ba 100644 --- a/packages/zig/0.10.1/compile +++ b/packages/zig/0.10.1/compile @@ -1,6 +1,6 @@ -#!/usr/bin/env bash - -# optimizing for small programs -rename 's/$/\.zig/' "$@" # Add .zig extension - -zig build-exe -O ReleaseSafe --color off --cache-dir . --global-cache-dir . --name out *.zig \ No newline at end of file +#!/usr/bin/env bash + +# optimizing for small programs +rename 's/$/\.zig/' "$@" # Add .zig extension + +zig build-exe -O ReleaseSafe --color off --cache-dir . --global-cache-dir . --name out *.zig diff --git a/packages/zig/0.10.1/environment b/packages/zig/0.10.1/environment index 8752bdb..a85000c 100644 --- a/packages/zig/0.10.1/environment +++ b/packages/zig/0.10.1/environment @@ -1,4 +1,4 @@ -#!/usr/bin/env bash - -# compiler path -export PATH=$PWD/bin:$PATH \ No newline at end of file +#!/usr/bin/env bash + +# compiler path +export PATH=$PWD/bin:$PATH diff --git a/packages/zig/0.10.1/metadata.json b/packages/zig/0.10.1/metadata.json index 9ecb955..c7bed08 100644 --- a/packages/zig/0.10.1/metadata.json +++ b/packages/zig/0.10.1/metadata.json @@ -1,8 +1,9 @@ -{ - "language": "zig", - "version": "0.10.1", - "aliases": [], - "limit_overrides": { - "compile_timeout": 15000 - } -} \ No newline at end of file +{ + "language": "zig", + "version": "0.10.1", + "aliases": [], + "limit_overrides": { + "compile_timeout": 15000, + "compile_cpu_time": 15000 + } +} diff --git a/packages/zig/0.10.1/run b/packages/zig/0.10.1/run index 70376eb..d96e06f 100644 --- a/packages/zig/0.10.1/run +++ b/packages/zig/0.10.1/run @@ -1,4 +1,4 @@ -#!/usr/bin/env bash - -shift # Filename is only used in compile step, so we can take it out here -./out "$@" \ No newline at end of file +#!/usr/bin/env bash + +shift # Filename is only used in compile step, so we can take it out here +./out "$@" diff --git a/packages/zig/0.10.1/test.zig b/packages/zig/0.10.1/test.zig index f0e287e..7cb5eb6 100644 --- a/packages/zig/0.10.1/test.zig +++ b/packages/zig/0.10.1/test.zig @@ -1,6 +1,6 @@ -const std = @import("std"); - -pub fn main() !void { - const stdout = std.io.getStdOut().writer(); - try stdout.print("OK\n", .{}); -} \ No newline at end of file +const std = @import("std"); + +pub fn main() !void { + const stdout = std.io.getStdOut().writer(); + try stdout.print("OK\n", .{}); +} diff --git a/packages/zig/0.8.0/metadata.json b/packages/zig/0.8.0/metadata.json index 8c02d33..38bc1fc 100644 --- a/packages/zig/0.8.0/metadata.json +++ b/packages/zig/0.8.0/metadata.json @@ -3,6 +3,7 @@ "version": "0.8.0", "aliases": ["zig"], "limit_overrides": { - "compile_timeout": 15000 + "compile_timeout": 15000, + "compile_cpu_time": 15000 } } diff --git a/packages/zig/0.9.1/metadata.json b/packages/zig/0.9.1/metadata.json index e7061cd..1ad7a70 100644 --- a/packages/zig/0.9.1/metadata.json +++ b/packages/zig/0.9.1/metadata.json @@ -3,6 +3,7 @@ "version": "0.9.1", "aliases": ["zig"], "limit_overrides": { - "compile_timeout": 15000 + "compile_timeout": 15000, + "compile_cpu_time": 15000 } } diff --git a/readme.md b/readme.md index 040e74d..18e9e5a 100644 --- a/readme.md +++ b/readme.md @@ -104,7 +104,8 @@ POST https://emkc.org/api/v2/piston/execute - Docker - Docker Compose -- Node JS (>= 13, preferably >= 15) +- Node JS (>= 15) +- cgroup v2 enabled, and cgroup v1 disabled ### After system dependencies are installed, clone this repository: @@ -135,8 +136,8 @@ The API will now be online with no language runtimes installed. To install runti ```sh docker run \ + --privileged \ -v $PWD:'/piston' \ - --tmpfs /piston/jobs \ -dit \ -p 2000:2000 \ --name piston_api \ @@ -245,8 +246,10 @@ This endpoint requests execution of some arbitrary code. - `files[].encoding` (_optional_) The encoding scheme used for the file content. One of `base64`, `hex` or `utf8`. Defaults to `utf8`. - `stdin` (_optional_) The text to pass as stdin to the program. Must be a string or left out. Defaults to blank string. - `args` (_optional_) The arguments to pass to the program. Must be an array or left out. Defaults to `[]`. -- `compile_timeout` (_optional_) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `10000` (10 seconds). -- `run_timeout` (_optional_) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `3000` (3 seconds). +- `compile_timeout` (_optional_) The maximum wall-time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `10000` (10 seconds). +- `run_timeout` (_optional_) The maximum wall-time allowed for the run stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `3000` (3 seconds). +- `compile_cpu_time` (_optional_) The maximum CPU-time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `10000` (10 seconds). +- `run_cpu_time` (_optional_) The maximum CPU-time allowed for the run stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to `3000` (3 seconds). - `compile_memory_limit` (_optional_) The maximum amount of memory the compile stage is allowed to use in bytes. Must be a number or left out. Defaults to `-1` (no limit) - `run_memory_limit` (_optional_) The maximum amount of memory the run stage is allowed to use in bytes. Must be a number or left out. Defaults to `-1` (no limit) @@ -264,6 +267,8 @@ This endpoint requests execution of some arbitrary code. "args": ["1", "2", "3"], "compile_timeout": 10000, "run_timeout": 3000, + "compile_cpu_time": 10000, + "run_cpu_time": 3000, "compile_memory_limit": -1, "run_memory_limit": -1 } @@ -273,7 +278,12 @@ A typical response upon successful execution will contain 1 or 2 keys `run` and `compile` will only be present if the language requested requires a compile stage. Each of these keys has an identical structure, containing both a `stdout` and `stderr` key, which is a string containing the text outputted during the stage into each buffer. -It also contains the `code` and `signal` which was returned from each process. +It also contains the `code` and `signal` which was returned from each process. It also includes a nullable human-readable `message` which is a description of why a stage has failed and a two-letter `status` that is either: + +- `RE` for runtime error +- `SG` for dying on a signal +- `TO` for timeout (either via `timeout` or `cpu_time`) +- `XX` for internal error ```json HTTP/1.1 200 OK @@ -287,7 +297,12 @@ Content-Type: application/json "stderr": "", "output": "[\n '/piston/packages/node/15.10.0/bin/node',\n '/piston/jobs/9501b09d-0105-496b-b61a-e5148cf66384/my_cool_code.js',\n '1',\n '2',\n '3'\n]\n", "code": 0, - "signal": null + "signal": null, + "message": null, + "status": null, + "cpu_time": 8, + "wall_time": 154, + "memory": 1160000 } } ``` From a99ce9ae4763a6a7a014c5cf43f6fd53ab3cffe8 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 13 Sep 2024 15:14:16 +0300 Subject: [PATCH 50/59] Remove nosocket, update security principles in docs --- api/src/nosocket/Makefile | 19 ------------ api/src/nosocket/nosocket.c | 62 ------------------------------------- readme.md | 20 ++++++------ 3 files changed, 10 insertions(+), 91 deletions(-) delete mode 100644 api/src/nosocket/Makefile delete mode 100644 api/src/nosocket/nosocket.c diff --git a/api/src/nosocket/Makefile b/api/src/nosocket/Makefile deleted file mode 100644 index a86a8f5..0000000 --- a/api/src/nosocket/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -CC = gcc -CFLAGS = -O2 -Wall -lseccomp -TARGET = nosocket -BUILD_PATH = ./ -INSTALL_PATH = /usr/local/bin/ -SOURCE = nosocket.c - -all: $(TARGET) - -$(TARGET): $(SOURCE) - $(CC) $(BUILD_PATH)$(SOURCE) $(CFLAGS) -o $(TARGET) - -install: - mv $(TARGET) $(INSTALL_PATH) - -clean: - $(RM) $(TARGET) - $(RM) $(INSTALL_PATH)$(TARGET) - diff --git a/api/src/nosocket/nosocket.c b/api/src/nosocket/nosocket.c deleted file mode 100644 index 4efab88..0000000 --- a/api/src/nosocket/nosocket.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -nosocket.c - -Disables access to the `socket` syscall and runs a program provided as the first -commandline argument. -*/ -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - // Disallow any new capabilities from being added - prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); - - // SCMP_ACT_ALLOW lets the filter have no effect on syscalls not matching a - // configured filter rule (allow all by default) - scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_ALLOW); - if (!ctx) - { - fprintf(stderr, "Unable to initialize seccomp filter context\n"); - return 1; - } - - // Add 32 bit and 64 bit architectures to seccomp filter - int rc; - uint32_t arch[] = {SCMP_ARCH_X86_64, SCMP_ARCH_X86, SCMP_ARCH_X32}; - // We first remove the existing arch, otherwise our subsequent call to add - // it will fail - seccomp_arch_remove(ctx, seccomp_arch_native()); - for (int i = 0; i < sizeof(arch) / sizeof(arch[0]); i++) - { - rc = seccomp_arch_add(ctx, arch[i]); - if (rc != 0) - { - fprintf(stderr, "Unable to add arch: %d\n", arch[i]); - return 1; - } - } - - // Add a seccomp rule to the syscall blacklist - blacklist the socket syscall - if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EACCES), SCMP_SYS(socket), 0) < 0) - { - fprintf(stderr, "Unable to add seccomp rule to context\n"); - return 1; - } - -#ifdef DEBUG - seccomp_export_pfc(ctx, 0); -#endif - - if (argc < 2) - { - fprintf(stderr, "Usage %s: %s \n", argv[0], argv[0]); - return 1; - } - seccomp_load(ctx); - execvp(argv[1], argv + 1); - return 1; -} diff --git a/readme.md b/readme.md index 18e9e5a..2c19b5e 100644 --- a/readme.md +++ b/readme.md @@ -411,26 +411,26 @@ Content-Type: application/json # Principle of Operation -Piston uses Docker as the primary mechanism for sandboxing. There is an API within the container written in Node -which takes in execution requests and executees them within the container safely. -High level, the API writes any source code to a temporary directory in `/piston/jobs`. +Piston uses [Isolate](https://www.ucw.cz/moe/isolate.1.html) inside Docker as the primary mechanism for sandboxing. There is an API within the container written in Node +which takes in execution requests and executes them within the container safely. +High level, the API writes any source code and executes it inside an Isolate sandbox. The source file is either ran or compiled and ran (in the case of languages like c, c++, c#, go, etc.).
# Security -Docker provides a great deal of security out of the box in that it's separate from the system. -Piston takes additional steps to make it resistant to -various privilege escalation, denial-of-service, and resource saturation threats. These steps include: +Piston uses Isolate which makes use of Linux namespaces, chroot, multiple unprivileged users, and cgroup for sandboxing and resource limiting. Code execution submissions on Piston shall not be aware of each other, shall not affect each other and shall not affect the underlying host system. This is ensured through multiple steps including: -- Disabling outgoing network interaction +- Disabling outgoing network interaction by default - Capping max processes at 256 by default (resists `:(){ :|: &}:;`, `while True: os.fork()`, etc.) - Capping max files at 2048 (resists various file based attacks) - Cleaning up all temp space after each execution (resists out of drive space attacks) -- Running as a variety of unprivileged users -- Capping runtime execution at 3 seconds -- Capping stdout to 65536 characters (resists yes/no bombs and runaway output) +- Running each submission as a different unprivileged user +- Running each submission with its own isolated Linux namespaces +- Capping runtime execution at 3 seconds by default (CPU-time and wall-time) +- Capping the peak memory that all the submission's processes can use +- Capping stdout to 1024 characters by default (resists yes/no bombs and runaway output) - SIGKILLing misbehaving code
From ecdced9ee7104074cb05bd7aac156cafeaf31a69 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 13 Sep 2024 16:19:09 +0300 Subject: [PATCH 51/59] Add SIGKILL signal for output limits and timeout, add status for output limits --- api/src/job.js | 6 ++++-- readme.md | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index e573843..881aa9f 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -205,6 +205,7 @@ class Job { this.runtime.output_max_size ) { message = 'stderr length exceeded'; + status = 'EL'; this.logger.info(message); try { process.kill(proc.pid, 'SIGABRT'); @@ -229,6 +230,7 @@ class Job { this.runtime.output_max_size ) { message = 'stdout length exceeded'; + status = 'OL'; this.logger.info(message); try { process.kill(proc.pid, 'SIGABRT'); @@ -287,7 +289,7 @@ class Job { message = message || value; break; case 'status': - status = value; + status = status || value; break; case 'time': cpu_time_stat = parse_float(value) * 1000; @@ -310,7 +312,7 @@ class Job { stdout, stderr, code, - signal, + signal: ['TO', 'OL', 'EL'].includes(status) ? 'SIGKILL' : signal, output, memory, message, diff --git a/readme.md b/readme.md index 2c19b5e..f1172d3 100644 --- a/readme.md +++ b/readme.md @@ -283,6 +283,8 @@ It also contains the `code` and `signal` which was returned from each process. I - `RE` for runtime error - `SG` for dying on a signal - `TO` for timeout (either via `timeout` or `cpu_time`) +- `OL` for stdout length exceeded +- `EL` for stderr length exceeded - `XX` for internal error ```json From c4afd97a38013f7062a51a13f32802c6266fb089 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sun, 15 Sep 2024 20:48:45 +0300 Subject: [PATCH 52/59] Use pkgdir inside isolate sandbox to account for packages that have been built with a custom PREFIX closes #686 --- api/src/job.js | 8 ++++---- api/src/runtime.js | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 881aa9f..d46120b 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -157,7 +157,7 @@ class Job { '-c', '/box/submission', '-e', - `--dir=/runtime=${this.runtime.pkgdir}`, + `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, `--processes=${this.runtime.max_process_count}`, `--open-files=${this.runtime.max_open_files}`, @@ -171,7 +171,7 @@ class Job { ...(config.disable_networking ? [] : ['--share-net']), '--', '/bin/bash', - file, + path.join(this.runtime.pkgdir, file), ...args, ], { @@ -365,7 +365,7 @@ class Job { emit_event_bus_stage('compile'); compile = await this.safe_call( box, - '/runtime/compile', + 'compile', code_files.map(x => x.name), this.timeouts.compile, this.cpu_times.compile, @@ -390,7 +390,7 @@ class Job { emit_event_bus_stage('run'); run = await this.safe_call( box, - '/runtime/run', + 'run', [code_files[0].name, ...this.args], this.timeouts.run, this.cpu_times.run, diff --git a/api/src/runtime.js b/api/src/runtime.js index 1d4a8fc..9a2adf4 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -185,7 +185,6 @@ class Runtime { .split('\n') .map(line => line.split('=', 2)) .forEach(([key, val]) => { - val = val.replace_all(this.pkgdir, '/runtime'); this._env_vars[key.trim()] = val.trim(); }); } From 47661343dae343f06a34268997a28025720e6c60 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Tue, 17 Sep 2024 22:32:23 +0300 Subject: [PATCH 53/59] Downgrade base docker images because some packages were built on the previous image version (#687) --- api/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 51367f0..7ab81bf 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,4 +1,4 @@ -FROM buildpack-deps:bookworm AS isolate +FROM buildpack-deps:buster AS isolate RUN apt-get update && \ apt-get install -y --no-install-recommends git libcap-dev && \ rm -rf /var/lib/apt/lists/* && \ @@ -8,7 +8,7 @@ RUN apt-get update && \ make -j$(nproc) install && \ rm -rf /tmp/* -FROM node:20-bookworm-slim +FROM node:15.10.0-buster-slim ENV DEBIAN_FRONTEND=noninteractive From 24c5c05308abaffe59f84a403b0d7c27c772700b Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 4 Oct 2024 19:30:57 +0300 Subject: [PATCH 54/59] Give friendlier messages when cgroup v2 is not enabled --- api/src/docker-entrypoint.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/src/docker-entrypoint.sh b/api/src/docker-entrypoint.sh index 7cf37e3..2a4e49c 100755 --- a/api/src/docker-entrypoint.sh +++ b/api/src/docker-entrypoint.sh @@ -1,5 +1,21 @@ #!/bin/bash +CGROUP_FS="/sys/fs/cgroup" +if [ ! -e "$CGROUP_FS" ]; then + echo "Cannot find $CGROUP_FS. Please make sure your system is using cgroup v2" + exit 1 +fi + +if [ -e "$CGROUP_FS/unified" ]; then + echo "Combined cgroup v1+v2 mode is not supported. Please make sure your system is using pure cgroup v2" + exit 1 +fi + +if [ ! -e "$CGROUP_FS/cgroup.subtree_control" ]; then + echo "Cgroup v2 not found. Please make sure cgroup v2 is enabled on your system" + exit 1 +fi + cd /sys/fs/cgroup && \ mkdir isolate/ && \ echo 1 > isolate/cgroup.procs && \ From 512b63d2b50902cb4a79ad85dfa1e726ec0f4041 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 4 Oct 2024 19:53:33 +0300 Subject: [PATCH 55/59] Document interactive execution --- readme.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/readme.md b/readme.md index f1172d3..9034264 100644 --- a/readme.md +++ b/readme.md @@ -320,6 +320,40 @@ Content-Type: application/json } ``` +#### Interactive execution endpoint (not available through the public API) + +To interact with running processes in real time, you can establish a WebSocket connection at `/api/v2/connect`. This allows you to both receive output and send input to active processes. + +Each message is structured as a JSON object with a `type` key, which indicates the action to perform. Below is a list of message types, their directions, and descriptions: + +- **init** (client -> server): Initializes a job with the same parameters as the `/execute` endpoint, except that stdin is discarded. +- **runtime** (server -> client): Provides details on the runtime environment, including the version and language. +- **stage** (server -> client): Indicates the current execution stage, either "compile" or "run." +- **data** (server <-> client): Exchanges data between the client and server, such as stdin, stdout, or stderr streams. +- **signal** (client -> server): Sends a signal (e.g., for termination) to the running process, whether it's in the "compile" or "run" stage. +- **exit** (server -> client): Signals the end of a stage, along with the exit code or signal. +- **error** (server -> client): Reports an error, typically right before the WebSocket is closed. + +An example of this endpoint in use is depicted below (**<** = client to server, **>** = server to client) + +1. Client establishes WebSocket connection to `/api/v2/connect` +2. **<** `{"type":"init", "language":"bash", "version":"*", "files":[{"content": "cat"}]}` +3. **>** `{"type":"runtime","language": "bash", "version": "5.1.0"}` +4. **>** `{"type":"stage", "stage":"run"}` +5. **<** `{"type":"data", "stream":"stdin", "data":"Hello World!"}` +6. **>** `{"type":"data", "stream":"stdout", "data":"Hello World!"}` +7. _time passes_ +8. **>** `{"type":"exit", "stage":"run", "code":null, "signal": "SIGKILL"}` + +Errors may return status codes as follows: + +- **4000: Already Initialized**: Sent when a second `init` command is issued. +- **4001: Initialization Timeout**: No `init` command was sent within 1 second of connection. +- **4002: Notified Error**: A fatal error occurred, and an `error` packet was transmitted. +- **4003: Not yet Initialized**: A non-`init` command was sent without a job context. +- **4004: Can only write to stdin**: The client attempted to write to a stream other than stdin. +- **4005: Invalid Signal**: An invalid signal was sent in a `signal` packet. +
# Supported Languages From 4e361dcf924b4594f038511ff69752ee1a3f49a9 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 11 Oct 2024 21:42:58 +0300 Subject: [PATCH 56/59] Add note to ensure the repository is cloned with LF line endings --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index 9034264..7724fdb 100644 --- a/readme.md +++ b/readme.md @@ -114,6 +114,10 @@ POST https://emkc.org/api/v2/piston/execute git clone https://github.com/engineer-man/piston ``` +> [!NOTE] +> +> Ensure the repository is cloned with LF line endings + ### Installation ```sh From 6ef0cdf7b4c96e71d49ae267dc905c177ede1d51 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sat, 8 Feb 2025 15:10:50 +0200 Subject: [PATCH 57/59] Provide HOME in sandbox (#702) --- api/src/job.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/job.js b/api/src/job.js index d46120b..31f688d 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -156,6 +156,8 @@ class Job { '-s', '-c', '/box/submission', + '-E', + 'HOME=/tmp', '-e', `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, From 1d55a41a2d563318388596b46d7da772027339ba Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Sat, 8 Feb 2025 20:46:46 +0200 Subject: [PATCH 58/59] Explicitly provide env vars instead of inheriting them from parent (#703) --- api/src/job.js | 8 +++----- api/src/runtime.js | 10 +--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 31f688d..8c3fa79 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -158,7 +158,9 @@ class Job { '/box/submission', '-E', 'HOME=/tmp', - '-e', + ...this.runtime.env_vars.flat_map(v => ['-E', v]), + '-E', + `PISTON_LANGUAGE=${this.runtime.language}`, `--dir=${this.runtime.pkgdir}`, `--dir=/etc:noexec`, `--processes=${this.runtime.max_process_count}`, @@ -177,10 +179,6 @@ class Job { ...args, ], { - env: { - ...this.runtime.env_vars, - PISTON_LANGUAGE: this.runtime.language, - }, stdio: 'pipe', } ); diff --git a/api/src/runtime.js b/api/src/runtime.js index 9a2adf4..90a2225 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -178,15 +178,7 @@ class Runtime { const env_file = path.join(this.pkgdir, '.env'); const env_content = fss.read_file_sync(env_file).toString(); - this._env_vars = {}; - - env_content - .trim() - .split('\n') - .map(line => line.split('=', 2)) - .forEach(([key, val]) => { - this._env_vars[key.trim()] = val.trim(); - }); + this._env_vars = env_content.trim().split('\n'); } return this._env_vars; From c54bd64372a340b4112c0866b29f27e849cea434 Mon Sep 17 00:00:00 2001 From: scpchicken Date: Sat, 8 Feb 2025 20:42:07 -0700 Subject: [PATCH 59/59] pkg(k-1.0.0): Added k 1.0.0 --- packages/k/1.0.0/build.sh | 9 +++++++++ packages/k/1.0.0/environment | 5 +++++ packages/k/1.0.0/metadata.json | 5 +++++ packages/k/1.0.0/run | 3 +++ packages/k/1.0.0/test.k | 1 + readme.md | 1 + 6 files changed, 24 insertions(+) create mode 100644 packages/k/1.0.0/build.sh create mode 100644 packages/k/1.0.0/environment create mode 100644 packages/k/1.0.0/metadata.json create mode 100644 packages/k/1.0.0/run create mode 100644 packages/k/1.0.0/test.k diff --git a/packages/k/1.0.0/build.sh b/packages/k/1.0.0/build.sh new file mode 100644 index 0000000..567cc06 --- /dev/null +++ b/packages/k/1.0.0/build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +git clone "https://codeberg.org/ngn/k" k +cd k + +git checkout 544d014afd8dd84b18c2011cabd3aa3d76571ca3 +make CC=gcc diff --git a/packages/k/1.0.0/environment b/packages/k/1.0.0/environment new file mode 100644 index 0000000..7cde4ae --- /dev/null +++ b/packages/k/1.0.0/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# k path +export PATH=$PWD/bin:$PATH +export K_PATH=$PWD/k diff --git a/packages/k/1.0.0/metadata.json b/packages/k/1.0.0/metadata.json new file mode 100644 index 0000000..3a557f6 --- /dev/null +++ b/packages/k/1.0.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "k", + "version": "1.0.0", + "aliases": ["ngnk"] +} diff --git a/packages/k/1.0.0/run b/packages/k/1.0.0/run new file mode 100644 index 0000000..18293ae --- /dev/null +++ b/packages/k/1.0.0/run @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +$K_PATH/k "$@" diff --git a/packages/k/1.0.0/test.k b/packages/k/1.0.0/test.k new file mode 100644 index 0000000..16fddca --- /dev/null +++ b/packages/k/1.0.0/test.k @@ -0,0 +1 @@ +`0:`c$2/'((1 0 0 1 1 1 1);(1 0 0 1 0 1 1)) diff --git a/readme.md b/readme.md index 7724fdb..02a712f 100644 --- a/readme.md +++ b/readme.md @@ -404,6 +404,7 @@ Errors may return status codes as follows: `javascript`, `jelly`, `julia`, +`k`, `kotlin`, `lisp`, `llvm_ir`,