From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26445 invoked from network); 5 Nov 2006 21:47:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Nov 2006 21:47:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 85708 invoked from network); 5 Nov 2006 21:47:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Nov 2006 21:47:40 -0000 Received: (qmail 469 invoked by alias); 5 Nov 2006 21:47:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22968 Received: (qmail 459 invoked from network); 5 Nov 2006 21:47:36 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Nov 2006 21:47:36 -0000 Received: (qmail 85412 invoked from network); 5 Nov 2006 21:47:36 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 5 Nov 2006 21:47:29 -0000 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20061105214731.KFLL1865.mtaout03-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Sun, 5 Nov 2006 21:47:31 +0000 Received: from pwslaptop.csr.com ([81.107.46.43]) by aamtaout02-winn.ispmail.ntl.com with SMTP id <20061105214728.QDMQ23938.aamtaout02-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Sun, 5 Nov 2006 21:47:28 +0000 Date: Sun, 5 Nov 2006 22:46:52 +0000 From: Peter Stephenson To: zsh-workers Subject: Re: Don't ask why i was trying to do this... Message-Id: <20061105224652.ed8b8c7b.p.w.stephenson@ntlworld.com> In-Reply-To: <237967ef0611041623ie8b3070nb2b1ffa4b6a2aef3@mail.gmail.com> References: <237967ef0611041623ie8b3070nb2b1ffa4b6a2aef3@mail.gmail.com> X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.8.20; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 5 Nov 2006 01:23:37 +0100 "Mikael Magnusson" wrote: > I'm not sure if this is supposed to work or not, > print $(eval "echo -n '\\U'{1..200}") > outputs the first 200 codepoints on stdout more or less correctly, > print -z $(eval "echo -n '\\U'{1..200}") > only pushes up until 3 characters after 'y' to the editing stack. Right, normal print handles unmetafied output correctly, but options -z as well as -s don't. \U83 contains a character which, when unmetafied, looks just like the Meta character. It's therefore very useful for testing. (As you probably already know, \U assumes the argument is hexadecimal, so the '\\U'{1..200}, which gives it decimal numbers, is a bit illogical, but that's not relevant to the bug.) This bug isn't new---someone decided it would be fantastic for getkeystring(), which does interpretation of character escapes for print, to return unmetafied output, since it would be easy to fix up bin_print() to handle that, wouldn't it? It isn't even documented. (In case you think I sound bitter, the motto of the CSR firmware group used to be "non sumus amari", which is Latin for "we're not bitter".) By the way, a rewrite of getkeystring() is part of my improvement for unquoting in completion, if that ever sees the light of day. Sorry, doing it again. Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.164 diff -u -r1.164 builtin.c --- Src/builtin.c 5 Oct 2006 21:53:26 -0000 1.164 +++ Src/builtin.c 5 Nov 2006 21:38:40 -0000 @@ -3454,6 +3454,14 @@ else \ count += fprintf(fout, spec, width, VAL); +/* + * Because of the use of getkeystring() to interpret the arguments, + * the elements of args spend a large part of the function unmetafied + * with the lengths in len. This may have seemed a good idea once. + * As we are stuck with this for now, we need to be very careful + * deciding what state args is in. + */ + /**/ int bin_print(char *name, char **args, Options ops, int func) @@ -3727,6 +3735,14 @@ /* normal output */ if (!fmt) { + if (OPT_ISSET(ops, 'z') || OPT_ISSET(ops, 's')) { + /* + * We don't want the arguments unmetafied after all. + */ + for (n = 0; n < argc; n++) + metafy(args[n], len[n], META_NOALLOC); + } + /* -z option -- push the arguments onto the editing buffer stack */ if (OPT_ISSET(ops,'z')) { queue_signals(); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/