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

Replace cd .. && pwd with readlink -f #17152

Merged

Conversation

stefanobaghino-da
Copy link
Contributor

The output of cd might be altered by CDPATH set on a system, leading to dade being broken because it cannot read the current path. Instead, using readlink -f seem to get the job done without side effects.

The output of `cd` might be altered by `CDPATH` set on a
system, leading to `dade` being broken because it cannot
read the current path. Instead, using `readlink -f` seem
to get the job done without side effects.
Copy link
Contributor

@garyverhaegen-da garyverhaegen-da left a comment

Choose a reason for hiding this comment

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

Thanks!

I'm a bit concerned at the very widespread use of that pwd idiom and how it'll interact with CDPATH in any number of other scripts than dev-env.

@stefanobaghino-da
Copy link
Contributor Author

I'm a bit concerned at the very widespread use of that pwd idiom and how it'll interact with CDPATH in any number of other scripts than dev-env.

Setting CDPATH is probably very rare.

@stefanobaghino-da stefanobaghino-da enabled auto-merge (squash) July 19, 2023 12:19
@stefanobaghino-da stefanobaghino-da merged commit d999a21 into main Jul 19, 2023
@stefanobaghino-da stefanobaghino-da deleted the stefanobaghino-da/use-readlink-instead-of-cd-pwd branch July 19, 2023 12:54
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.

2 participants