From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28357 invoked by alias); 30 Apr 2012 12:46:29 -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: X-Seq: 30459 Received: (qmail 28157 invoked from network); 30 Apr 2012 12:46:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Mon, 30 Apr 2012 13:46:14 +0100 From: Peter Stephenson To: Subject: Re: fc -lr broken in current git? Message-ID: <20120430134614.2104cda8@pwslap01u.europe.root.pri> In-Reply-To: <4F9E806D.9030206@gmail.com> References: <4F9E806D.9030206@gmail.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.101.10.18] X-Scanned-By: MailControl 7.7.0.1 (www.mailcontrol.com) on 10.71.0.131 On Mon, 30 Apr 2012 14:07:09 +0200 Hauke Petersen wrote: > fc -lr seems to be problematic in current git: Yes, it doesn't take account of the -r flag. I wonder if a better fix is only to check the order when actually executing code, which is where the problems happened. Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.256 diff -p -u -r1.256 builtin.c --- Src/builtin.c 7 Mar 2012 06:10:42 -0000 1.256 +++ Src/builtin.c 30 Apr 2012 12:45:12 -0000 @@ -1641,7 +1641,7 @@ static int fclist(FILE *f, Options ops, zlong first, zlong last, struct asgment *subs, Patprog pprog) { - int fclistdone = 0; + int fclistdone = 0, wrong_order; zlong tmp; char *s, *tdfmt, *timebuf; Histent ent; @@ -1651,8 +1651,11 @@ fclist(FILE *f, Options ops, zlong first tmp = last; last = first; first = tmp; + wrong_order = (last > first); + } else { + wrong_order = (first > last); } - if (first > last) { + if (wrong_order) { zwarnnam("fc", "history events are in wrong order, aborted"); if (f != stdout) fclose(f); -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog