-
Notifications
You must be signed in to change notification settings - Fork 298
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
getconf
package from HaikuPorts has limited functionality.
#5821
Comments
It now reads "The specified variable is valid and information about its current state was written successfully.". Later, in the rationale:
|
The problem with the value seems to be in Haiku itself. It's a bit late for me and I'll test (even patch, if I'm right) tomorrow, but as I'm reading it now, for PATH |
Ugh POSIX ... (The horror ... the horror ...) It's quite inconsistent and unfriendly that this utility can signal success but not return valid data. Trying to set the PATH to "undefined" (after a 'successful' request for PATH information) is probably still going to cause almost any hypothetical script to fail - and it's a bit involved to check the output in addition to the status - they could have (IMO!) easily just defined a status >1 for this case. This makes something simple into potentially something absurd: GCPATH="$(command -p getconf PATH)" &&
{ # /* getconf */
if [ "${GCPATH:-}" = "undefined" ]; then
printf '%s\n' \
"*** getconf PATH failed! (using fallback)"
GCPATH="/bin:/usr/bin"
fi
} || # /* !getconf */
{
EXIT="${?:-}"
printf '%s\n' \
"*** getconf failed! (${EXIT:?*** shell failed!})"
exit "${EXIT:-1}"
}
printf 'GCPATH=%s\n' \
"${GCPATH:?*** life failed!}"
PATH="${GCPATH}:${PATH}" && export PATH &&
{ # /* export */
printf 'PATH=%s\n' \
"${PATH:?*** God failed!}"
} || # /* !export */
{
EXIT="${?:-}"
printf '%s\n' \
"*** export failed! (${EXIT:?*** shell failed!})"
exit "${EXIT:-1}"
} (Not to mention all the pitfalls in setting the path this way I'm leaving out to make this a short example... using traps can actually make it more complicated...) Of course this is not your fault and really has nothing to do with you ... I'm just ranting ... (grumble…grumble) Thanks for looking into this! |
Oh. That ridiculousness above reminds me (and, sorry, I don't have Haiku handy to check myself), does Haiku's It would be impossible to be able to portably call any standard utility otherwise... Since there are no standard PATHs you can ever depend on even existing (other than The absolute shortest possible way (that I know of) to portably call (set +eu; { \unalias -a; set -f; unset -f env getconf } > /dev/null 2>&1 }; PATH="$(command -p getconf PATH)" env -i PATH="${PATH:?}" ls) So, hopefully, Thanks for caring about this - it would be nice to see |
Adding the command to Haiku is tracked here: https://dev.haiku-os.org/ticket/10269 |
* Off-by-one error copying the string. * As per the spec, return the buffer length for the string when passed a null pointer and 0 length. Fixes haikuports/haikuports#5821 Change-Id: Ic421f26db00f9820c6a617375e39f7341cd5ebc1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4110 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
I did a quick check and indeed it seems to resolve the problem. I'll go ahead and close this issue - thanks again. (Closing: fixed in haiku/haiku@4c23dfb) |
* Off-by-one error copying the string. * As per the spec, return the buffer length for the string when passed a null pointer and 0 length. Fixes haikuports/haikuports#5821 Change-Id: Ic421f26db00f9820c6a617375e39f7341cd5ebc1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4110 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com> (cherry picked from commit 4c23dfb) Reviewed-on: https://review.haiku-os.org/c/haiku/+/4019 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested on Hybrid Haiku (Walter/hrev55027):
getconf
package from HaikuPorts is non-functional.Steps to reproduce:
getconf
usingpkgman
;getconf PATH; printf '%s\n' $?
Expected result:
(or
/bin:/boot/system/apps:/boot/system/preferences
, or similar)Message when executed from terminal:
Additional information:
getconf
and should be supported.getconf
should not, by my reading, exit with status0
.0
means that "The specified parameter_name was valid andgetconf
displayed its value successfully.". It was valid, but because the value was not displayed successfully, the status should be greater than zero (IMHO).The text was updated successfully, but these errors were encountered: