Note that user-defined functions defined in a RUN-OFF context will have RUN OFF during evaluation.

This commit is contained in:
Dianne Skoll
2025-08-15 20:43:59 -04:00
parent 7b7b861399
commit 6474f4e0b6
3 changed files with 41 additions and 6 deletions

View File

@@ -5325,6 +5325,12 @@ it is ignored and the built-in function is used. To prevent conflicts
with future versions of \fBRemind\fR (which may define more built-in
functions), you may wish to name all user-defined functions beginning
with an underscore.
.PP
If a user-defined function is defined in a context where \fBRUN\fR is
disabled, then whenever that function is called, \fBRUN\fR will be disabled
during its evaluation, \fIeven if\fR it is called from a context where
\fBRUN\fR is enabled.
.PP
To delete a user-defined function, use \fBFUNSET\fR. This takes a
space-separated list of user-defined functions to delete. For

View File

@@ -11,7 +11,20 @@ RUN ON
DEBUG +x
set a danger(1)
set b safe(1)
set b safe2(1)
set c safe2(1)
PUSH-FUNCS safe
FSET safe(x) shell("echo this will work")
SET b safe(1)
POP-FUNCS
SET b safe(1)
FRENAME safe gloopy
FRENAME danger bork
set a bork(1)
set b gloopy(1)
FRENAME gloopy safe
FRENAME bork danger
RUN OFF
set a danger(1)

View File

@@ -39699,27 +39699,43 @@ shell("echo oops") => RUN disabled
../tests/safety.rem(8): [#1] Called from function `safe2'
Leaving UserFN danger(1) => RUN disabled
Leaving UserFN safe2(1) => RUN disabled
Entering UserFN safe(1)
shell("echo this will work") => "this will work"
Leaving UserFN safe(1) => "this will work"
Entering UserFN safe(1)
shell("echo nope") => RUN disabled
../tests/safety.rem(20): shell(): RUN disabled
../tests/safety.rem(7): [#0] In function `safe'
Leaving UserFN safe(1) => RUN disabled
Entering UserFN bork(1)
shell("echo oops") => "oops"
Leaving UserFN bork(1) => "oops"
Entering UserFN gloopy(1)
shell("echo nope") => RUN disabled
../tests/safety.rem(25): shell(): RUN disabled
../tests/safety.rem(7): [#0] In function `gloopy'
Leaving UserFN gloopy(1) => RUN disabled
Entering UserFN danger(1)
shell("echo oops") => RUN disabled
../tests/safety.rem(17): shell(): RUN disabled
../tests/safety.rem(30): shell(): RUN disabled
../tests/safety.rem(4): [#0] In function `danger'
Leaving UserFN danger(1) => RUN disabled
Entering UserFN safe(1)
shell("echo nope") => RUN disabled
../tests/safety.rem(18): shell(): RUN disabled
../tests/safety.rem(31): shell(): RUN disabled
../tests/safety.rem(7): [#0] In function `safe'
Leaving UserFN safe(1) => RUN disabled
Entering UserFN safe2(1)
x => 1
Entering UserFN danger(1)
shell("echo oops") => RUN disabled
../tests/safety.rem(19): shell(): RUN disabled
../tests/safety.rem(32): shell(): RUN disabled
../tests/safety.rem(4): [#0] In function `danger'
../tests/safety.rem(8): [#1] Called from function `safe2'
Leaving UserFN danger(1) => RUN disabled
Leaving UserFN safe2(1) => RUN disabled
nooooo....
../tests/safety.rem(28): shell(): RUN disabled
../tests/safety.rem(24): [#0] In function `subst_b'
../tests/safety.rem(41): shell(): RUN disabled
../tests/safety.rem(37): [#0] In function `subst_b'
today
nooooo....