A corner case, seen when bulk-normalizing a directory full of legacy packages: If any dependency field (Depends, Imports, Suggests, Enhances, LinkingTo) is present but empty, normalizing the file leaves an empty line that is treated as an error on rereading.
> library(desc)
> x <- desc("!new")
> x$set("Depends", "")
> x
Package: {{ Package }}
Title: {{ Title }}
Version: 1.0.0
Authors@R (parsed):
* Jo Doe <jodoe@dom.ain> [aut, cre]
Maintainer: {{ Maintainer }}
Description: {{ Description }}
License: {{ License }}
URL: {{ URL }}
BugReports: {{ BugReports }}
Depends:
Encoding: UTF-8
> x$normalize()
> x
Error in if (R && x$value == "R") return(TRUE) :
missing value where TRUE/FALSE needed
> DSC <- tempfile()
> x$write(DSC)
> desc(DSC)
Error: Empty lines found in DESCRIPTION file
Expected behavior
I'd be satisfied if normalize() left these fields in a valid-but-empty state and mildly pleased if by default it removed them with a message, but your call what's correct -- I've seen and noted that ?desc::description says "The format of the various fields is opinionated and you might like it or not" 😄
Session info
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.4.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] desc_1.4.3.9000
loaded via a namespace (and not attached):
[1] compiler_4.3.2 R6_2.5.1 cli_3.6.2 tools_4.3.2
A corner case, seen when bulk-normalizing a directory full of legacy packages: If any dependency field (Depends, Imports, Suggests, Enhances, LinkingTo) is present but empty, normalizing the file leaves an empty line that is treated as an error on rereading.
Expected behavior
I'd be satisfied if normalize() left these fields in a valid-but-empty state and mildly pleased if by default it removed them with a message, but your call what's correct -- I've seen and noted that
?desc::description
says "The format of the various fields is opinionated and you might like it or not" 😄Session info