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

[shell] Override CDPATH in brew script. #16179

Merged
merged 1 commit into from Nov 5, 2023

Conversation

gregorynisbet-google
Copy link
Contributor

@gregorynisbet-google gregorynisbet-google commented Nov 4, 2023

The CDPATH environment variable can affect the behavior of cd, and cd takes the -P, -L and -e flags. (I didn't know about -e until looking at the source) Make quietcd more robust by setting the CDPATH to ''.

I tested this change by running the following commands from a nonstandard directory, which caused some of tcsh's and perl's dependencies to be recompiled.

$ [path to brew] install tcsh
$ [path to brew] install perl

Here's a link to the source code of cd in a mirror of the bash repo.

https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/builtins/cd.def#L267

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

The CDPATH environment variable can affect the behavior of
`cd`, and `cd` takes the `-P`, `-L` and `-e` flags.
(I didn't know about `-e` until looking at the source)
Make quietcd more robust by setting the CDPATH to ''.

I tested this change by running the following commands from a nonstandard
directory, which caused some of tcsh's and perl's dependencies to be recompiled.

$ [path to brew] install tcsh
$ [path to brew] install perl

Here's a link to the source code of `cd` in a mirror of the bash repo.

https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/builtins/cd.def#L267
@gregorynisbet-google
Copy link
Contributor Author

For task 7, I'm running the tests on Linux in a nonstandard checkout, and the same tests fail on trunk and with my patch.

For task 4, I'm not sure how to write a test that tests the brew program as a whole rather than being a Ruby unit test.

Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks!

@Bo98 Bo98 merged commit e002907 into Homebrew:master Nov 5, 2023
27 checks passed
@Bo98
Copy link
Member

Bo98 commented Nov 5, 2023

Thank you for your first contribution to Homebrew!

@gregorynisbet-google gregorynisbet-google deleted the 2023-11-04-fix-cd branch November 5, 2023 00:34
@github-actions github-actions bot added the outdated PR was locked due to age label Dec 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants