posit-dev / posit-dev/positron
R package build task fails when R binary is in user home directory (tilde not expanded in single quotes)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
System details:
Positron and OS details:
Positron Version: 2026.01.0 build 147
Code - OSS Version: 1.106.0
Commit: 3290136f699527bf01b703b390457b05ef2b858a
Date: 2026-01-06T01:40:35.071Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 24.6.0
Session details:
R version 4.5.2 (2025-10-31)
Platform: x86_64-conda-linux-gnu
Describe the issue:
I'm a non-root user on a shared system, so I use pixi to manage my R installations and environments. This issue occurs when R is installed "globally" (into ~/.pixi/envs using pixi global install) or as a proper, non-global virtual environment into (into ~/path/to/project/.pixi). For simplicity, everything that follows assumes the global installation. My settings in this case are:
{
"positron.r.customBinaries": ["/Users/gfindlay@ad.wisc.edu/.pixi/envs/my-r-env/bin/R"],
"positron.r.interpreters.exclude": [
"/usr/bin/R"
]
}
[!NOTE]
It's important that"positron.r.customBinaries"points to theRbinary in the~/.pixi/envsdirectory, and NOT to the trampoline binary (a static ELF executable) in~/.pixi/bin, because Positron can't parse the latter to findR_HOME, so it marks the installation as invalid.
Building a package using devtools::build() from an R session started in the package directory works fine. Building a package using Cmd + Shift + B, which runs a build task that shells out, does not:
* Executing task: '~/.pixi/envs/my-r-env/bin/R' --quiet --no-restore
--no-save -e 'pak::local_install(upgrade = FALSE)'
/usr/bin/bash: line 1: ~/.pixi/envs/my-r-env/bin/R: No such file or
directory
* The terminal process "/usr/bin/bash '-c',
''~/.pixi/envs/my-r-env/bin/R' --quiet --no-restore --no-save -e
'pak::local_install(upgrade = FALSE)''" failed to launch (exit code:
127).
Pretty sure the problem is that the ~ isn't being expanded because the path is in single quotes.
Why is a relative path being used in the first place? I provided an absolute path in "positron.r.customBinaries", and R itself reports absolute paths, so I figured the tilde must be coming from Positron's task configuration. I tested this by creating my own build task in .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "R: My Build Package",
"type": "shell",
"command": "/Users/gfindlay@ad.wisc.edu/.pixi/envs/my-r-env/bin/R",
"args": [
"--quiet",
"--no-restore",
"--no-save",
"-e",
"pak::local_install(upgrade = FALSE)"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
Then Cmd + Shift + P -> Tasks: Run Task -> R: My Build Package. Works like a charm. So I went looking in the Positron source for the bug. I think it arises inside the R extension:
extensions/positron-r/src/provider.ts—makeMetadata()converts absolute
paths to tilde form:
https://github.com/posit-dev/positron/blob/4b8cc97a7a7a9468c02cd5ac0ee685192030825d/extensions/positron-r/src/provider.ts#L260-L262extensions/positron-r/src/session-manager.ts— stores that tilde-form path
as the R binary path used for tasks.extensions/positron-r/src/tasks.ts— wraps the path inShellQuoting.Strong
(single quotes):
https://github.com/posit-dev/positron/blob/4b8cc97a7a7a9468c02cd5ac0ee685192030825d/extensions/positron-r/src/tasks.ts#L118-L122
Maybe the solution is as simple as calling normalizeUserPath() from extensions/positron-r/src/path-utils.ts on the binpath in tasks.ts before passing it to ShellExecution?
https://github.com/posit-dev/positron/blob/4b8cc97a7a7a9468c02cd5ac0ee685192030825d/extensions/positron-r/src/path-utils.ts#L49-L58
Steps to reproduce the issue:
pixi global install --environment my-r-env r-base r-devtools r-pak."positron.r.customBinaries": ["/Users/gfindlay@ad.wisc.edu/.pixi/envs/my-r-env/bin/R"].- Open a workspace on your package under development.
Cmd + Shift + D;Cmd + Shift + B.
Thank you for Positron!
Contributor 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.
Research direction
Start in extensions/positron-r/src/tasks.ts, then compare the path handling in extensions/positron-r/src/path-utils.ts and the tilde conversion in extensions/positron-r/src/provider.ts. Reproduce the package build with the custom R binary, and verify that the generated shell task launches the configured binary instead of passing an unexpanded tilde path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100