GNU bug report logs - #46328
28.0.50; csv-transpose replaces field delimiters in quoted fields with newlines

Previous Next

Package: emacs;

Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>

Date: Fri, 5 Feb 2021 14:18:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46328 in the body.
You can then email your comments to 46328 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46328; Package emacs. (Fri, 05 Feb 2021 14:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Filipp Gunbin <fgunbin <at> fastmail.fm>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 05 Feb 2021 14:18:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; csv-transpose replaces field delimiters in quoted fields
 with newlines
Date: Fri, 05 Feb 2021 17:17:39 +0300
csv-mode 1.14 from elpa.  Both csv-separators and csv-field-quotes have
default values.

Create a new csv file with this single line:

--8<---------------cut here---------------start------------->8---
description,"a line, with comma, and another comma"
--8<---------------cut here---------------end--------------->8---

C-c C-t transforms this to:

--8<---------------cut here---------------start------------->8---
description
"a line
 with comma
 and another comma"
--8<---------------cut here---------------end--------------->8---

The commas inside a (quoted) field were replaced by newlines, this looks
like a bug.

Thanks.

In GNU Emacs 28.0.50 (build 3, x86_64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69))
 of 2021-02-05 built on fgunbin.local
Repository revision: f00afb9bb8b5356690e2a785d14aa89995c96f50
Repository branch: master
System Description:  macOS 11.1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46328; Package emacs. (Fri, 05 Feb 2021 14:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 46328 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: 46328 <at> debbugs.gnu.org
Subject: additional test case
Date: Fri, 05 Feb 2021 17:46:20 +0300
If there're two lines (csv-header-lines is 0, though):

--8<---------------cut here---------------start------------->8---
name,value
description,"a field with comma, and another comma, here"
--8<---------------cut here---------------end--------------->8---

Then the newlines are just prepended before commas inside the quoted
field:

--8<---------------cut here---------------start------------->8---
name,description
value,"a field with comma
, and another comma
, here"
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46328; Package emacs. (Mon, 22 Feb 2021 23:28:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Peder O. Klingenberg" <peder <at> klingenberg.no>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#46328: 28.0.50; csv-transpose replaces field delimiters in
 quoted fields with newlines
Date: Tue, 23 Feb 2021 00:27:43 +0100
[Message part 1 (text/plain, inline)]
On Fri, 2021-02-05 17:17:39 +0300, Filipp Gunbin wrote:

> The commas inside a (quoted) field were replaced by newlines, this looks
> like a bug.

Caused by split-string not caring about char-syntax ?\".  Here's a
patch.  If a line has quote chars, use csv-forward-field to fetch each
field, ensuring consistency in what the mode considers a field.

[0001-Fix-transposing-csv-files-with-quoted-fields.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from "Peder O. Klingenberg" <peder <at> klingenberg.no> to control <at> debbugs.gnu.org. (Mon, 22 Feb 2021 23:30:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46328; Package emacs. (Tue, 23 Feb 2021 15:52:02 GMT) Full text and rfc822 format available.

Message #16 received at 46328 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Peder O. Klingenberg" <peder <at> klingenberg.no>
Cc: 46328 <at> debbugs.gnu.org
Subject: Re: bug#46328: 28.0.50; csv-transpose replaces field delimiters in
 quoted fields with newlines
Date: Tue, 23 Feb 2021 16:51:27 +0100
"Peder O. Klingenberg" <peder <at> klingenberg.no> writes:

> Caused by split-string not caring about char-syntax ?\".  Here's a
> patch.  If a line has quote chars, use csv-forward-field to fetch each
> field, ensuring consistency in what the mode considers a field.

Thanks; applied to the csv-mode GNU ELPA package now.  (That is, I hope
-- I'm not 100% sure how the new ELPA layout works after the recent
changes...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2021 15:52:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 46328 <at> debbugs.gnu.org and Filipp Gunbin <fgunbin <at> fastmail.fm> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2021 15:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Mar 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.