emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] fix infinite loop in csv table import
@ 2010-07-19 20:53 Eric Schulte
  2010-07-20  5:30 ` David Maus
  2010-07-20  7:29 ` Patchwork: Patch 159 Accepted Carsten Dominik
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Schulte @ 2010-07-19 20:53 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

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 <carsten.dominik@gmail.com>
| 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]  

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-table-fix-infinite-loop-in-table-importation.patch --]
[-- Type: text/x-diff, Size: 948 bytes --]

From 3c3f4ca9a34dca23051ca2f4e4518b416338d4f4 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix infinite loop in csv table import
  2010-07-19 20:53 [PATCH] fix infinite loop in csv table import Eric Schulte
@ 2010-07-20  5:30 ` David Maus
  2010-07-20  7:29 ` Patchwork: Patch 159 Accepted Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: David Maus @ 2010-07-20  5:30 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 874 bytes --]

Eric Schulte wrote:
>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

This patch looks good to me: If the end of the region happens to be
end-of-buffer point will never be greater than end and the loop loops
forever.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Patchwork: Patch 159 Accepted
  2010-07-19 20:53 [PATCH] fix infinite loop in csv table import Eric Schulte
  2010-07-20  5:30 ` David Maus
@ 2010-07-20  7:29 ` Carsten Dominik
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-07-20  7:29 UTC (permalink / raw)
  To: emacs-orgmode

Patch 159 (http://patchwork.newartisans.com/patch/159/) is now Accepted.

This relates to the following submission:

http://mid.gmane.org/%3C87r5izxkfp.fsf%40gmail.com%3E

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-20  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-19 20:53 [PATCH] fix infinite loop in csv table import Eric Schulte
2010-07-20  5:30 ` David Maus
2010-07-20  7:29 ` Patchwork: Patch 159 Accepted Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).