From e5e0f26b908fdb99928eb92a738935c586cbb945 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 30 Oct 2024 15:43:38 -0700 Subject: [PATCH] applets/pbot-vm: minor fixes * set `preserve_escapes` to 0 in guest/_c_base.pm so escapes are stripped in: ,show testcargs [global] testcargs: /code c11 printf("/say args: " ); while (*++argv) printf("[%s] " , *argv); ,testcargs foo\'bar baz\'qux args: [foo\'bar] [baz\'qux] to produce the desired output of: args: [foo'bar] [baz'qux] * set `keep_spaces` to 1 in host/_default.pm since it turns out that in some languages unquoted spaces are significant, e.g. in `sh ${1% *}` to strip text following two spaces. Without `keep_spaces` enabled, `sh ${1% *}` becomes `sh ${1% *}` and strips all text following one space instead of two. --- applets/pbot-vm/guest/lib/Languages/_c_base.pm | 2 +- applets/pbot-vm/host/lib/Languages/_default.pm | 2 +- lib/PBot/VERSION.pm | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applets/pbot-vm/guest/lib/Languages/_c_base.pm b/applets/pbot-vm/guest/lib/Languages/_c_base.pm index c6ddf4c8..353a0388 100755 --- a/applets/pbot-vm/guest/lib/Languages/_c_base.pm +++ b/applets/pbot-vm/guest/lib/Languages/_c_base.pm @@ -87,7 +87,7 @@ sub postprocess { my $ulimits = "ulimit -f 2000; ulimit -t 8; ulimit -u 200"; - my @args = split_line($self->{arguments}, strip_quotes => 1, preserve_escapes => 1); + my @args = split_line($self->{arguments}, strip_quotes => 1, preserve_escapes => 0); my $quoted_args = ''; diff --git a/applets/pbot-vm/host/lib/Languages/_default.pm b/applets/pbot-vm/host/lib/Languages/_default.pm index 8010e1fa..3f1a9ea3 100755 --- a/applets/pbot-vm/host/lib/Languages/_default.pm +++ b/applets/pbot-vm/host/lib/Languages/_default.pm @@ -53,7 +53,7 @@ sub process_interactive_edit($self) { } sub process_standard_options($self) { - my @opt_args = split_line($self->{code}, preserve_escapes => 1, keep_spaces => 0); + my @opt_args = split_line($self->{code}, preserve_escapes => 1, keep_spaces => 1); my $getopt_error; local $SIG{__WARN__} = sub { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 7b81a638..645c820b 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4816, - BUILD_DATE => "2024-10-29", + BUILD_REVISION => 4817, + BUILD_DATE => "2024-10-30", }; sub initialize {}