-
Notifications
You must be signed in to change notification settings - Fork 6
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
Avoid $RM, $CP and $MV definition in funclib.sh #9
Comments
The semantics have been applied inconsistently through the years, to the point where anyone that has tried to set those variables in their libtool environment almost certainly breaks one or more of the call sites :-( At this point I agree that the cleanest fix is to ignore RM et. al. in the environment and call the commands directly from the users PATH (i.e. use 'rm' instead of '/bin/rm' for example). My understanding of the intent of these variables is not for the user to override (they can do that with wrapper scripts at the front of their PATH), but so that they can be replaced with say |
[re-sending an email from morning again, through web-form now] On Monday, October 24, 2016 7:15:45 PM CEST Gary V. Vaughan wrote:
Yeah, but seeing the following paragraph it would be a step backwards.
Thanks! I didn't know this intention. Using this to ease the Does (a) removing such variables from |
Hi Pavel, I think (a) is only a partial fix - if RM, CP et al are going away, they should be replace by hard-coded rm, cp etc in funclib and all its clients too. A partial --dry/run implementation is not useful at all. For the same reasons (b) does not present a complete solution either. I would recommend replacing all the environment variables with hard oder command names to be looked up in the users' PATH here- -and probably disabling --dry-run or having it echo a call for implementation if invoked. And then if someone feels sufficiently motivated, a separate patch that audits all the shell command invocations that would do something non-temporary and change those back to HTH, |
s/hard oder/hard coded/ thanks autocorrect! ;-) |
On Tuesday, October 25, 2016 8:54:16 AM CEST Gary V. Vaughan wrote:
Fortunately, those variables don't seem to be used directly from
Right, clients (e.g.
Right, (a) would complement (b) and vice versa, or maybe we just don't
This still sounds like a bit less flexible solution, can you please once
I feel quite motivated, but I fail to understand. Seems like that if I'm quite sure now however that we should be fine with avoiding the |
Hi Pavel, I see what you mean now. I was talking entirely in the abstract before, and should have looked at the actual code sooner. I'm not aware of any other direct clients of funclib.sh in the wild (other than Libtool and our two bootstrap repos), so you are quite right that (a) is totally safe. Now that I've realized that, (b) seems fine to me too. I was worrying that some of the implementation of --dry-run would call in to funclib.sh functions that did rely on being able to change the contents of RM, MV or CP. Searching (on my phone) doesn't come up with anything though. The audit I was suggesting earlier was to make sure that each instance of $RM, $CP or $MV is paired with an eval so that spaces (either from a dry-run mode echo prefix or -f argument etc) are handled properly. Still worthwhile IMHO, but orthogonal to this issue. Cheers, (and apologies for muddying the conversation earlier) |
It has been reported that those variables cause problems, for example:
https://savannah.gnu.org/support/index.php?108987
The problem is naming: The '$RM' name does not clearly say the semantics of the variable (is that
rm -rf
, is thatrm -f
orrm -r
, or plain/bin/rm
only?). Scripts sourcingfunclib.sh
or usingbootstrap
can override those variables with command with slightly different semantics not compatible with semantics we expect inboostrap
project. What's worse there are users exporting those variables in environment...I tend to remove those variables from funclib.sh .. and if some of those is really needed, we can have something like
FL_RM
(FuncLib
) instead of plainRM
. There might be potential users of those variables now .. but to me, it looks like it is still worth braking it now, when there is relatively small userbase. Any ideas?The text was updated successfully, but these errors were encountered: