Support envvar for ALTPIDPATH#473
Closed
jimklimov wants to merge 3 commits intonetworkupstools:masterfrom
Closed
Conversation
…y envvars to have same effect as not-defined
Member
|
@jimklimov as for NUT_ALTPIDPATH, please also document in docs/configure.txt and docs/man/upsd.txt. |
geraldguillaume
added a commit
to geraldguillaume/nut
that referenced
this pull request
Nov 29, 2017
Signed-off-by: Gerald Guillaume <geraldguillaume@eaton.com>
Member
|
I've completed the documentation in #507, therefor closing this one |
clepple
added a commit
that referenced
this pull request
Dec 3, 2017
jimklimov
added a commit
to jimklimov/nut
that referenced
this pull request
Apr 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
STATEPATHdefined during build can be overridden via envvarNUT_STATEPATHduring run-time, which is useful to e.g. run the recently added "dump" + "cmd line defined" mode of drivers with an otherwise unprivileged account (notnut, notroot). Such execution however claims errors saving the PID file of the driver - because that still uses strictly the macro value ofALTPIDPATHif it is defined (and per theconfigurescript, it is always defined - either by user-provided value, or as fallback toSTATEPATHvalue).This PR adds the same level of flexibility to
ALTPIDPATH, allowing it to useNUT_ALTPIDPATHorNUT_STATEPATHenvvars if defined, and only then fall back to the built-in macros (ALTPIDPATHif defined - which is always in practice, orSTATEPATHotherwise) to match the old, expected and documented behavior.Also this PR adds handling of empty values for these envvars as if they are not defined (otherwise the combined PID file paths effectively resolve to filesystem-root-based paths which is not what the user may have wanted - and for a
rootuser this can cause unexpected actual writes; the user is still free to define the envvar =="/"explicitly.Screenshot from before the PR: the state path can be overridden so the process at least starts, but it complains about the inability to save the PID file:
Screenshots with this PR in place:
Interim screenshot - before adding support for empty envvars same as undefined: