I wrote:
>I have rated this bug "important" because of this lack of workaround.

I have come up with a truly ugly workaround.  The meta option system
can be used to introduce a -c option that explicitly loads the script
file via primitive-eval, which does not attempt compilation.  (Nor does
it look at the compilation cache, so this even avoids the problem that
--no-auto-compile runs into.)  Running the script this way yields a
different command line (visible through (program-arguments)) from that
which arrives when the script is run via -s, so if the script is to
process its command line, for robustness it must pay attention to which
way it was invoked.  All together, this looks like:

$ cat t11
#!/usr/bin/guile \
-c (begin\
\ \ \ (define\ arg-hack\ #t)\
\ \ \ (primitive-load\ (cadr\ (program-arguments))))
!#
(define argv
  (if (false-if-exception arg-hack)
    (cdr (program-arguments))
    (program-arguments)))
(write argv)
(newline)
$ guile-1.6 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-1.6 -s t11 a b c 
("t11" "a" "b" "c")
$ guile-1.8 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-1.8 -s t11 a b c 
("t11" "a" "b" "c")
$ guile-2.0 '\' t11 a b c
("t11" "a" "b" "c")
$ guile-2.0 -s t11 a b c 
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/zefram/usr/guile/t11
;;; /home/zefram/usr/guile/t11:7:6: warning: possibly unbound variable 
`arg-hack'
;;; compiled 
/home/zefram/.cache/guile/ccache/2.0-LE-8-2.0/home/zefram/usr/guile/t11.go
("t11" "a" "b" "c")
$ guile-2.0 -s t11 a b c
("t11" "a" "b" "c")

I'm not comfortable with this as a workaround.  It smells fragile.
So for the time being I'm leaving the "important" severity tag, but I'm
open to being convinced that it's better than I think.

Note that though this does avoid the banner appearing for #!-based
executions, it's not muffling the banner per se but actually preventing
compilation.  While for some programs it's desirable to prevent
compilation per se (because of the compiler's limitations), there are
plenty of programs that would like to be compiled and only want to muffle
the banner.  Losing the efficiency of compilation is potentially a high
price to pay for clean output.

-zefram


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to