m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trapping SIGINT?


From: Gary V. Vaughan
Subject: Re: Trapping SIGINT?
Date: Fri, 14 Apr 2006 17:02:43 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)

Hallo Stepan,

Stepan Kasal wrote:
>   the Autoconf calls m4 with std input redirected from /dev/null:
> 
> 2001-09-07  Akim Demaille
>       * bin/autom4te.in (&handle_m4): `< /dev/null' so that GNU M4 1.5
>       doesn't neutralize SIGINT, making autoconf etc. non interruptible.
> 
> Is this concern still valid?  Is it true that otherwise the command
> 
> m4 --nesting-limit=1024 --include=/usr/local/share/autoconf \
>    --debug=aflq --fatal-warning --error-output=/tmp/am4tq25545/traces.0t \
>    --trace=_m4_warn --trace=include --trace=m4_include \
>    --trace=m4_pattern_allow --trace=m4_pattern_forbid \
>    --reload-state=/usr/local/share/autoconf/m4sugar/m4sh.m4f \
>    a.in >/tmp/am4tq25545/output.0t
> 
> would not be interruptible when run with m4 2.0?

I don't have an m4-2.0 binary on this machine, but by inspection of
http://trac.azazil.net/projects/m4/index.cgi/browser/trunk/src/main.c:

...
102 -b, --batch                  buffer output, process interrupts\n\
103 -e, --interactive            unbuffer output, ignore interrupts\n\
...
242       if (isatty (STDIN_FILENO))
243         m4_set_interactive_opt (context, true);
...
335           case 'b':
336             m4_set_interactive_opt (context, false);
337             break;
...
352           case 'e':
353             m4_set_interactive_opt (context, true);
354             break;

It appears that STDIN_FILENO will indeed be a tty, and that interrupts
will be ignored.  There are a couple of solutions:

   i) add a </dev/null to the invocation
  ii) add a -b flag to the options
 iii) maybe, 242 should be:
        if (isatty (STDIN_FILENO) && isatty (STDOUT_FILENO))'?

The intention is to allow users to start an interactive m4 session, and
be able to kill subprocesses with ^C and not accidentally drop out of m4
back to the parent process.  I think (iii) is a reasonable approach, and
maintains backwards compatibility with autoconf without tripping up
interactive users...

> (Do I understand correctly that m4-1.5 will probably never happen?)

1.5 gradually become so different from m4 that it is almost a complete
rewrite so it was redubbed 2.0 at some point along the way.

Cheers,
        Gary.
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://blog.azazil.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]