[BUG] fill_desc() writes the DESCRIPTION of the working directory instead of `pkg`

Open Beginner friendly
#1,255 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
tooling

Research direction

The bug is in fill_desc() in R/desc.R, where desc$write(file = "DESCRIPTION") at about line 176 resolves against the working directory instead of pkg. Run the reproduction from the issue to confirm which DESCRIPTION gets overwritten. Done means the write targets file.path(pkg, "DESCRIPTION") (or the normalized path) and the working directory's DESCRIPTION stays untouched. Check that change_app_config_name() receives the same path.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

fill_desc() reads the DESCRIPTION located in pkg, but writes it back with desc$write(file = "DESCRIPTION") (R/desc.R#L176), i.e. relative to the current working directory.

When pkg is not the working directory, the target DESCRIPTION is not updated, and the DESCRIPTION sitting in the working directory (possibly another project's) is overwritten.

To Reproduce

library(golem)
a <- file.path(
  tempdir(),
  "appA"
)
b <- file.path(
  tempdir(),
  "appB"
)
create_golem(
  a,
  open = FALSE,
  check_name = FALSE
)
create_golem(
  b,
  open = FALSE,
  check_name = FALSE
)
setwd(a)
fill_desc(
  pkg_name = "appB",
  pkg_title = "Title for B",
  pkg_description = "Description of B.",
  authors = person(
    "John",
    "Doe",
    email = "[email protected]",
    role = c(
      "aut",
      "cre"
    )
  ),
  pkg = b,
  set_options = FALSE
)
# appA's DESCRIPTION has been overwritten
desc::desc_get(
  c("Package", "Title"),
  file.path(
    a,
    "DESCRIPTION"
  )
)
# appB's DESCRIPTION has not been updated
desc::desc_get(
  c("Package", "Title"),
  file.path(
    b,
    "DESCRIPTION"
  )
)

Output:

      Package         Title 
       "appB" "Title for B" 
               Package                  Title 
                "appB" "An Amazing Shiny App" 

Expected behavior

Only file.path(pkg, "DESCRIPTION") is modified; the DESCRIPTION of the working directory is left untouched.

Additional context

  • Suggested fix: desc$write(file = fs_path(path, "DESCRIPTION")).
  • In the same function, change_app_config_name() is called with golem_wd = pkg while the rest uses the normalized path.
  • fill_desc() still exposes pkg rather than golem_wd (see #845).

session info

R 4.3.3, Ubuntu 24.04, {golem} master (9938a41, version 1.0.1).


Generated by Claude Code

Dominant language
R
Stars
947
Forks
135
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ThinkR-open/golem

All issues in ThinkR-open/golem

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.