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

Use 'grealpath' if installed for realpath fallback #3374

Merged
merged 2 commits into from Sep 18, 2016

Conversation

floam
Copy link
Member

@floam floam commented Sep 12, 2016

Description

Per #3370, our realpath builtin/wrapper function will not use GNU realpath if installed on BSD with a 'g' prefix.

@faho
Copy link
Member

faho commented Sep 12, 2016

The idea is probably correct, though I'd actually define the function here instead of going via alias - all the stuff that does is irrelevant here.

@floam
Copy link
Member Author

floam commented Sep 13, 2016

II thought alias was just syntax to define a wrapped function. What else does it do?

function realpath --description 'fallback realpath implementation'
builtin fish_realpath $argv[-1]
end
if not command -v realpath > /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, I think we should be using command -s rather than command -v in the scripts we ship since our command(1) man page documents -s as a first class flag and -v as being recognized only for compatibility with other implementations.

@krader1961
Copy link
Contributor

krader1961 commented Sep 18, 2016

I'm closing this because it does not solve the real problem. That problem is that fish_realpath a/b/c fails if a/b exists but a/b/c does not. The intent was that it would require all path components to exist except the final one since that is the overwhelming use case.

This change does not fix that error. It instead papers over the problem with a OS X/macOS specific change. And it does so in a manner that introduces other problems.

@krader1961 krader1961 closed this Sep 18, 2016
@floam
Copy link
Member Author

floam commented Sep 18, 2016

No - what this was trying to fix was just the fish script failing to pick up realpath if it's prefixed with a 'g'.

@floam
Copy link
Member Author

floam commented Sep 18, 2016

I think it's unlikely even in the cases where it is called with the same number of arguments, that our bare-bones builtin would be preferred.

@floam
Copy link
Member Author

floam commented Sep 18, 2016

I have also since gotten this a little less likely to do wrong things.

@floam floam force-pushed the realpath branch 2 times, most recently from d84fde1 to 71c0f45 Compare September 18, 2016 06:59
Per feedback do not use aliases to declare wrapped functions.
@floam
Copy link
Member Author

floam commented Sep 18, 2016

Meh - I'm just going to merge it. It appears to be working better.

@floam floam merged commit 96ebfaa into fish-shell:master Sep 18, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants