Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCHv2 1/2] [long] improvements to limit/ulimit API and doc ((un)limit in csh emulation)
2020-11-25 00:35:12 +0000, Daniel Shahaf:
[...]
> Could you please split this into one patch per logical change? That
> would make it easier to review, both now, and in the future should
> a regression be bisected to it.
[...]
Here is for the csh builtins, I'll send a second one for the
rest addressing Oliver's comments (doc, testcase, _ulimit)
hopefully tonight. I'll add a test case to verify we get errors
upon unexpected suffixes as well.
From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
Date: Thu, 26 Nov 2020 06:34:44 +0000
Subject: [PATCH] Re-enable `limit` and `unlimit` in csh emulation.
Those two builtins do come from csh (4BSD, 1980 along with resource
limits) in the first place, they were disabled when emulating *other*
shells, that should only have been for POSIX/ksh which have ulimit and
not limit.
-> changed the features_emu in rlimits.mdd (only used there) and
mkbltnmlst.sh to features_posix for those to only be disabled
in sh/ksh emulation.
---
Doc/Zsh/builtins.yo | 4 ++--
NEWS | 2 ++
Src/Builtins/rlimits.mdd | 8 +++++++-
Src/mkbltnmlst.sh | 10 +++++-----
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index ebb29f632..2f1ccd8a5 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1180,7 +1180,7 @@ sitem([var(mm)tt(:)]var(ss))(minutes and seconds)
endsitem()
The tt(limit) command is not made available by default when the
-shell starts in a mode emulating another shell. It can be made available
+shell starts in sh or ksh emulation mode. It can be made available
with the command `tt(zmodload -F zsh/rlimits b:limit)'.
)
findex(local)
@@ -2343,7 +2343,7 @@ The resources of the shell process are only changed if the tt(-s)
flag is given.
The tt(unlimit) command is not made available by default when the
-shell starts in a mode emulating another shell. It can be made available
+shell starts in sh or ksh emulation mode. It can be made available
with the command `tt(zmodload -F zsh/rlimits b:unlimit)'.
)
findex(unset)
diff --git a/NEWS b/NEWS
index a8e7df80e..d05e8b64f 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ The zsh/system module's `zsystem flock` command learnt an -i option to
set the wait interval used with -t. Additionally, -t now supports
fractional seconds.
+The `limit` and `unlimit` builtins are now available again in csh emulation.
+
Changes from 5.7.1-test-3 to 5.8
--------------------------------
diff --git a/Src/Builtins/rlimits.mdd b/Src/Builtins/rlimits.mdd
index 06c9e9c7f..248a03e61 100644
--- a/Src/Builtins/rlimits.mdd
+++ b/Src/Builtins/rlimits.mdd
@@ -3,6 +3,12 @@ link=either
load=yes
autofeatures="b:limit b:ulimit b:unlimit"
-autofeatures_emu="b:ulimit"
+
+# limit is the csh builtin, while ulimit is the ksh/posix one.
+# Autoloading ulimit in csh emulation should be relatively
+# harmless as "ulimit" contrary to "limit" is not otherwise
+# a common English word. So we're only accomodating sh/ksh
+# emulations.
+autofeatures_posix="b:ulimit"
objects="rlimits.o"
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
index c4611d8b3..7ebc2a751 100644
--- a/Src/mkbltnmlst.sh
+++ b/Src/mkbltnmlst.sh
@@ -37,10 +37,10 @@ for x_mod in $x_mods; do
echo "/* non-linked-in known module \`$x_mod' */"
linked=no
esac
- unset moddeps autofeatures autofeatures_emu
+ unset moddeps autofeatures autofeatures_posix
. $srcdir/../$modfile
if test "x$autofeatures" != x; then
- if test "x$autofeatures_emu" != x; then
+ if test "x$autofeatures_posix" != x; then
echo " {"
echo " char *zsh_features[] = { "
for feature in $autofeatures; do
@@ -48,14 +48,14 @@ for x_mod in $x_mods; do
done
echo " NULL"
echo " }; "
- echo " char *emu_features[] = { "
- for feature in $autofeatures_emu; do
+ echo " char *posix_features[] = { "
+ for feature in $autofeatures_posix; do
echo " \"$feature\","
done
echo " NULL"
echo " }; "
echo " autofeatures(\"zsh\", \"$x_mod\","
- echo " EMULATION(EMULATE_ZSH) ? zsh_features : emu_features,"
+ echo " EMULATION(EMULATE_KSH|EMULATE_SH) ? posix_features : zsh_features,"
echo " 0, 1);"
echo " }"
else
--
2.25.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author