diff --git a/bin/mkpackage.pike b/bin/mkpackage.pike
index f7a9b31db62a29b8bd1c6b12bc430abe1da3dfc9..b684d2c921a6f371b3e5b9caeab83457aff0b48f 100644
--- a/bin/mkpackage.pike
+++ b/bin/mkpackage.pike
@@ -74,8 +74,12 @@ class Package
     string setup_filename = unique_name('S')+".sh";
     string unpack_directory = unique_name('D');
 
-    string features = Process.popen(pike_filename+" --features");
-    options[({ "--features" })] = "echo \""+(features || "")+"\"\nexit";
+    string features = Process.popen(pike_filename+" --features")||"-unknown-";
+    if(features[-1] == '\n')
+      // Remove final newline since echo will provide it.
+      features = features[..sizeof(features)-2];
+    options[({ "--features" })] =
+      (sizeof(features) ? "echo \""+features+"\"\n" : "") + "exit";
     
     string setup = ("#!/bin/sh\n"
 		    "TARFILE=\"$1\"; shift; ARGS=''\n"