--- /home/jani/cabal.orig	2010-09-20 15:39:36.000000000 +0200
+++ cabal	2010-09-20 16:16:06.000000000 +0200
@@ -36,8 +36,9 @@
 
     # save 'cabal list' output to a temporary file
     # putting it in a variable would mess up the lines
-    local tmp=$( mktemp /tmp/cabal_completion.XXXXXX )
-    $cmd > $tmp
+    local tmp
+    tmp=$( mktemp /tmp/cabal_completion.XXXXXX ) || return
+    $cmd >> $tmp
 
     if [[ "$packages" == "yes" ]]; then
         # print only the names
