Don't hardcode /usr/local/plan9 in C source code #532
Merged
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.
I maintain a plan9port package for Alpine Linux. For this package, plan9port is installed to
/usr/lib/plan9
not/usr/local/plan9
in order to comply with our packaging policy. Doing so is supported by plan9port via thePLAN9_TARGET
environment variable and the./INSTALL
-r flag. The installation script replaces hardcoded references to/usr/local/plan9
withPLAN9_TARGET
in various files via the./lib/moveplan9.sh
script.A few days ago I was made aware that moveplan9.sh does not replace hardcoded references to
/usr/local/plan9
in C source code files since it is invoked after the code has been compiled. The following files have been identified to contain such hardcoded paths:src/lib9/get9root.c
src/cmd/sam/sam.c
src/cmd/upas/nfs/imap.c
As such, the affected code in these files does not work correctly if plan9port is installed to
/usr/lib/plan9
. For example, get9root does not work if$PLAN9
is not set (e.g. in a rc(1) login shell). This pull request fixes get9root by falling back to the configuredPLAN9_TARGET
via a CPP define instead of hardcoding/usr/local/plan9
inget9root.c
. The remaining two files have been fixed by either using get9root (sam.c
) or using thePLAN9_TARGET
CPP define as well (imap.c
).Would be nice to get this merged in order to ease packaging plan9port for Linux distributions.