-
Notifications
You must be signed in to change notification settings - Fork 249
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
clib gets confused if not invoked via PATH #116
Comments
I was testing on osx and it seemed to work, will do some more testing tonight and fix this up |
Just realized this isn't a nixpkgs issue, lol. I think I'll still look into fixing this. |
I can't seem to reproduce this :( |
Here is strace output showing that it looks for 'clib-search' in PATH, and because I haven't installed clib yet (just running it from ./result/bin/clib), it fails:
@jb55: I guess you couldn't reproduce it because you have clib already installed? From an end users point of view, I think the first path clib try would be the one where it was invoked from. Then fall back to a PATH search. |
yes, at the moment,
or
we could check your |
The benefit is mainly correctness, IMHO. But I understand that this is a corner-case, and not so common scenario. The first thing I did to test clib was:
Aha, I thought. So it has a "search" command. Let's try that:
But.. it said it supported "search"... What's wrong? Did I spell "search" wrong? No, looks right... Yes, I know I didn't install clib (add it to PATH), but it was properly "make install"ed to ./result/, and the program printed the help text saying that it supports "search" etc. (everything seemed in order). So why did it fail then? (That was my train of thought.) On a more technical level, what if I have some improvement or change I want to add to clib. I patch it and install it into a tmpdir. Then I invoke it directly from the tmpdir. But if I don't pay attention to setting the correct PATH, the new clib will invoke the old clib for its sub-commands(!). Oops! I guess we can fix this in nixpkgs[1] by putting the install dir of clib first into PATH, but it'd be nice (IMHO) if upstream paid attention to these details :-) |
@stephenmathieson: No, I'm not suggesting to look in the current working directory. I'm suggesting to look in the directory where clib is installed. Btw, I think this is a case where some programs choose to put the helper tools in $PREFIX/libexec/. Then it is easy to see that a tool, say $PREFIX/bin/clib, should look in $PREFIX/libexec/ for its helpers. Of course, if this is to extend to "plugins", then after a lookup in $PREFIX/libexec/, the tool may look in $PATH or elsewhere. |
@bjornfor how could clib know where it's installed without assuming somewhere on |
I think there are two alternatives, compile time and run time. Compile time would be to bake in the install $PREFIX into clib so that it can look for helpers directly in e.g. $PREFIX/libexec/. Or run time, figure out path to self, e.g. $PREFIX/bin/clib and go to ../libexec/ (relative) to find the helpers. |
Two useful links (regarding determining $PREFIX at runtime): http://stackoverflow.com/questions/933850/how-to-find-the-location-of-the-executable-in-c |
Thinking out loud. If there is only a fixed set of helpers (clib-search, clib-install, clib-help), they don't have to be stand-alone binaries do they? There is already "clib " entry-point, so why have the additional "clib-" entry-point? Just make them libraries and call the proper function depending on the "clib " argument. |
figuring out
no, the idea is you're able to make your own plugins and they'll work natively with clib. |
See clibs/clib#116 for the bug being worked around.
Closing this as wontfix and opening a new issue (#190) as a discussion regarding the sub-commands as libraries providing entry point functions. |
It seems clib gets confused if it's not invoked via PATH:
This however, works:
Tested clib version 1.4.2.
The text was updated successfully, but these errors were encountered: