Skip to content

fix(artifacts-helper): restore shim installation into shell rc files#109

Merged
markphip merged 4 commits intomainfrom
copilot/fix-install-shims-in-artifacts-helper
Apr 27, 2026
Merged

fix(artifacts-helper): restore shim installation into shell rc files#109
markphip merged 4 commits intomainfrom
copilot/fix-install-shims-in-artifacts-helper

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

Two bugs introduced in late 2025 caused install.sh to silently skip writing shell function shims into .bashrc/.zshrc, leaving tools like npm as plain executables rather than intercepted functions — causing 401 auth failures against Azure Artifacts feeds.

Root causes

  • Missing variable initialization: COMMA_SEP_TARGET_FILES was never set to "DEFAULT", so the guard if [ "${COMMA_SEP_TARGET_FILES}" = "DEFAULT" ] was always false and target rc files were never populated.
  • Broken newlines in shim block: \n inside a bash double-quoted += doesn't produce a real newline, so all function definitions concatenated into one line and were unparseable as shell functions.

Changes

  • src/artifacts-helper/install.sh
    • Restore COMMA_SEP_TARGET_FILES="${TARGETFILES:-"DEFAULT"}" before the default-resolution block
    • Fix newline appending: "...\n""..."$'\n'
# Before (broken): \n is literal, not a newline
ALIASES_BLOCK+="$ALIAS() { \"${SHIM_DIRECTORY}/$ALIAS\" \"\$@\"; }\n"

# After: $'\n' produces an actual newline
ALIASES_BLOCK+="$ALIAS() { \"${SHIM_DIRECTORY}/$ALIAS\" \"\$@\"; }"$'\n'
  • test/artifacts-helper/test_shim_integration.sh
    • Add checks that shell function definitions are present in /etc/bash.bashrc and each appears at the start of its own line

Copilot AI changed the title [WIP] Fix artifacts-helper's install.sh to install shims properly fix(artifacts-helper): restore shim installation into shell rc files Apr 27, 2026
Copilot AI requested a review from markphip April 27, 2026 16:30
@markphip markphip marked this pull request as ready for review April 27, 2026 16:31
@markphip markphip merged commit 6b84bf5 into main Apr 27, 2026
5 of 6 checks passed
@markphip markphip deleted the copilot/fix-install-shims-in-artifacts-helper branch April 27, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

artifacts-helper's install.sh doesn't install shims

3 participants