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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32608 invoked from network); 28 May 2020 20:31:41 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 28 May 2020 20:31:41 -0000 Received: (qmail 8549 invoked by alias); 28 May 2020 20:31:35 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45932 Received: (qmail 17335 invoked by uid 1010); 28 May 2020 20:31:35 -0000 X-Qmail-Scanner-Diagnostics: from wout4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25821. spamassassin: 3.4.4. Clear:RC:0(64.147.123.20):SA:0(-2.6/5.0):. Processed in 4.496351 secs); 28 May 2020 20:31:35 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddviedgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgogfeguddtqddvjeculdegtddmnecujfgurhephf fvufffkffojghfgggtgfesthektddtredtjeenucfhrhhomhepffgrnhhivghlucfuhhgr hhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrth htvghrnheptdfffeevueetuefhleejkeetfeelhefgjeetffetgfefieehueelfeffkeel leegnecukfhppeejledrudejiedrfeelrdeileenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhn rghmvg X-ME-Proxy: From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH 2/2] FAQ (3.1): Update ksh compatibility answer for reserved word typeset. Date: Thu, 28 May 2020 20:30:49 +0000 Message-Id: <20200528203049.13144-2-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200528203049.13144-1-danielsh@tarpaulin.shahaf.local2> References: <20200528203049.13144-1-danielsh@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Reported in 45922. I dropped the sentence about bash because I couldn't figure out what it was referring to with the term "this behaviour". bash on my system does word-split arguments that look like assignments with backticks on the RHS for commands other than «typeset». Etc/FAQ.yo | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 9b5e2206a..a327eb514 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -981,7 +981,7 @@ label(31) been automatic word splitting in scalars, which is a sort of uncontrollable poor man's array. - Note that this happens regardless of the value of the internal field + Note that word splitting happens regardless of the value of the internal field separator, tt($IFS); in other words, with mytt(IFS=:; foo=a:b; args $foo) you get the answer 1. @@ -1013,22 +1013,32 @@ label(31) or (entirely equivalent) when mytt(emulate ksh) or mytt(emulate sh) is in effect. - There is one other effect of word splitting which differs between ksh + There used to be another effect of word splitting which differed between ksh and zsh. In ksh, the builtin commands that declare parameters such as tt(typeset) and tt(export) force word-splitting not to take place after on an assignment argument: verb( typeset param=`echo foo bar` ) - in ksh will create a parameter with value mytt(foo bar), but in zsh will + in ksh will create a parameter with value mytt(foo bar). + + zsh used to create a parameter tt(param) with value tt(foo) and a parameter tt(bar) - whose value is empty. Contrast this with a normal assignment (no + whose value was empty. Contrast this with a normal assignment (no tt(typeset) or other command in front), which never causes a word split - unless you have tt(GLOB_ASSIGN) set. From zsh version 4.0.2 the option - tt(KSH_TYPESET), set automatically in compatibility mode, fixes this - problem. Note that in bash this behaviour occurs with all arguments that - look like assignments, whatever the command name; to get this behaviour - in zsh you have to set the option tt(MAGIC_EQUAL_SUBST). + unless you have tt(GLOB_ASSIGN) set. + + zsh version 4.0.2 and newer creates a single parameter with value + mytt(foo bar), like ksh does, when the option tt(KSH_TYPESET) is set. + This option gets set automatically when in ksh compatibility mode. + + zsh 5.1 and newer create a single parameter with value mytt(foo bar) by + default, in both compatibility and native modes. The older behaviour + can be obtained with mytt(disable -r typeset). + + If the options mytt(MAGIC_EQUAL_SUBST) and mytt(KSH_TYPESET) are both + set, arguments that look like assignments will not undergo word + splitting, whatever the command name. sect(In which startup file do I put...?)