Skip to content

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

@monadnoc

Description

@monadnoc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions