From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: [PATCH] fix infinite loop in csv table import Date: Mon, 19 Jul 2010 13:53:30 -0700 Message-ID: <87r5izxkfp.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=51076 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OaxLE-000861-Ti for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 16:53:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OaxLD-0000j7-Mk for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 16:53:36 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:58446) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OaxLD-0000iz-HX for emacs-orgmode@gnu.org; Mon, 19 Jul 2010 16:53:35 -0400 Received: by pvc30 with SMTP id 30so4615689pvc.0 for ; Mon, 19 Jul 2010 13:53:33 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --=-=-= Hi, I've just noticed that I get an infinite loop when importing csv tables into Org-mode tables. For example calling (org-table-convert-region (point-min) (point-max) '(4)) from inside of a simple text file containing the following --8<---------------cut here---------------start------------->8--- 1,2,3 1 2 3 5 --8<---------------cut here---------------end--------------->8--- results in an infinite loop. The attached patch fixes this issue [1], however it seems weird that this would just surface now, given that the code in question has been in the repo since last fall ,---- | commit 59c9c4cdd4ae974dfb92ab441462b3fee48ab5af | Author: Carsten Dominik | Date: Mon Oct 26 12:31:16 2009 +0100 | | Correctly interpret CVS tables with quoted fields | | The csv parser was very primitive, ignoring quoted fields. This is | now fixed. `---- Has anyone else noticed this problem? Should I go ahead and apply this patch? Best -- Eric Footnotes: [1] --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-table-fix-infinite-loop-in-table-importation.patch >From 3c3f4ca9a34dca23051ca2f4e4518b416338d4f4 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 19 Jul 2010 13:45:25 -0700 Subject: [PATCH] org-table: fix infinite loop in table importation * lisp/org-table.el (org-table-convert-region): don't continue csv importation which the point catches the end, this fixes an infinite loop which was caused by the (point) never catching up with the "end" marker --- lisp/org-table.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index a0311d9..6172e1c 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -453,7 +453,7 @@ nil When nil, the command tries to be smart and figure out the (t 1)))) (goto-char beg) (if (equal separator '(4)) - (while (<= (point) end) + (while (< (point) end) ;; parse the csv stuff (cond ((looking-at "^") (insert "| ")) -- 1.7.0.4 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--