* Autoconf's `GUILE_CHECK' macro broken
@ 2005-09-12 15:27 Ludovic Courtès
2005-09-13 9:09 ` Thien-Thi Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2005-09-12 15:27 UTC (permalink / raw)
Hi,
It looks like the Autoconf `GUILE_CHECK' macro (or perhaps Guile itself)
is broken. In both Guile 1.6 and 1.7, it is defined as follows:
# GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
#
# Usage: GUILE_CHECK_RETVAL(var,check)
#
# @var{var} is a shell variable name to be set to the return value.
# @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and
# returning either 0 or non-#f to indicate the check passed.
# Non-0 number or #f indicates failure.
# Avoid using the character "#" since that confuses autoconf.
#
AC_DEFUN([GUILE_CHECK],
[AC_REQUIRE([GUILE_PROGS])
$GUILE -c "$2" > /dev/null 2>&1
$1=$?
])
However, both versions of Guile return zero, regardless of whether the
expression passed to `-c' returned false or not.
Actually, my guess would be that Guile is broken, not the macro. But
then, I'd be surprised to be the first one hitting that problem.
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Autoconf's `GUILE_CHECK' macro broken
2005-09-12 15:27 Autoconf's `GUILE_CHECK' macro broken Ludovic Courtès
@ 2005-09-13 9:09 ` Thien-Thi Nguyen
2005-09-13 11:00 ` Guile's return value Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Thien-Thi Nguyen @ 2005-09-13 9:09 UTC (permalink / raw)
Cc: guile-user
From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Date: Mon, 12 Sep 2005 17:27:12 +0200
However, both versions of Guile return zero, regardless of whether
the expression passed to `-c' returned false or not.
check out how the other macros in guile.m4 use GUILE_CHECK. in each
case, the last form in the group of forms to be tested uses (exit ...).
the reason we leave it as a convention instead of codifying it into
GUILE_CHECK is to allow for multiple forms in the test (for example,
see GUILE_MODULE_CHECK).
thanks for reporting this. the next release of guile 1.4.x, will have
the appended documentation for GUILE_CHECK. i suggest other branches
update accordingly.
thi
__________________________________________
# Usage: GUILE_CHECK(var,check)
#
# Set @var{var} to the numeric return value of evaluating @var{check}.
# @var{var} is a shell variable name to be set to the return value.
#
# @var{check} is one or more Guile Scheme expression, evaluated with
# "$GUILE -c", the last of which should return either 0 or non-#f to
# indicate the check passed. Non-0 number or #f indicates failure.
# This is conventionally achieved by wrapping the last expression in
# @code{exit}. For example, @code{(foo) (bar) (exit (baz))}.
#
# Avoid using the character "#" since that confuses autoconf.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 4+ messages in thread
* Guile's return value
2005-09-13 9:09 ` Thien-Thi Nguyen
@ 2005-09-13 11:00 ` Ludovic Courtès
2005-09-13 14:10 ` Thien-Thi Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2005-09-13 11:00 UTC (permalink / raw)
Cc: guile-user
Hi,
Thien-Thi Nguyen <ttn@glug.org> writes:
> check out how the other macros in guile.m4 use GUILE_CHECK. in each
> case, the last form in the group of forms to be tested uses (exit ...).
> the reason we leave it as a convention instead of codifying it into
> GUILE_CHECK is to allow for multiple forms in the test (for example,
> see GUILE_MODULE_CHECK).
Right, thanks for pointing it out, I had not checked this.
However, is there a reason for Guile's return value to be independent of
the expression evaluated? I think it would make sense, especially for
scripts, to have Guile behave according to the expression(s) evaluated.
Even uncaught exceptions yield a zero return value, which doesn't sound
like a very good idea.
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Guile's return value
2005-09-13 11:00 ` Guile's return value Ludovic Courtès
@ 2005-09-13 14:10 ` Thien-Thi Nguyen
0 siblings, 0 replies; 4+ messages in thread
From: Thien-Thi Nguyen @ 2005-09-13 14:10 UTC (permalink / raw)
Cc: guile-user
From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=)
Date: Tue, 13 Sep 2005 13:00:45 +0200
However, is there a reason for Guile's return value to be independent
of the expression evaluated? I think it would make sense, especially
for scripts, to have Guile behave according to the expression(s)
evaluated.
Even uncaught exceptions yield a zero return value, which doesn't
sound like a very good idea.
bash seems to agree as well:
$ sh -c false ; echo $?
1
$ echo false > bad ; sh bad ; echo $?
1
here is the excerpt from libguile/script.c that implements the current
behavior (along w/ the discarding of the -c expression's value):
/* After doing all the other actions prescribed by the command
line, quit. */
tail = scm_cons (scm_cons (sym_quit, SCM_EOL), tail);
i suppose whoever wrote that expected explicit `exit' or `quit' to be
used to communicate exit value w/ the caller, which is not unreasonable.
thi
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-13 14:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-12 15:27 Autoconf's `GUILE_CHECK' macro broken Ludovic Courtès
2005-09-13 9:09 ` Thien-Thi Nguyen
2005-09-13 11:00 ` Guile's return value Ludovic Courtès
2005-09-13 14:10 ` Thien-Thi Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).