rocksclusters / base

Base roll for Rocks Clusters
http://www.rocksclusters.org/
25 stars 10 forks source link

'make 2>&1' stops if directory has no 'grandparent ' #36

Open monadnoc opened 6 years ago

monadnoc commented 6 years ago

On a fresh install of Rocks 7 with kernel, base, core, CentOs, Updates-CentOS (+ sge, hpc, and ganglia): make 2>&1 to build a roll in the /root/ directory returns /opt/rocks/share/devel/src/roll/../../etc/Rules.mk:622: *** first argument to 'word' function must be greater than 0. Stop.

The offending line in the Rules.mk is part of the last one in this set

PATH.CHILD      = $(notdir $(CURDIR))
PATH.PARENTPATH = $(dir $(CURDIR))
PATH.PARENTLIST = $(subst /, ,$(dir $(CURDIR)))
PATH.PARENT     = $(word $(words $(PATH.PARENTLIST)), $(PATH.PARENTLIST))
PATH.GRANDPARENTLIST = $(subst $(PATH.PARENT),,$(PATH.PARENTLIST))
PATH.GRANDPARENT     = $(word $(words $(PATH.GRANDPARENTLIST)), $(PATH.GRANDPARENTLIST))

Is this rule necessary? Can it be conditioned such that if make is initiated in a folder without a grandparent or even in a directory where '/' itself is a grandparent (that is, any directory not nested twice from '/') , that it does not break the build?

This issue persists from Rocks 6 (except the line was 621 instead of 622 here). See this archived email chain. Credit to @rpwagner for the workaround

The workaround is to just always build in a directory two down from '/', but this fix is not obvious to a novice and the error can draw issues in other repos rather than here.