[BUG] fill_desc() writes the DESCRIPTION of the working directory instead of `pkg`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
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
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 withgolem_wd = pkgwhile the rest uses the normalizedpath. fill_desc()still exposespkgrather thangolem_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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ThinkR-open/golem
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ThinkR-open/golem#1265 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ThinkR-open/golem#1259 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ThinkR-open/golem#1258 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
ThinkR-open/golem#1257 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ThinkR-open/golem#1256 ·
All issues in ThinkR-open/golem
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
leppott/BioMonTools#162 ·
-
publications
Difficulty 1/5 Under an hour Newbie friendliness 85/100
epiforecasts/epiforecasts.github.io#161 ·
Maintainers usually reply within 1 day
-
Label `{sas}` chunk source as `sas` instead of `txt`, so it gets syntax highlightingPossibly taken @michaelmayer2 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microbiome/OMA#1031 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
furrer-lab/abn#291 · 2 comments ·