From fdbd7fd93402baebc106f01fc49186ef93db5f3c Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 19 Mar 2026 15:45:27 -0700 Subject: [PATCH 1/3] Do not error when PKG installer cannot change file ownership in HOME --- constructor/osx/run_conda_init.sh | 5 ++++- constructor/osx/run_installation.sh | 16 ++++++++++++++-- news/1185-pkg-chown-permissions | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 news/1185-pkg-chown-permissions diff --git a/constructor/osx/run_conda_init.sh b/constructor/osx/run_conda_init.sh index ef128b727..4c7f81690 100644 --- a/constructor/osx/run_conda_init.sh +++ b/constructor/osx/run_conda_init.sh @@ -40,7 +40,10 @@ if [[ "${USER}" != "root" ]]; then if [[ -f "${file}" ]] || [[ -d "${file}" ]]; then OWNER=$(stat -f "%u" "${file}" | id -un) if [[ "${OWNER}" == "root" ]]; then - chown "${USER}" "${file}" + if ! chown "${USER}" "${file}"; then + MSG="WARNING! Unable to change ownership of ${file}." + logger -p "install.warning" "${MSG}" || echo "${MSG}" + fi fi fi file="${file%/*}" diff --git a/constructor/osx/run_installation.sh b/constructor/osx/run_installation.sh index 80975cd5e..65662768d 100644 --- a/constructor/osx/run_installation.sh +++ b/constructor/osx/run_installation.sh @@ -122,8 +122,20 @@ find "$PREFIX/pkgs" -type d -empty -exec rmdir {} \; 2>/dev/null || : # This is not needed for the default install to ~, but if the user changes the # install location, the permissions will default to root unless this is done. chown -R "${USER}" "$PREFIX" -test -d "${HOME}/.conda" && chown -R "${USER}" "${HOME}/.conda" -test -f "${HOME}/.condarc" && chown "${USER}" "${HOME}/.condarc" +CONDA_DIR="${HOME}/.conda" +if [[ -d "${CONDA_DIR}" ]]; then + if ! chown -R "${USER}" "${CONDA_DIR}"; then + MSG="WARNING: Unable to change ownership of ${CONDA_DIR}." + logger -p "install.warning" "${MSG}" || echo "${MSG}" + fi +fi +CONDARC="${HOME}/.condarc" +if [[ -f "${CONDARC}" ]]; then + if ! chown "${USER}" "${CONDARC}"; then + MSG="WARNING: Unable to change ownership of ${CONDARC}." + logger -p "install.warning" "${MSG}" || echo "${MSG}" + fi +fi notify "Done! Installation is available in $PREFIX." diff --git a/news/1185-pkg-chown-permissions b/news/1185-pkg-chown-permissions new file mode 100644 index 000000000..85ba193f8 --- /dev/null +++ b/news/1185-pkg-chown-permissions @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* PKG: Do not fail the installer when ownership of files in `$HOME` cannot be changed. (#1177 via #1184) + +### Deprecations + +* + +### Docs + +* + +### Other + +* From 46a2c5b0b584fd0943e63a1c75303bb6923d6278 Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Mon, 23 Mar 2026 08:27:23 -0700 Subject: [PATCH 2/3] Fix typo in Windows installer options --- constructor/nsis/OptionsDialog.nsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constructor/nsis/OptionsDialog.nsh b/constructor/nsis/OptionsDialog.nsh index 11c94e5a3..c9398202c 100644 --- a/constructor/nsis/OptionsDialog.nsh +++ b/constructor/nsis/OptionsDialog.nsh @@ -173,7 +173,7 @@ Function mui_AnaCustomOptions_Show ${Else} ${NSD_CreateLabel} 5% "$5u" 90% 20u \ "NOT recommended. This can lead to conflicts with other applications. \ - Instead, use the Commmand Prompt and Powershell menus added \ + Instead, use the Command Prompt and PowerShell menus added \ to the Windows Start Menu." ${EndIf} IntOp $5 $5 + 20 From 463b7859dd996786d2fbca9d9c347dbb34c9dc13 Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Mon, 23 Mar 2026 10:17:12 -0700 Subject: [PATCH 3/3] Add owner to warnings --- constructor/osx/run_conda_init.sh | 2 +- constructor/osx/run_installation.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/constructor/osx/run_conda_init.sh b/constructor/osx/run_conda_init.sh index 4c7f81690..09ef96868 100644 --- a/constructor/osx/run_conda_init.sh +++ b/constructor/osx/run_conda_init.sh @@ -41,7 +41,7 @@ if [[ "${USER}" != "root" ]]; then OWNER=$(stat -f "%u" "${file}" | id -un) if [[ "${OWNER}" == "root" ]]; then if ! chown "${USER}" "${file}"; then - MSG="WARNING! Unable to change ownership of ${file}." + MSG="WARNING! Unable to change ownership of ${file} (owned by ${OWNER})." logger -p "install.warning" "${MSG}" || echo "${MSG}" fi fi diff --git a/constructor/osx/run_installation.sh b/constructor/osx/run_installation.sh index 65662768d..59f2bf97f 100644 --- a/constructor/osx/run_installation.sh +++ b/constructor/osx/run_installation.sh @@ -125,14 +125,16 @@ chown -R "${USER}" "$PREFIX" CONDA_DIR="${HOME}/.conda" if [[ -d "${CONDA_DIR}" ]]; then if ! chown -R "${USER}" "${CONDA_DIR}"; then - MSG="WARNING: Unable to change ownership of ${CONDA_DIR}." + OWNER=$(stat -f "%u" "${CONDA_DIR}" | id -un) + MSG="WARNING: Unable to change ownership of ${CONDA_DIR} (owned by ${OWNER})." logger -p "install.warning" "${MSG}" || echo "${MSG}" fi fi CONDARC="${HOME}/.condarc" if [[ -f "${CONDARC}" ]]; then if ! chown "${USER}" "${CONDARC}"; then - MSG="WARNING: Unable to change ownership of ${CONDARC}." + OWNER=$(stat -f "%u" "${CONDARC}" | id -un) + MSG="WARNING: Unable to change ownership of ${CONDARC} (owned by ${OWNER})." logger -p "install.warning" "${MSG}" || echo "${MSG}" fi fi