zsh-workers
 help / color / mirror / code / Atom feed
* SIGTTOU old problem
@ 2005-02-28 13:41 Borzenkov Andrey
  2005-02-28 14:13 ` Peter Stephenson
  2005-02-28 14:29 ` Philippe Troin
  0 siblings, 2 replies; 7+ messages in thread
From: Borzenkov Andrey @ 2005-02-28 13:41 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

At work I still have attached patch. Comments what should become of it?

-andrey
__________
www.newmail.ru -- всегда что-то новое.

[-- Attachment #2: ttou.diff --]
[-- Type: application/octet-stream, Size: 951 bytes --]

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.29
diff -u -r1.29 configure.ac
--- configure.ac	24 Feb 2005 16:53:09 -0000	1.29
+++ configure.ac	28 Feb 2005 13:36:46 -0000
@@ -1863,7 +1863,7 @@
 if test "x$ac_cv_func_tcsetpgrp" = xyes; then
 case "x$zsh_working_tcsetpgrp" in
   xcheck)
-    trap "" SIGTTOU > /dev/null 2>&1 || :
+    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 
     AC_CACHE_CHECK(if tcsetpgrp() actually works,
     zsh_cv_sys_tcsetpgrp,
     [AC_TRY_RUN([
@@ -1894,7 +1894,7 @@
 Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
       *)      AC_MSG_ERROR([unexpected return status]);;
     esac
-    trap - SIGTTOU > /dev/null 2>&1 || :
+    ( trap - SIGTTOU > /dev/null 2>&1 ) && trap - SIGTTOU > /dev/null 2>&1 
     ;;
   xyes) :;;
   xno)  AC_DEFINE(BROKEN_TCSETPGRP);;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: SIGTTOU old problem
  2005-02-28 13:41 SIGTTOU old problem Borzenkov Andrey
@ 2005-02-28 14:13 ` Peter Stephenson
  2005-02-28 14:24   ` Peter Stephenson
  2005-02-28 14:29 ` Philippe Troin
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2005-02-28 14:13 UTC (permalink / raw)
  To: Borzenkov Andrey; +Cc: zsh-workers

Borzenkov Andrey wrote:
> At work I still have attached patch. Comments what should become of it?

>-    trap "" SIGTTOU > /dev/null 2>&1 || :
>+    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 

Well, it *looks* harmless enough.

By the way, this will fail if sh happens to be zsh since we don't strip
the SIG from the signal name, which appears to be optional in other
shells.  (ksh and bash differ in whether the output shows the SIG or not.)

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: SIGTTOU old problem
  2005-02-28 14:13 ` Peter Stephenson
@ 2005-02-28 14:24   ` Peter Stephenson
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 2005-02-28 14:24 UTC (permalink / raw)
  To: zsh-workers

Peter Stephenson wrote:
> By the way, this will fail if sh happens to be zsh since we don't strip
> the SIG from the signal name, which appears to be optional in other
> shells.  (ksh and bash differ in whether the output shows the SIG or not.)

This is easy to fix.

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.74
diff -u -r1.74 builtins.yo
--- Doc/Zsh/builtins.yo	19 Jan 2005 13:04:09 -0000	1.74
+++ Doc/Zsh/builtins.yo	28 Feb 2005 14:21:20 -0000
@@ -1157,8 +1157,9 @@
 item(tt(trap) [ var(arg) [ var(sig) ... ] ])(
 var(arg) is a series of commands (usually quoted to protect it from
 immediate evaluation by the shell) to be read and executed when the shell
-receives var(sig).  Each var(sig) can be given as a number
-or as the name of a signal.
+receives var(sig).  Each var(sig) can be given as a number,
+or as the name of a signal either with or without the string tt(SIG)
+in front.
 If var(arg) is `tt(-)', then all traps var(sig) are reset to their
 default values.  If var(arg) is the empty string, then this signal
 is ignored by the shell and by the commands it invokes.
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.37
diff -u -r1.37 jobs.c
--- Src/jobs.c	14 Jan 2005 13:05:21 -0000	1.37
+++ Src/jobs.c	28 Feb 2005 14:21:20 -0000
@@ -1874,6 +1874,8 @@
 		    while (*++argv) {
 			sig = zstrtol(*argv, &signame, 10);
 			if (signame == *argv) {
+			    if (!strncmp(signame, "SIG", 3))
+				signame += 3;
 			    for (sig = 1; sig <= SIGCOUNT; sig++)
 				if (!cstrpcmp(sigs + sig, &signame))
 				    break;
@@ -1942,7 +1944,8 @@
 		} else
 		    signame = *argv;
 		makeuppercase(&signame);
-		if (!strncmp(signame, "SIG", 3)) signame+=3;
+		if (!strncmp(signame, "SIG", 3))
+		    signame+=3;
 
 		/* check for signal matching specified name */
 		for (sig = 1; sig <= SIGCOUNT; sig++)
@@ -2032,6 +2035,9 @@
 	return x;
 
     /* search for signal by name */
+    if (!strncmp(s, "SIG", 3))
+	s += 3;
+
     for (i = 0; i < VSIGCOUNT; i++)
 	if (!strcmp(s, sigs[i]))
 	    return i;

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re[2]: SIGTTOU old problem
  2005-02-28 14:29 ` Philippe Troin
@ 2005-02-28 14:29   ` Borzenkov Andrey
  2005-02-28 15:23     ` Philippe Troin
  0 siblings, 1 reply; 7+ messages in thread
From: Borzenkov Andrey @ 2005-02-28 14:29 UTC (permalink / raw)
  To: zsh-workers

Hello Philippe Troin 

Пн, 28.02.2005 18:29:43 you wrote:
PT> > -    trap "" SIGTTOU > /dev/null 2>&1 || :
PT> > +    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 
PT> Why?  What does it buy?
PT> 

SUS specifies that trap is special builtin so error in "trap" should terminate non-interactive shell. On my system (and as Peter hinted probably everywhere else) trap SIGTTOU is invalid (trap TTOU is valid) so configure exits without any chance to see || :.

To the author of original check - please test if my patch works for you as intended and I commit it. Alternative is to change it into "trap "" TTOU" that is likely to be more portable.

-andrey

__________
www.newmail.ru -- узел свободных коммуникаций.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: SIGTTOU old problem
  2005-02-28 13:41 SIGTTOU old problem Borzenkov Andrey
  2005-02-28 14:13 ` Peter Stephenson
@ 2005-02-28 14:29 ` Philippe Troin
  2005-02-28 14:29   ` Re[2]: " Borzenkov Andrey
  1 sibling, 1 reply; 7+ messages in thread
From: Philippe Troin @ 2005-02-28 14:29 UTC (permalink / raw)
  To: Borzenkov Andrey; +Cc: zsh-workers

Borzenkov Andrey <arvidjaar@newmail.ru> writes:

> At work I still have attached patch. Comments what should become of it?

Meat of path patch:

> -    trap "" SIGTTOU > /dev/null 2>&1 || :
> +    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 
Why?  What does it buy?

Phil.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re[2]: SIGTTOU old problem
  2005-02-28 14:29   ` Re[2]: " Borzenkov Andrey
@ 2005-02-28 15:23     ` Philippe Troin
  2005-03-14  7:54       ` Philippe Troin
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Troin @ 2005-02-28 15:23 UTC (permalink / raw)
  To: Borzenkov Andrey; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

Borzenkov Andrey <arvidjaar@newmail.ru> writes:

> Hello Philippe Troin 
> 
> Пн, 28.02.2005 18:29:43 you wrote:
> PT> > -    trap "" SIGTTOU > /dev/null 2>&1 || :
> PT> > +    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 
> PT> Why?  What does it buy?
> PT> 
> 
> SUS specifies that trap is special builtin so error in "trap" should
> terminate non-interactive shell. On my system (and as Peter hinted
> probably everywhere else) trap SIGTTOU is invalid (trap TTOU is
> valid) so configure exits without any chance to see || :.

Got to love these "special" builtins.  Yet another kind of weird
dehavior.

> To the author of original check - please test if my patch works for
> you as intended and I commit it. Alternative is to change it into
> "trap "" TTOU" that is likely to be more portable.

This will work as intended.  I'd rather use TTOU since it's more
portable.

Patch enclosed.

Phil.

2005-02-28  Philippe Troin  <phil@fifi.org>

	* 20886: configure.ac: Use TTOU with trap rather than SIGTTOU.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: zsh-ttou.patch --]
[-- Type: text/x-patch, Size: 877 bytes --]

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.29
diff -b -u -r1.29 configure.ac
--- configure.ac	24 Feb 2005 16:53:09 -0000	1.29
+++ configure.ac	28 Feb 2005 15:22:59 -0000
@@ -1863,7 +1863,7 @@
 if test "x$ac_cv_func_tcsetpgrp" = xyes; then
 case "x$zsh_working_tcsetpgrp" in
   xcheck)
-    trap "" SIGTTOU > /dev/null 2>&1 || :
+    trap "" TTOU > /dev/null 2>&1 || :
     AC_CACHE_CHECK(if tcsetpgrp() actually works,
     zsh_cv_sys_tcsetpgrp,
     [AC_TRY_RUN([
@@ -1894,7 +1894,7 @@
 Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
       *)      AC_MSG_ERROR([unexpected return status]);;
     esac
-    trap - SIGTTOU > /dev/null 2>&1 || :
+    trap - TTOU > /dev/null 2>&1 || :
     ;;
   xyes) :;;
   xno)  AC_DEFINE(BROKEN_TCSETPGRP);;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re[2]: SIGTTOU old problem
  2005-02-28 15:23     ` Philippe Troin
@ 2005-03-14  7:54       ` Philippe Troin
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Troin @ 2005-03-14  7:54 UTC (permalink / raw)
  To: zsh-workers; +Cc: Bart Schaefer

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Will someone (Bart?) apply this patch?

Phil.

Philippe Troin <phil@fifi.org> writes:

> Borzenkov Andrey <arvidjaar@newmail.ru> writes:
> 
> > Hello Philippe Troin 
> > 
> > Пн, 28.02.2005 18:29:43 you wrote:
> > PT> > -    trap "" SIGTTOU > /dev/null 2>&1 || :
> > PT> > +    ( trap "" SIGTTOU > /dev/null 2>&1 ) && trap "" SIGTTOU > /dev/null 2>&1 
> > PT> Why?  What does it buy?
> > PT> 
> > 
> > SUS specifies that trap is special builtin so error in "trap" should
> > terminate non-interactive shell. On my system (and as Peter hinted
> > probably everywhere else) trap SIGTTOU is invalid (trap TTOU is
> > valid) so configure exits without any chance to see || :.
> 
> Got to love these "special" builtins.  Yet another kind of weird
> dehavior.
> 
> > To the author of original check - please test if my patch works for
> > you as intended and I commit it. Alternative is to change it into
> > "trap "" TTOU" that is likely to be more portable.
> 
> This will work as intended.  I'd rather use TTOU since it's more
> portable.
> 
> Patch enclosed.
> 
> Phil.
> 
> 2005-02-28  Philippe Troin  <phil@fifi.org>
> 
> 	* 20886: configure.ac: Use TTOU with trap rather than SIGTTOU.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: zsh-ttou.patch --]
[-- Type: text/x-patch, Size: 877 bytes --]

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.29
diff -b -u -r1.29 configure.ac
--- configure.ac	24 Feb 2005 16:53:09 -0000	1.29
+++ configure.ac	28 Feb 2005 15:22:59 -0000
@@ -1863,7 +1863,7 @@
 if test "x$ac_cv_func_tcsetpgrp" = xyes; then
 case "x$zsh_working_tcsetpgrp" in
   xcheck)
-    trap "" SIGTTOU > /dev/null 2>&1 || :
+    trap "" TTOU > /dev/null 2>&1 || :
     AC_CACHE_CHECK(if tcsetpgrp() actually works,
     zsh_cv_sys_tcsetpgrp,
     [AC_TRY_RUN([
@@ -1894,7 +1894,7 @@
 Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
       *)      AC_MSG_ERROR([unexpected return status]);;
     esac
-    trap - SIGTTOU > /dev/null 2>&1 || :
+    trap - TTOU > /dev/null 2>&1 || :
     ;;
   xyes) :;;
   xno)  AC_DEFINE(BROKEN_TCSETPGRP);;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-03-14  7:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-28 13:41 SIGTTOU old problem Borzenkov Andrey
2005-02-28 14:13 ` Peter Stephenson
2005-02-28 14:24   ` Peter Stephenson
2005-02-28 14:29 ` Philippe Troin
2005-02-28 14:29   ` Re[2]: " Borzenkov Andrey
2005-02-28 15:23     ` Philippe Troin
2005-03-14  7:54       ` Philippe Troin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).