Date: Fri, 23 Apr 2004 19:49:25 +0900 (JST) From: NIIMI Satoshi <sa2c@sa2c.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: nobutaka@FreeBSD.org Subject: ports/65910: editor/emacs ignores C-g when creating network connection Message-ID: <20040423104925.973365C86@berkeley.l.sa2c.net> Resent-Message-ID: <200404231050.i3NAoODg069838@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 65910 >Category: ports >Synopsis: editor/emacs ignores C-g when creating network connection >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 23 03:50:24 PDT 2004 >Closed-Date: >Last-Modified: >Originator: NIIMI Satoshi >Release: FreeBSD 5.2.1-RELEASE-p5 i386 >Organization: >Environment: System: FreeBSD berkeley.l.sa2c.net 5.2.1-RELEASE-p5 FreeBSD 5.2.1-RELEASE-p5 #3: Fri Apr 16 08:33:34 JST 2004 root@berkeley.l.sa2c.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: Emacs checks interrupt key input (C-g) periodically when it blocks long time. But a patch file for src:process.c in ports tree does not. This makes open-network-stream() non-interruptable. >How-To-Repeat: Emacs on X on FreeBSD 5: (with-temp-buffer ;; "host" is a resolbable but unreachable host. (open-network-stream "hoge" (current-buffer) "host" "smtp")) will block for long time and cannot be interrupted by hitting C-g. >Fix: I don't know this is "correct" patch, but this works for me well. --- patch begins here --- Index: files/patch-src:process.c =================================================================== RCS file: /home/ncvs/ports/editors/emacs/files/patch-src:process.c,v retrieving revision 1.1 diff -u -d -r1.1 patch-src:process.c --- files/patch-src:process.c 21 Mar 2004 07:38:53 -0000 1.1 +++ files/patch-src:process.c 23 Apr 2004 10:30:34 -0000 @@ -1,32 +1,9 @@ --- src/process.c.orig Mon Mar 17 07:06:56 2003 -+++ src/process.c Tue Aug 12 01:17:12 2003 -@@ -1850,6 +1850,7 @@ - for (lres = res; lres; lres = lres->ai_next) - { - s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); -+ - if (s < 0) - { - xerrno = errno; -@@ -1882,19 +1883,43 @@ - It'd be nice to be able to control the connect timeout - though. Would non-blocking connect calls be portable? */ - turn_on_atimers (0); -+ - ret = connect (s, lres->ai_addr, lres->ai_addrlen); - xerrno = errno; - turn_on_atimers (1); - -- if (ret == 0 || xerrno == EISCONN) -+ if (ret == 0 || xerrno == EISCONN ) - /* The unwind-protect will be discarded afterwards. ++++ src/process.c Fri Apr 23 19:28:58 2004 +@@ -1891,10 +1891,34 @@ Likewise for immediate_quit. */ break; - immediate_quit = 0; - -- if (xerrno == EINTR) -- goto loop; +#if 1 + if ( (errno == EINTR ) || (errno == EINPROGRESS)){ + fd_set fds; @@ -37,6 +14,7 @@ + FD_ZERO(&fds); + FD_SET(s, &fds); + resel: ++ QUIT; + e = select(s+1, NULL, &fds, NULL, &tv); + + if( e == -1){ @@ -52,19 +30,17 @@ + } +#endif + + immediate_quit = 0; + +- if (xerrno == EINTR) +- goto loop; if (xerrno == EADDRINUSE && retry < 20) { /* A delay here is needed on some FreeBSD systems, -@@ -2000,11 +2025,30 @@ - && errno != EISCONN) +@@ -2001,10 +2025,30 @@ { int xerrno = errno; -- -+ - immediate_quit = 0; -- if (errno == EINTR) -- goto loop; +#if 1 + if ( (errno == EINTR ) || (errno == EINPROGRESS)){ + fd_set fds; @@ -75,6 +51,7 @@ + FD_CLEAR(&fds); + FD_SET(s, &fds); + resel: ++ QUIT; + e = select(s+1, NULL, fds, NULL, &tv); + if( e != 0){ + if(errno == EINTR) @@ -86,6 +63,10 @@ + xerrno = 0; + } +#endif + immediate_quit = 0; + +- if (errno == EINTR) +- goto loop; if (errno == EADDRINUSE && retry < 20) { /* A delay here is needed on some FreeBSD systems, --- patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040423104925.973365C86>