Trailing / on CODEMGR_WS in illumos.sh causes build failure
Exactly as the title says, I had
in my illumos.sh, and it caused odd build failures in usr/src/cmd/localedef, looking like:
/usr/bin/rm -f /code/il-per/proto/root_i386/usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE/LCL_DATA /usr/bin/cp -f /code/il-per/proto/root_i386/usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE/LCL_DATA /code/il-per/proto/root_i386/usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE/LCL_DATA cp: cannot access /code/il-per/proto/root_i386/usr/lib/locale/da_DK.ISO8859-1/LC_COLLATE/LCL_DATA *** Error code 2
Turns out that if you have a / on the end of CODEMGR_WS, this rule in the Makefile breaks:
$(ROOTDATA): $(ROOTLOCDIRS) $(ROOTCATDIRS) $(DATA) $(RM) $@ $(CP) $(@:$(ROOTLIB)/%=%) $@ $(CHMOD) 0444 $@
(Thanks to Albert Lee and Patrickdk on #illumos for helping me track this down!)
Updated by Albert Lee about 7 years ago
usr/src/cmd/localedef/Makefile defines ROOTDATA by preprending "$(ROOTLIB)/" to the $(DATA) paths:
ROOTDATA = $(DATA:%=$(ROOTLIB)/%)
The rules for the actual $(ROOTDATA) targets does the inverse substition on each element to derive the original $(DATA) path:
$(CP) $(@:$(ROOTLIB)/%=%) $@
The actual path from $@ strips extra slashes that were originally present in $(ROOTDATA), so if $(ROOTLIB) contains extra slashes, the substitution fails.
The extra slash can be introduced by the default definition of PARENT_ROOT if $PARENT_WS had a trailing slash:
Updated by Josef Sipek about 6 years ago
Garrett D'Amore wrote:
This is not a big deal. Developer should be know how to configure the environment file. Perhaps we should just fix this by documenting it in the environment file?
Full disclosure: I just got bitten by this.
Maybe I should have known better, but I feel like nightly & bldenv could have been smarter and stripped the trailing / for me.