Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make script more deterministic by clearing CDPATH #164

Closed
wants to merge 1 commit into from

Conversation

hyperupcall
Copy link

As mentioned in POSIX, the environment variable CDPATH chagnes the behavior of cd. Notably, it can cause the directory to be changed to an unexpected location. This makes the script less deterministic.

My changeset causes CDPATH to be taken account by either unsetting it, or setting it to an empty string.

@rycus86
Copy link
Owner

rycus86 commented Oct 22, 2023

Hi @hyperupcall can you explain a scenario when this might cause problems? Do you perhaps have an idea for a test we could add in this repo?
The change itself sounds sensible for a bit of extra complexity, but also wondering why this wasn't necessary until now?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6588736445

  • 4 of 4 (100.0%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 80.198%

Files with Coverage Reduction New Missed Lines %
cli.sh 2 83.79%
Totals Coverage Status
Change from base Build 4543718405: 0.1%
Covered Lines: 2515
Relevant Lines: 3136

💛 - Coveralls

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.

3 participants