[Rd] write.dcf does not quote as Debian would like it to (PR#12816)

blundellc at gmail.com blundellc at gmail.com
Fri Sep 12 22:10:14 CEST 2008


Full_Name: charles blundell
Version: 2.7.0
OS: Debian GNU/Linux
Submission from: (NULL) (217.37.73.202)


The Debian Policy Manual says concerning lines in a Description field:
 * Those containing a space, a full stop and some more characters. These are for
future expansion. Do not use them. 
(section 5.6.13, http://www.debian.org/doc/debian-policy/ch-controlfields.html)

But for example:
> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10)
Description:
 there
 was a
 fat goat
 .haha

A simple quoting scheme is to add a space in front of such full stops:
--- src/library/base/R/dcf.R.orig       2008-09-12 20:42:37.000000000 +0100
+++ src/library/base/R/dcf.R    2008-09-12 20:54:16.000000000 +0100
@@ -133,7 +133,7 @@
     ## * We have to handle multiple fields per record.

     escape_paragraphs <- function(s)
-        gsub("\n[[:space:]]*\n", "\n .\n ", s)
+        gsub("\n \\.([^\n])","\n  .\\1", gsub("\n[[:space:]]*\n", "\n .\n ",
s))

     if(!is.data.frame(x))
         x <- as.data.frame(x, stringsAsFactors = FALSE)


As so:
> write.dcf(list(Description = 'there was a fat goat .haha'),indent=1,width=10)
Description:
 there
 was a
 fat goat
  .haha

Doing this makes life easier for cran2deb as we can generate valid Debian
control files using write.dcf.



More information about the R-devel mailing list