From a819b51a8dd89c4f8758225ad0bff63b57ea5976 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 9 Dec 2014 17:23:14 +0100
Subject: [PATCH] Master: Complain about inherited joinnodes and dirnodes.

A common cause for this is an attempt to inherit a module that is a dirnode.

Complaining at creation time makes it easier to find the mistake.
---
 lib/master.pike.in | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/master.pike.in b/lib/master.pike.in
index 87a0ec0bf7..93e4f8232d 100644
--- a/lib/master.pike.in
+++ b/lib/master.pike.in
@@ -1967,6 +1967,11 @@ class dirnode (string dirname, object|void compilation_handler,
 
   protected void create()
   {
+    if (!dirname) {
+      error("Attempt to create a dirnode without a directory.\n"
+	    "Have you inherited a dirnode?\n");
+    }
+
     resolv_debug ("dirnode(%O,%O) created with name %O\n", dirname,
                   compilation_handler, name);
     fc[dirname]=this;
@@ -2323,6 +2328,11 @@ class joinnode (array(object|mapping) joined_modules,
       fallback_module = ([]);
     }
 
+    if (!joined_modules) {
+      error("Attempt to create a joinnode without joined modules.\n"
+	    "Have you inherited a joinnode?\n");
+    }
+
     if (!name)
     {
       mapping(string:int(1..1)) names = ([]);
-- 
GitLab