-
Notifications
You must be signed in to change notification settings - Fork 185
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
make masterdir configurable via configure option: --with-masterdir=<directory> #1260
Conversation
|
||
const char *GetMasterDir(void) | ||
{ | ||
const char *masterdir = getenv("CFENGINE_TEST_OVERRIDE_WORKDIR"); |
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.
This is workdir, not masterdir; if used, it needs a path-separator + "masterfiles" suffix, I suppose.
Alternatively, we also need a CFENGINE_TEST_OVERRIDE_MASTERDIR.
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.
Correct we have to add 'masterfiles'. Thanks
One problem I see: if someone changes the workdir, via any of the available controls (env, cmd line, etc.), the prior code used to automatically change masterdir to be workdir/masterfiles; unless I've missed something, they'll now need to explicitly also over-ride masterdir, or they'll be left with the default masterdir, not under their adjusted workdir (as, I think, they used to get). This may be desirable in some cases but is not backwards-compatible (if I've understood correctly - and I'm not entirely familiar with the global variable set-up, so this isn't a given). |
The getenv stuff is only for testing purposes. It is used to set cfengine workdir to a test environment (make test). workdir is set to this value and masterfiles is also adjusted to be workdir/masterfiles. This is the default behavior. Masterfiles is only overridden by an configure option (hard coded) or via the getenv method for testing purposes. |
Ah - OK - I had indeed misunderstood. I was thinking run-time configuration, this is ./configure-time, so my worry was entirely spurious :-) |
I'd like the |
@tzz no problem. Or must i make a new one? There are 2 separate things. Due this change we have to support variable expansion at the server side (cf-serverd). relative paths do not work anymore, see https://cfengine.com/dev/issues/3697 |
I think it's OK to put a new commit into this PR. Relative paths never worked :) I think the variable expansion is the way to go to solve that issue, but regardless we should allow @sys.masterdir@ and @sys.inputdir@ to be configurable at compilation. |
On 9 jan. 2014, at 15:22, Ted Zlatanov notifications@github.com wrote:
You are right i noticed this when i changed the sys.masterdir definition. SURFsara has a new telephone number: +31 20 800 1300. Bas van der Vlies |
* ./configure --with-inputdir=<directory> (default: sys.workdir/inputs)
I just realized that i have to adjust some files to make use of the new functions |
* GetInputDir() for inputs directory (sys.inputdir) * GetMasterDir() for masterfiles directory (sys.masterdir)
This looks good to me to be merged. |
make masterdir and inputdir configurable via configure options
@tzz i will do it when this is accepted. Mark, Brian, Martin and me agreed on this options. We must make sure that we do no compromise the security model. |
These changes were reverted in #1287, for the reasons described there. |
{ | ||
char workbuf[CF_BUFSIZE]; | ||
snprintf(workbuf, CF_BUFSIZE, "%s%cmasterfiles", workdir, FILE_SEPARATOR); | ||
MapName(workbuf); |
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.
Trouble. This returns workbuf, which is a local variable of this function ... except that you forgot the word "return" which is required here, so this function actually returns a random pointer, which is probably a bad thing !
If you make workbuf static this can be salvaged. (If you return a malloc()ed string, you avoid the problems with workbuf but you'll leak unless callers are required to free() this function's return, in which case the else clause's return also needs a strdup() call on it.)
GetInputDir() has exactly the same problems.
The compiler warns about the lack of return statement here: please check for new compiler warnings (e.g. ones mentioning your new functions) in future ! I'll patch this by making the arrays static.
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.
good catch! Oversight at my side. Maybe this causing that the build fails and the pull request is reverted
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.
It doesn't cause compilation to fail, and it won't have any effect unless the environment variable is set; since you just added it here (and I see no test that sets it), I don't imagine it has any other way to break the build. See #1287 for the actual reason for revert !
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.
... oh, and I won't be patching this, given that it's been reverted !
Issued a new request: #1293 |
This is being discussed on cfengine-debian mailing list. default value: sys.workdir/masterfiles