-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Fix joinPathOS method that fails on solaris #3572
Conversation
…r to remove duplicate slashes which should work anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK but could do with a comment saying why we are using IFS
added some comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit unclear as to why we need IFS
in this case - is the outcome of the joinPath any different from the somewhat simpler:
echo "${@}" | tr ' ' /
Or are there some edge cases that would be missed with that? I'm probably missing something obvious but thought it was worth checking :-)
(EDIT: I've missed out the tr -s
on there from your change that's likely desirable too)
I think that would also work:
I wanted to have a reliable way to construct a valid path from components without having to worry about slashes and remove duplicate ones. While this is not necessary according to the POSIX standard, it still looks weird in logs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would also work:
echo "/${@}" | tr ' ' / | tr -s /
I wanted to have a reliable way to construct a valid path from components without having to worry about slashes and remove duplicate ones. While this is not necessary according to the POSIX standard, it still looks weird in logs.
Yeah most things will work without the duplicate removal, but I agree that it's nicer to do it. I'd personally definitely prefer the two tr
operations over the use of IFS as (to me at least) it's a lot clearer. But I'll approve regardless of which option you go for as the most important thing is to avoid the build break.
applied the change and removed the comment again. The comment was requested to explain the use of IFS, I think right now its pretty straight forward. |
LGTM - |
Previously printf was used which behaves differently on solaris it seems.
Using a method that should work anywhere.
Use IFS='/' to separate path elements and remove duplicate slashes afterwards using tr.
Fixes #3571