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

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Sat Sep 13 15:25:19 CEST 2008


>>>>> "chb" == blundellc  <blundellc at gmail.com>
>>>>>     on Fri, 12 Sep 2008 22:10:14 +0200 (CEST) writes:

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


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

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

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

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

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


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

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

That sounds a good enough reason to make the change, notably
since I cannot see a case (in other uses of write.dcf())
where this would be undesirable.

I'm going to test this quickly and will most probably add it to
R-devel (R.2.8.0 to be).

Martin Maechler, ETH Zurich



More information about the R-devel mailing list