Fix macOS filesystem security: use /etc/paths.d/TinyTeX instead of touching /usr/local/bin#489
Fix macOS filesystem security: use /etc/paths.d/TinyTeX instead of touching /usr/local/bin#489
/etc/paths.d/TinyTeX instead of touching /usr/local/bin#489Conversation
|
|
…l/bin ownership after install Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
/usr/local/bin ownership: drop -R, restore after install
yihui
left a comment
There was a problem hiding this comment.
instead of restoring ownership, let's use a different approach to solve the problem:
we don't tamper with /usr/local/bin at all, but use sudo only once to add TinyTeX's bin path to /etc/paths.d, e.g.
sudo echo path/to/TinyTeX/bin/* > /etc/paths.d/TinyTeX
then we should avoid tlmgr path add for macOS in all places; this command is called in several places in this package, some are through the R function tinytex::tlmgr_path() and some are tlmgr path add commands directly; please find out all of them and avoid them for macOS
the osascript() call in R should only do this /etc/paths.d operation and nothing else; i think we can get rid of check_local_bin() entirely since /usr/local/bin is no longer relevant
Agent-Logs-Url: https://github.com/rstudio/tinytex/sessions/13dd76fe-b745-4b61-8faf-aa3314531d3e Co-authored-by: yihui <163582+yihui@users.noreply.github.com>
Done in eea0101. The approach now:
|
/usr/local/bin ownership: drop -R, restore after install/etc/paths.d/TinyTeX instead of touching /usr/local/bin
TinyTeX was recursively changing ownership of
/usr/local/bin(chown -R) — affecting all pre-existing binaries unrelated to TinyTeX — and creating symlinks from/usr/local/bininto the user's home directory. This PR eliminates all/usr/local/binmanipulation on macOS entirely.Changes
R/install.Rcheck_local_bin()entirely —/usr/local/binis no longer touched at alluse_tinytex(): on macOS, write the TinyTeX bin path to/etc/paths.d/TinyTeXviaosascriptinstead of runningtlmgr path addosascript()is now used solely for the/etc/paths.doperationadd_pathparameter anduse_tinytex()R/tlmgr.Rtlmgr_path(): on macOS,action = 'add'writes the TinyTeX bin directory path to/etc/paths.d/TinyTeXwith admin privileges (viaosascript);action = 'remove'deletes that file. On Linux/Windows the existingtlmgr path add/removebehavior is unchanged.tools/install-bin-unix.sh/usr/local/binand changed ownership/etc/paths.d/TinyTeXviasudo tee./tlmgr path addtools/install-unx.sh/etc/paths.d/TinyTeXapproach (respecting the--admin --no-pathflag)tlmgr path addOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.