Make /etc/profile.d/path.sh POSIX sh compatible to avoid breaking login dash#3199
Open
haithamseelawi-synth wants to merge 1 commit into
Open
Make /etc/profile.d/path.sh POSIX sh compatible to avoid breaking login dash#3199haithamseelawi-synth wants to merge 1 commit into
haithamseelawi-synth wants to merge 1 commit into
Conversation
f55ec46 to
640dc48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
aws-parallelcluster-shared::setup_envarsrenders/etc/profile.d/path.shfromprofile/path.sh.erb. The template uses bash-only syntax (aPATH_REQUIRED_DIRECTORIES=(...)array and[[ ... ]]).Scripts in
/etc/profile.dare sourced (not executed) by the login shell, so the#!/bin/bashshebang is ignored. On Debian/Ubuntu/etc/profileis processed by dash, which has no arrays, so anysh -llogin aborts with:This breaks tooling that relies on a working login
shon cluster nodes (e.g. remote dev-container / IDE setup steps that read the remote env viash -lc). Interactive users in bash/zsh don't notice it.This rewrites the template in portable POSIX sh (a plain
forloop +case), preserving the existing behavior: append each required directory toPATHonly if not already present, in the same order.Tests
sh -n/dash -non the rendered file: exits 0 (previously exit 2).PATHgets the required directories, and is idempotent when a directory is already present.sh -n /etc/profile.d/path.shexits 0) tosetup_envars_spec.rb; existing assertions unchanged.References
Checklist
develop).By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.