3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-07-21 21:07:24 +02:00

applets/qalc.pl: make qalc safe

This commit is contained in:
Pragmatic Software 2025-07-20 00:58:37 -07:00
parent 4582e225e5
commit 9d29336cb2
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
5 changed files with 25 additions and 2 deletions

6
applets/.qalc-safe-1 vendored Normal file
View File

@ -0,0 +1,6 @@
set save definitions 1
function export 0
function load 0
function command 0
function save 0
exit

2
applets/.qalc-safe-2 vendored Normal file
View File

@ -0,0 +1,2 @@
set save definitions 0
exit

3
applets/qalc-safe vendored Executable file
View File

@ -0,0 +1,3 @@
#/usr/bin/sh
yes | qalc -f .qalc-safe-1
qalc -f .qalc-safe-2

12
applets/qalc.pl vendored
View File

@ -11,6 +11,18 @@ if (not @ARGV) {
exit;
}
my $is_safe = `qalc export`;
if ($is_safe ne "export() = 0\n") {
system("./qalc-safe > /dev/null");
$is_safe = `qalc export`;
if ($is_safe ne "export() = 0\n") {
print "Fatal: Unable to make qalc safe. Execute `qalc-safe` and check for errors.\n";
exit;
}
}
my $result = `ulimit -t 2; qalc \Q@ARGV\E`;
$result =~ s/^.*approx.\s+//;

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4875,
BUILD_DATE => "2025-07-19",
BUILD_REVISION => 4876,
BUILD_DATE => "2025-07-20",
};
sub initialize {}