If a file myarch.tar.gz exists and at the shell I
accidentally type
tar czf myarch.tar.gz,
then I get
tar: Cowardly refusing to create an empty archive,
which is good behavior.
If a file of Maxima functions myfuncs.mac exists and I type
compile_file("myfuncs.mac");
then the functions are compiled and loaded into my session.
But if instead, I type
compfile("myfuncs.mac");
then myfuncs.mac is overwritten by a file of length zero,
which makes a poor choice in naming functions much worse.
I suppose it wouldn't break any existing code to change the
behavior of compfile to be more like that of tar.
Below is a one-line patch for instance. I haven't tried to
build or test Maxima, but I did try the modified function.
----------------------------------------------------------
--- src/transs.lisp 2008-08-14 22:47:37.000000000 -0700
+++ src/transs.lisp 2008-09-06 14:50:13.000000000 -0700
@@ -89,6 +89,7 @@
(defmspec $compfile (forms)
(setq forms (cdr forms))
+ (if (eq 1 (length forms)) (merror "bravely refusing to write file of
length 0"))
(bind-transl-state
(setq $transcompile t
*in-compfile* t)
----------------------------------------------------------