-
Notifications
You must be signed in to change notification settings - Fork 75
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
Support any platform w/readlink & remove dupe code #60
base: master
Are you sure you want to change the base?
Conversation
@pjeby This looks really good. I tested it locally and it works! Hopefully this will make it in. |
@juanibiapina Any chance you can give feedback on this? |
Later today or over the weekend. Sorry I've been unresponsive.
…On Thu, Feb 7, 2019, 7:18 PM Joel Baranick ***@***.*** wrote:
@juanibiapina <https://github.com/juanibiapina> Any chance you can give
feedback on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#60 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAitvPeksoH5MSwWCuXPmWrAESX7tSpCks5vLG4HgaJpZM4agdHI>
.
|
@juanibiapina No worries. Real life is intruding on fun... |
Thanks for the contributions. I can't express how exited I am to see so many people participating on the discussions! The bottom line issue here seems to be support for OSX without homebrew. Is this is hard requirement? Making basher depend on GNU coreutils is not a problem at all if we document this dependency and add an early abort (even travis has it by default). This commit has been valid for 6 years now: rbenv/rbenv@81bb14e If this solves all problems, I'm ok with simplifying the Other than that, tests now take one minute more to run on my computer, which makes me think the symlink resolution has become slower. Also the entry point has become complicated to follow for a person without much experience with shell scripts. |
@juanibiapina Personally, I'm fine with |
@kadaan It checks in the main command, but not in the |
@juanibiapina Whatever makes it work on OS X is fine. I'm fine adding coreutils to my system. That said, I don't want to have to replace system libraries with coreutils copies. |
I've fixed the test performance issue, so the performance is now about the same as it was without the PR, at least on my machine. (The issue was in the tests themselves, not the changes to the main code; the main code should actually be faster for As for the The main purpose of this PR is to stop reinventing wheels in every basher subcommand that needs to do path manipulation: if they need an absolute path, they can use The main basher script already had an adhoc implementation of (Ironically, the entire issue of |
Running |
I want to find a way to use
What if we rewrite this as a generic wrapper script that creates the main binary inside the |
I don't have any objections in principle, but I'm a bit curious how it would work. On the pro side, if the tests actually run this new wrapper it'd be great, because right now they run libexec/basher and bypass testing the wrapper. On the con side, the wrapper would have to be regenerated every time you made a change to the main basher script. Any dependencies, though, need to either be on PATH or some other environment variable in order to be sourced by the things that use them. So libexec seems like the right place, at least for the library to be sourced. Anything else gets trickier. (I do agree that the loader Hm. It just occurred to me that you might be saying that you want Anyway, I'm definitely willing to make changes, I'm just having trouble picturing what you want and how it would work. This was very much an ad-hoc thing I threw together to show it could be done, and didn't give a lot of thought to the stub placement, because at first I didn't know I even needed a stub, I thought it could all be done in the makefile (but that got too messy; the Also, if there's a generic way to make |
I don't have a clear vision for the solution for this. The current state bothers me because I feel things are out of place and it is confusing to find what you're looking for. I've tried a couple of experiments and I'm still unable to get to a state I'm comfortable with. I still want to try one more time tough. |
What things are you looking for, that are confusing and out of place? Maybe I can re-arrange them in some fashion. |
This PR is a proof-of-concept to address the issues discussed in #49. Specifically, it:
basher-link
resolve_link
) across multiple filesreadlink
, including busybox, docker alpine bash images, and OS X without homebrewIt does this by adding a new file,
libexec/basher.realpath
. This file can be sourced by anything that wants to userealpath.*
functions (such asbasher-link
and its tests), and it also works as a bootstrap loader forbasher
.bin/basher
links tolibexec/basher.realpath
, which when run computes the location of thelibexec
dir, puts it on the path, and then exec'slibexec/basher
. This allowslibexec/basher
to forego any symlink calculations of its own.The
libexec/basher.realpath
file is tracked under revision control, so a checkout of basher is immediately usable without any other steps, just as before.However, if a new upstream version of bashup/realpaths is needed, a developer can:
In this way, the distributed version can be kept up to date with the upstream code, without any manual copy-and-paste.