From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13121 invoked from network); 1 Aug 2003 15:12:03 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 1 Aug 2003 15:12:03 -0000 Received: (qmail 16253 invoked by alias); 1 Aug 2003 15:11:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18920 Received: (qmail 16242 invoked from network); 1 Aug 2003 15:11:54 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 1 Aug 2003 15:11:54 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 1 Aug 2003 15:11:53 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.cambridgesiliconradio.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Fri, 1 Aug 2003 11:57:51 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 1 Aug 2003 11:56:57 +0100 To: zsh-workers@sunsite.dk Subject: Re: Segfault in completion code In-reply-to: "Haakon Riiser"'s message of "Thu, 31 Jul 2003 23:33:33 +0200." <20030731213333.GA27420@s.chello.no> Date: Fri, 01 Aug 2003 11:58:34 +0100 Message-ID: <3406.1059735514@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 01 Aug 2003 10:56:57.0489 (UTC) FILETIME=[A065C010:01C3581B] Haakon Riiser wrote: > But, there are still problems when SH_WORD_SPLIT is set. Here's an > example that should not depend on my local zsh configuration > (assuming that "zsh -f" only tries to load /etc/zshenv, which > does not exist on my system): > > % /path/to/patched/zsh -f > % unset IFS > % setopt SH_WORD_SPLIT > % autoload -U compinit > % compinit > % > (eval):setopt:1: no such option: globbareglobqualnullglobrcexpand\ > paramextendedglobunsetNO_markdirsNO_globsubstNO_shwordsplitNO_shglob\ > NO_kshglobNO_ksharraysNO_cshnullglobNO_allexportNO_aliasesNO_errexit\ > NO_octalzeroes The combined effect of shwordsplit and unsetting IFS causes the values in the list of options to be joined together with no spaces between. It looks harmless to put it back (IFS might be anything). However, my patch last night was wrong --- I've checked SUS/Posix 2003 and it says: IFS (Input Field Separators.) A string treated as a list of characters that is used for field splitting and to split lines into fields with the read command. If IFS is not set, the shell shall behave as if the value of IFS is , , and ; see Field Splitting . Implementations may ignore the value of IFS in the environment at the time the shell is invoked, treating IFS as if it were not set. so we should use space to join words. I don't know why it doesn't allow you to use no separator, but it doesn't. This is already handled correctly in other parts of the shell --- we use a default IFS. That fixes the immediate problem above, but as I said IFS might be something else, so I've still supplied the other hunk. The following patch applies on top of last night's fix (now committed). Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.52 diff -u -r1.52 utils.c --- Src/utils.c 1 Aug 2003 09:55:41 -0000 1.52 +++ Src/utils.c 1 Aug 2003 10:56:54 -0000 @@ -2058,6 +2058,8 @@ if (ifs) { *p++ = *ifs; *p++ = *ifs == Meta ? ifs[1] ^ 32 : '\0'; + } else { + *p++ = ' '; } *p = '\0'; } Index: Completion/Base/Core/_main_complete =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_main_complete,v retrieving revision 1.7 diff -u -r1.7 _main_complete --- Completion/Base/Core/_main_complete 26 Feb 2003 16:36:06 -0000 1.7 +++ Completion/Base/Core/_main_complete 1 Aug 2003 10:45:31 -0000 @@ -3,6 +3,8 @@ # The main loop of the completion code. This is what is called when # completion is attempted from the command line. +# In case non-standard separators are in use. +local IFS=$' \t\n\0' # If you want to complete only set or unset options for the unsetopt # and setopt builtin, un-comment these lines: -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************