Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintainer not returned as author from DESCRIPTION with classic fields #114

Closed
dpprdan opened this issue Oct 5, 2021 · 6 comments · Fixed by #115
Closed

Maintainer not returned as author from DESCRIPTION with classic fields #114

dpprdan opened this issue Oct 5, 2021 · 6 comments · Fixed by #115
Labels
bug an unexpected problem or unintended behavior

Comments

@dpprdan
Copy link
Contributor

dpprdan commented Oct 5, 2021

When reading description files with ‘Author’ and ‘Maintainer’ fields (but without ‘<Authors@R>’) and with roles specified in brackets, the maintainer/author is not returned as an author by get_author(s)().

Example from WRE (again without ‘<Authors@R>’):

library(desc)

d <- desc(text =
            "Package: pkgname
Version: 0.5-1
Date: 2015-01-01
Title: My First Collection of Functions
Author: Joe Developer [aut, cre],
  Pat Developer [aut],
  A. User [ctb]
Maintainer: Joe Developer <Joe.Developer@some.domain.net>
Depends: R (>= 3.1.0), nlme
Suggests: MASS
Description: A (one paragraph) description of what
  the package does and why it may be useful.
License: GPL (>= 2)
URL: https://www.r-project.org, http://www.another.url
BugReports: https://pkgname.bugtracker.url"
)

d$coerce_authors_at_r()

‘Joe Developer [aut, cre]’ is returned as a maintainer

d$get_author("cre")
#> [1] "Joe Developer <Joe.Developer@some.domain.net> [cre]"

But not as an author

d$get_author("aut")
#> [1] "Pat Developer [aut]" "A. User [aut]"

get_authors() also returns him as a maintainer only, i.e. the aut tag is missing

str(d$get_authors())
#> List of 3
#>  $ :Class 'person'  hidden list of 1
#>   ..$ :List of 5
#>   .. ..$ given  : chr "Joe"
#>   .. ..$ family : chr "Developer"
#>   .. ..$ role   : chr "cre"
#>   .. ..$ email  : chr "Joe.Developer@some.domain.net"
#>   .. ..$ comment: NULL
#>  $ :Class 'person'  hidden list of 1
#>   ..$ :List of 5
#>   .. ..$ given  : chr "Pat"
#>   .. ..$ family : chr "Developer"
#>   .. ..$ role   : chr "aut"
#>   .. ..$ email  : NULL
#>   .. ..$ comment: NULL
#>  $ :Class 'person'  hidden list of 1
#>   ..$ :List of 5
#>   .. ..$ given  : chr "A."
#>   .. ..$ family : chr "User"
#>   .. ..$ role   : chr "aut"
#>   .. ..$ email  : NULL
#>   .. ..$ comment: NULL
#>  - attr(*, "class")= chr "person"
Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.5 (2021-03-31)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language EN                          
#>  collate  German_Germany.1252         
#>  ctype    German_Germany.1252         
#>  tz       Europe/Berlin               
#>  date     2021-10-05                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source            
#>  cli           3.0.1   2021-07-17 [1] standard (@3.0.1) 
#>  crayon        1.4.1   2021-02-08 [1] CRAN (R 4.0.4)    
#>  desc        * 1.4.0   2021-09-28 [1] standard (@1.4.0) 
#>  digest        0.6.28  2021-09-23 [1] standard (@0.6.28)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.4)    
#>  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.0.4)    
#>  fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.4)    
#>  glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.4)    
#>  highr         0.9     2021-04-16 [1] standard (@0.9)   
#>  htmltools     0.5.2   2021-08-25 [1] standard (@0.5.2) 
#>  knitr         1.36    2021-09-29 [1] standard (@1.36)  
#>  magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.0.4)    
#>  R6            2.5.1   2021-08-19 [1] standard (@2.5.1) 
#>  reprex        2.0.1   2021-08-05 [1] standard (@2.0.1) 
#>  rlang         0.4.11  2021-04-30 [1] standard (@0.4.11)
#>  rmarkdown     2.11    2021-09-14 [1] standard (@2.11)  
#>  rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.0.4)    
#>  rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.0.4)    
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.4)    
#>  stringi       1.7.5   2021-10-04 [1] standard (@1.7.5) 
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.4)    
#>  withr         2.4.2   2021-04-18 [1] standard (@2.4.2) 
#>  xfun          0.26    2021-09-14 [1] standard (@0.26)  
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.3)    
#> 
#> [1] D:/Users/Daniel/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.5/library
@gaborcsardi
Copy link
Member

Seems like a bug in $coerce_authors_at_r() to me.

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Oct 5, 2021
@dpprdan
Copy link
Contributor Author

dpprdan commented Oct 5, 2021

It is, but it seems intentional?! Not entirely sure why, though (added in PR #46).

desc/R/authors-at-r.R

Lines 399 to 406 in daece0e

# If Maintainer in Author field, remove it and keep the maintainer one
# may want to use del_author
check_same = function(x) {
identical(c(man$given, man$family),
c(x$given, x$family))
}
same_auth = sapply(auth, check_same)
auth = auth[!same_auth]

There is another issue that I only saw now: A. User is returned as author, but should be returned as a contributor.

@dpprdan
Copy link
Contributor Author

dpprdan commented Oct 5, 2021

Not entirely sure why, though

I get it now, the idea is to get the maintainer info (e.g. email) from the maintainer field and then concatenate these two person lists (maintainer & author).

The main problem is that the current code works under the assumption that the Author field does not contain information about the roles (i.e. no [aut, cre], [ctb], etc.) and therefore overwrites these when they are present.

I could try to make a PR, but cannot get devtools::load_all(".") to work:

> devtools::load_all(".")
i Loading desc
Error in create_ns_env(path) : Namespace for desc already exists.

Any idea what I am doing wrong?

@gaborcsardi
Copy link
Member

desc does not work with load_all(), it is a bug in pkgload.

@gaborcsardi
Copy link
Member

So Authors is a free-form field, e.g. https://cran.r-project.org/web/packages/igraph/DESCRIPTION. I am not sure if it is worth putting effort into parsing it, TBH.

Maybe we could advise the user better about this, though.

@dpprdan
Copy link
Contributor Author

dpprdan commented Oct 6, 2021

it is a bug in pkgload

Seems to be fixed in GitHub version

Authors is a free-form field

It will never be perfect of course, but maybe a tad better than now.

gaborcsardi pushed a commit to dpprdan/desc that referenced this issue Feb 21, 2022
gaborcsardi added a commit to dpprdan/desc that referenced this issue Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants