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=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5214 invoked from network); 13 Apr 2021 14:36:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Apr 2021 14:36:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1618324599; b=Peu8oGPlYbp8xCWLaVlkdImcYslIfaMHtDq828+Z2F4ZBa0WiUhED8JiKxqc+15DYfQyuww7E1 jsRXmhcI6abpEU/j6oarDpsA6sQxU5Lw+X1oDNQ6A1DMEbQ9TZYHyAG6X8I/+fleApRSUtOHpY cxcNEEB7HAJ7itNrUY80KUBdY7eKsjUBhZIz0GH3M2djdx/OQiBPS6Qgz9up3sZ5dXUTp+C8gY L+iO+mbLeJNa3kj0YY13DsPloGcpKQoZJbbAfiBiehkGTpIdj1O6QcCjYxuaIgBkjVP4GvUssY JMBwwmQp73OXrl7hZ+0YCOpDhdTLkyRmzQt3/kcWdAyg8Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1618324599; bh=Xczg8arifp1aqZNxm2zblU6TVK/SlTp0jm1i/HQNXCI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=E5CwWJKIvr0DlAy8dg+svhX4JDwV+3btpExdYxACQDP9USt2QUK1Zeh+QdUGq1km+3gpDwl4A1 trKucj3tksDbHiz9PVSCNEN9sYmOKVWWXUpOObyil53Qj7BKAQYFMMaO/wjVZdY12GIOGFWMq4 RYBk8DASbxiUK8q21H/rfswG/DuqWpckGv06hSH9DrtgmwfObdljE+DNZP72PVfpWmvThD4bpW f+l7vH0K4eXzmKTf0WuloGrwg1fAdMNp8AkKKB36B51fLcKjTg124HkqCS34/bWdI4RDCwWVVu SUtqEDc+LxDz6Rb+owCmAlDiPMIiBCwTUFf9MioIbeTDwg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=l5tdruFMPUXRY4oGeWxDZfwzCB1tjtEau/GjkAwXmTs=; b=N39qmMm5qyZPYE/EQA/aBAiPO+ F0cXYqkXbXSap3+I9GxbyHj45GiB+6Bt8z6Bcbv6L3aOiZwK3tP9OncZTpRhGVJJPeP0nvkCHIwHT EQ7pjbYo9Xtk900fRyRHRj1SSnYWUBYi29dxYPxXL2M9gcT/Dcf2rCwuCF1lywPvcYlgMady65fyt nto2P1igaVSb/xEYpbUUlmMBwzoBDaIZf3j57pPb4FYBp2sXarkT9y4OKmDOgzmYJScawIP6YF2Ic Gxgn0aAChXc9CIsvnFazcv7mXCx8VDzrjMujRpPndxqKYkfwVfZIkij/MLh2SjsRA+9t7Ovc7A6UU ZZ2rLPCQ==; Received: from authenticated user by zero.zsh.org with local id 1lWK9d-0002gV-7V; Tue, 13 Apr 2021 14:36:37 +0000 Authentication-Results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56739) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lWK91-0002RK-HF; Tue, 13 Apr 2021 14:36:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 16BB15C0184; Tue, 13 Apr 2021 10:35:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 13 Apr 2021 10:35:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm3; bh=l5tdruFMPUXRY4oGeWxDZfwzCB1tjtEau/GjkAwX mTs=; b=azQGYXlL1VuqH0/rYXecPfU2AlYAch7tiZEI7DbEz38izvHo/IKISF0j pc0p0ubCDGh/EHzxhYKBXAZ2NsgUFwp1VVbdm07Z5ARB7/p3fw1cyxnKjH6+td2a OMzti0MsXrSGLgkoFsXPayUFq0v9SfU1sW2HPy9KO2kHhcJIaxTwc6JJ4rKWbYII Qkozzs/uQ5upWV+uMqfL2lNP6mGkZ4vDIIw9smICLGGkVsg3b/dI6LP3hSKIwNsR zVAiQJoiskpHoLBrlGMB6JYfL6l8edlCxkWs8OYyaOUlU2tenDqtIxGY1Yi1G6+g 0s3Y6QM2KaiFgLY7dMRWdG4bBCX4sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=l5tdruFMPUXRY4oGeWxDZfwzCB1tjtEau/GjkAwXm Ts=; b=mCK+ERA1XljveaAsuOKHAzEPTwsRJvr4HFi8bHu42xlKpwON7w08kSMEn 1lzYdJsj2qjQATI5YcjQDXXSIW33xbam2UIBgIJjzQ8GjQNbsX8fgoAnT0W6jen7 IM4EuxwCIswLd6cRQZAyVuH418TiRdVA9Wk+xPOild2nR4oc/FecD4bBs6LlVeve AIWsP8B7J+2S/rA3uNvl7JSJfJh9AfSdij8tHmzUZWThgy2sUYxebrhof5FD+wKf 00dCkSEVzIzyKb2pCC+hHHTHWUNCfCc2PVQp81HCo763i/bHrsTXKkgJrZ2YOrpa NjWX1ma/Jd/CNxznEKTcBpMTuOlwg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudekledgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjggfsehtkedttddtredunecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpefgleehtdffuefhgeeuleefffejgedttdelhedvvdeuiefh vefgvdfghfevvdekteenucfkphepuddtledrieeirdeifedrvdeftdenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdr shhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-63-230.red.bezeqint.net [109.66.63.230]) by mail.messagingengine.com (Postfix) with ESMTPA id 8EB4224005B; Tue, 13 Apr 2021 10:35:57 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FKSp32dbRzhV; Tue, 13 Apr 2021 14:35:55 +0000 (UTC) Date: Tue, 13 Apr 2021 14:35:55 +0000 From: Daniel Shahaf To: Stephane Chazelas Cc: Zsh hackers list Subject: Re: [PATCH] ulimit option completions using ulimit -a output Message-ID: <20210413143555.GL6819@tarpaulin.shahaf.local2> References: <20201123214942.hi2rx7n3jk25ucmd@chazelas.org> <74327-1606347813.918593@HxCz.NV4p.AwzH> <20201126201431.a6ym56gcagomyvzk@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201126201431.a6ym56gcagomyvzk@chazelas.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48529 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: Stephane Chazelas wrote on Thu, Nov 26, 2020 at 20:14:31 +0000: > 2020-11-26 00:43:33 +0100, Oliver Kiddle: > [...] > > > * 1. Add zsh_LIMIT_PRESENT(RLIMIT_XXX) in configure.ac. > > > * 2. Add an entry for RLIMIT_XXX to known_resources[]. > > > * Make sure the option letter (resinto_T.opt) is unique. > > > - * 3. Build zsh and run the test B12rlimit.ztst. > > > + * 3. Add entry in documentation for the limit and ulimit builtins > > > + * 4. Build zsh and run the test B12rlimit.ztst. > > > > 5. Update Completion/Zsh/Command/_ulimit > > > > Units were often fairly well documented there but are missing in a > > couple of cases so you may be able to add a couple. > [...] > > The problem is that the list of ulimit options is system > dependent, so I propose the improvement below which uses the > output of ulimit -a to build the list of completions. Sorry for the very large delay on getting to review this. Thanks Lawrence for fishing it out of the archives. Review: > From: Stephane Chazelas > Date: Thu, 26 Nov 2020 19:22:03 +0000 > Subject: [PATCH] ulimit option completions using ulimit -a output > > The list of options supported by ulimit is system dependent. Rather than > hardcoding the full list of options supported on any system in the > completer, we get the list of options from the output of "ulimit -a". +1 > That means less descriptive descriptions but more relevant completions > to the user (and not having to update the completer every time a new > limit is added). Should we copy the more-descriptive descriptions to the output of `ulimit -a`? (I.e., known_resources[] in Src/Modules/rlimits.c) > +++ b/Completion/Zsh/Command/_ulimit > @@ -2,18 +2,16 @@ > > [[ $PREFIX = u* ]] && compadd unlimited && return 0 > > +local -a opts > +setopt localoptions extendedglob > + > +opts=( > + ${${${(fo)"$(ulimit -a)"}:#-N*}%% *} > +) > _arguments -s \ > '-H[set hard limits]' \ > '-S[set soft and hard limits (with -H)]' \ > - '(-H -S -c -d -f -l -m -n -s -t *)-a[list all current resource limits]' \ > - '-c[core dump size limit]:max core dump size (512-byte blocks)' \ > - '-d[maximum size of data segment]:maximum size of data segment (K-bytes)' \ > - '-f[size of largest file allowed]:size of largest file allowed (512-byte blocks)' \ > - '-l[maximum size of locked in memory]:maximum size of locked in memory (K-bytes)' \ > - '-m[maximum size of physical memory]:maximum size of physical memory (K-bytes)' \ > - '-n[maximum no. of open file descriptors]:maximum no. of open file descriptors' \ > - '-s[stack size limit]:stack size limit (K-bytes)' \ > - '-t[maximum cpu time per process]:maximum cpu time per process (seconds)' \ > - '-u[processes available to the user]:processes' \ > - '-v[maximum size of virtual memory]:maximum size of virtual memory (K-bytes)' \ > - '*:size of largest file allowed' > + '-N+[specify limit by number]:limit number::limit value' \ [Corrected per 47661] Why is the second argument optional? s/::/: :/? Completing «-N 15 » doesn't offer "rt cpu time (microseconds)", even though the output of `ulimit -a` does show that description. Completing after «-N » could offer "15". > + "(-N ${(M@j: :)opts#-?} *)-a[list all current resource limits]" \ > + ${opts/(#b)(-?): (*)/$match[1][$match[2]]:$match[2]} \ Escape colons in ${match[1]} and ${match[2]}. It would be nice to retain the current values in in $opts and then include them in the `message' part of the spec. > + '*:file size (blocks)' Sorry, what's this? The manual does mention additional positional arguments, but doesn't describe them, does it? Sorry again for our very late review. Review points that aren't regressions aren't blockers. Daniel