Package: emacs;
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Thu, 29 Nov 2012 06:55:01 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Message #8 received at 13026 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: 13026 <at> debbugs.gnu.org Subject: Re: bug#13026: Assume POSIX 1003.1-1988 or later for signal.h. Date: Thu, 29 Nov 2012 19:33:56 +0200
> Date: Wed, 28 Nov 2012 22:52:31 -0800 > From: Paul Eggert <eggert <at> cs.ucla.edu> > > Attached is a proposed patch to simplify Emacs by assuming > POSIX 1003.1-1988 or later for signal.h, which I'd > like to install soon. This patch is relative to > trunk bzr 111026. Tested on Fedora 17. This will break the Windows build in more than one way, unless accompanied by suitable Windows-only changes. Is this the entire changeset, or did you omit some more changes? Here are the problems I found: > === modified file 'lib-src/emacsclient.c' > --- lib-src/emacsclient.c 2012-11-21 21:06:52 +0000 > +++ lib-src/emacsclient.c 2012-11-29 06:46:35 +0000 > @@ -1801,7 +1801,6 @@ > needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; > exit_status = EXIT_FAILURE; > } > -#ifdef SIGSTOP > else if (strprefix ("-suspend ", p)) > { > /* -suspend: Suspend this terminal, i.e., stop the process. */ > @@ -1810,7 +1809,6 @@ > needlf = 0; > kill (0, SIGSTOP); > } > -#endif > else > { > /* Unknown command. */ This will break compilation of emacsclient.c, because SIGSTOP is not defined on MS-Windows, and therefore the -suspend option cannot be supported. And even if we define SIGSTOP to some value, having "-suspend" pretend to work, but do nothing is not a good idea. (We could emulate this option, but that would be a non-trivial change, certainly not belonging in this changeset.) Also, there's no 'kill' on Windows, and the emulation in w32proc.c is only compiled into Emacs itself, not into lib-src programs. > --- src/keyboard.c 2012-11-27 05:17:07 +0000 > +++ src/keyboard.c 2012-11-29 06:46:35 +0000 > @@ -10552,8 +10552,7 @@ > void > stuff_buffered_input (Lisp_Object stuffstring) > { > -#ifdef SIGTSTP /* stuff_char is defined if SIGTSTP. */ > - register unsigned char *p; > + unsigned char *p; > > if (STRINGP (stuffstring)) > { > @@ -10584,7 +10583,6 @@ > } > > input_pending = 0; > -#endif /* SIGTSTP */ > } This will break suspend-emacs on MS-Windows (which does work now by launching a sub-shell), because stuff_char, called by stuff_buffered_input, will now signal an error. > -#ifdef SIGTSTP /* Support possible in later USG versions */ > /* > - * On systems which can suspend the current process and return to the original > - * shell, this command causes the user to end up back at the shell. > + * Cause the user to end up back at the shell. > * The "Auto-save" and "Abort" questions are not asked until > * the user elects to return to emacs, at which point he can save the current > * job and either dump core or continue. > */ > sys_suspend (); > -#else > - /* Perhaps should really fork an inferior shell? > - But that would not provide any way to get back > - to the original shell, ever. */ > - printf ("No support for stopping a process on this operating system;\n"); > - printf ("you can continue or abort.\n"); > -#endif /* not SIGTSTP */ > #ifdef MSDOS > /* We must remain inside the screen area when the internal terminal > is used. Note that [Enter] is not echoed by dos. */ This will also break Windows, because it cannot_suspend, so calling sys_suspend for it does nothing useful (the Windows 'kill' emulation only works on processes other than Emacs, and again SIGTSTP is not going to suspend anything). > @@ -5791,7 +5777,6 @@ > > switch (signo) > { > -#ifdef SIGCONT > case SIGCONT: > p->raw_status_new = 0; > pset_status (p, Qrun); > @@ -5802,7 +5787,7 @@ > redisplay_preserve_echo_area (13); > } > break; > -#endif /* ! defined (SIGCONT) */ This won't compile, since SIGCONT is not defined on Windows. > @@ -5929,11 +5911,8 @@ > pset_command (p, Qnil); > return process; > } > -#ifdef SIGCONT > - process_send_signal (process, SIGCONT, current_group, 0); > -#else > - error ("No SIGCONT support"); > -#endif > + > + process_send_signal (process, SIGCONT, current_group, 0); > return process; > } Likewise. > @@ -5994,28 +5973,18 @@ > > if (0) > ; > -#ifdef SIGUSR1 > parse_signal ("usr1", SIGUSR1); > -#endif > -#ifdef SIGUSR2 > parse_signal ("usr2", SIGUSR2); > -#endif Likewise: SIGUSR1 and SIGUSR2 are not defined. > -#ifdef SIGSTOP > parse_signal ("stop", SIGSTOP); > -#endif > -#ifdef SIGTSTP > parse_signal ("tstp", SIGTSTP); > -#endif > -#ifdef SIGCONT > parse_signal ("cont", SIGCONT); > -#endif > -#ifdef SIGCHLD > parse_signal ("chld", SIGCHLD); > -#endif > -#ifdef SIGTTIN > parse_signal ("ttin", SIGTTIN); > -#endif > -#ifdef SIGTTOU > parse_signal ("ttou", SIGTTOU); > -#endif And the same for all these, except SIGCHLD. > --- src/sysdep.c 2012-11-27 03:10:32 +0000 > +++ src/sysdep.c 2012-11-29 06:46:35 +0000 > @@ -213,8 +213,6 @@ > } > > > -#ifdef SIGTSTP > - > /* Arrange for character C to be read as the next input from > the terminal. > XXX What if we have multiple ttys? > @@ -233,8 +231,6 @@ > error ("Cannot stuff terminal input characters in this version of Unix"); > #endif /* no TIOCSTI */ > } > - > -#endif /* SIGTSTP */ See above: this will now signal an error on Windows. > @@ -428,20 +424,15 @@ > void > sys_suspend (void) > { > -#if defined (SIGTSTP) && !defined (MSDOS) > - > - { > - pid_t pgrp = getpgrp (); > - EMACS_KILLPG (pgrp, SIGTSTP); > - } > - > -#else /* No SIGTSTP */ > +#ifndef MSDOS > + kill (0, SIGTSTP); > +#else > /* On a system where suspending is not implemented, > instead fork a subshell and let it talk directly to the terminal > while we wait. */ > sys_subshell (); > > -#endif /* no SIGTSTP */ > +#endif > } Windows should also call sys_subshell here. > @@ -702,14 +693,12 @@ > static void > tcsetpgrp_without_stopping (int fd, pid_t pgid) > { > -#ifdef SIGTTOU > signal_handler_t handler; > block_input (); > handler = signal (SIGTTOU, SIG_IGN); > tcsetpgrp (fd, pgid); > signal (SIGTTOU, handler); > unblock_input (); > -#endif > } This won't compile because SIGTTOU is not defined. Also, there's no tcsetpgrp on Windows, so this won't link unless we provide an emulation. > -# ifdef SIGCONT > sys_siglist[SIGCONT] = "Continued"; > -# endif Won't compile. > -# ifdef SIGSTOP > sys_siglist[SIGSTOP] = "Stopped (signal)"; > -# endif Likewise. > -# ifdef SIGTSTP > sys_siglist[SIGTSTP] = "Stopped (user)"; > -# endif > -# ifdef SIGTTIN > sys_siglist[SIGTTIN] = "Stopped (tty input)"; > -# endif > -# ifdef SIGTTOU > sys_siglist[SIGTTOU] = "Stopped (tty output)"; > -# endif Likewise. > -# ifdef SIGUSR1 > sys_siglist[SIGUSR1] = "User defined signal 1"; > -# endif > -# ifdef SIGUSR2 > sys_siglist[SIGUSR2] = "User defined signal 2"; > -# endif Likewise. Please also note that NSIG is 23 on Windows, so the sys_siglist array cannot be much larger than it already is (I think most of the 23 slots are already used up). > @@ -1861,12 +1819,8 @@ > sigaction (SIGFPE, &action, 0); > } > > -#ifdef SIGUSR1 > add_user_signal (SIGUSR1, "sigusr1"); > -#endif > -#ifdef SIGUSR2 > add_user_signal (SIGUSR2, "sigusr2"); > -#endif Won't compile.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.