From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,UNPARSEABLE_RELAY,URI_NOVOWEL autolearn=no autolearn_force=no version=3.4.4 Received: from authenticated user by zero.zsh.org with local id 1kiBDr-000AEA-OV; Thu, 26 Nov 2020 06:57:43 +0000 Authentication-Results: zsh.org; iprev=pass (relay8-d.mail.gandi.net) smtp.remote-ip=217.70.183.201; dmarc=none header.from=chazelas.org; arc=none Received: from relay8-d.mail.gandi.net ([217.70.183.201]:53269) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kiBDV-0009zg-0V; Thu, 26 Nov 2020 06:57:22 +0000 X-Originating-IP: 94.10.124.211 Received: from chazelas.org (unknown [94.10.124.211]) (Authenticated sender: stephane@chazelas.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 1E6311BF207 for ; Thu, 26 Nov 2020 06:57:19 +0000 (UTC) Date: Thu, 26 Nov 2020 06:57:19 +0000 From: Stephane Chazelas To: zsh-workers@zsh.org Subject: [PATCHv2 1/2] [long] improvements to limit/ulimit API and doc ((un)limit in csh emulation) Message-ID: <20201126065719.mqaljeb3cwd7k2k4@chazelas.org> Mail-Followup-To: zsh-workers@zsh.org References: <20201123214942.hi2rx7n3jk25ucmd@chazelas.org> <20201125003512.GC17978@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201125003512.GC17978@tarpaulin.shahaf.local2> X-Seq: 47632 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: 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 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