From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#12968: Assume POSIX 1003.1-1988 or later for errno.h. Date: Fri, 23 Nov 2012 01:04:27 -0800 Organization: UCLA Computer Science Department Message-ID: <50AF3C1B.7040105@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1353661554 29458 80.91.229.3 (23 Nov 2012 09:05:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Nov 2012 09:05:54 +0000 (UTC) To: 12968@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 23 10:06:05 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TbpD2-0000bf-WB for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Nov 2012 10:06:05 +0100 Original-Received: from localhost ([::1]:54437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpCs-0000Id-8z for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Nov 2012 04:05:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpCi-0008Mf-Fr for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:05:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbpCb-0008OX-PE for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:05:44 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpCb-0008OT-LS for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:05:37 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TbpDy-0007Ac-Ij for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Nov 2012 09:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12968 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135366159827521 (code B ref -1); Fri, 23 Nov 2012 09:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Nov 2012 09:06:38 +0000 Original-Received: from localhost ([127.0.0.1]:34062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TbpDW-00079j-32 for submit@debbugs.gnu.org; Fri, 23 Nov 2012 04:06:38 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39611) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TbpDL-00079J-L7 for submit@debbugs.gnu.org; Fri, 23 Nov 2012 04:06:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbpBu-0007ny-B4 for submit@debbugs.gnu.org; Fri, 23 Nov 2012 04:04:58 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:33822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpBu-0007nu-7h for submit@debbugs.gnu.org; Fri, 23 Nov 2012 04:04:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpBp-0007TE-9w for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:04:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbpBg-0007lD-OG for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:04:49 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:34347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbpBg-0007kG-Cx for bug-gnu-emacs@gnu.org; Fri, 23 Nov 2012 04:04:40 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 402FFA6001E for ; Fri, 23 Nov 2012 01:04:32 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wNFjQ36Co0Rg for ; Fri, 23 Nov 2012 01:04:27 -0800 (PST) Original-Received: from [192.168.1.3] (pool-71-189-154-249.lsanca.fios.verizon.net [71.189.154.249]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 49F01A60008 for ; Fri, 23 Nov 2012 01:04:27 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67346 Archived-At: Here's a patch to simplify Emacs by assuming POSIX 1003.1-1988 or later for errno.h, which I plan to install soon. This should be safe as other parts of Emacs are already assuming the relevant macros. I haven't tested this on Microsoft platforms though. === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-11-23 08:28:06 +0000 +++ lib-src/ChangeLog 2012-11-23 08:56:17 +0000 @@ -1,5 +1,8 @@ 2012-11-23 Paul Eggert + Assume POSIX 1003.1-1988 or later for errno.h. + * movemail.c (main): Assume EAGAIN and EBUSY. + movemail: treat EACCES etc. failures as permanent * movemail.c (main): Treat any link failure other than EEXIST as a permanent failure, not just EPERM. EACCES, for example. === modified file 'lib-src/movemail.c' --- lib-src/movemail.c 2012-11-23 08:28:06 +0000 +++ lib-src/movemail.c 2012-11-23 08:56:17 +0000 @@ -430,22 +430,10 @@ for certain failure codes. */ if (status < 0) { - if (++lockcount <= 5) + if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY)) { -#ifdef EAGAIN - if (errno == EAGAIN) - { - sleep (1); - goto retry_lock; - } -#endif -#ifdef EBUSY - if (errno == EBUSY) - { - sleep (1); - goto retry_lock; - } -#endif + sleep (1); + goto retry_lock; } pfatal_with_name (inname); === modified file 'src/ChangeLog' --- src/ChangeLog 2012-11-23 08:47:34 +0000 +++ src/ChangeLog 2012-11-23 08:59:17 +0000 @@ -1,3 +1,16 @@ +2012-11-23 Paul Eggert + + Assume POSIX 1003.1-1988 or later for errno.h. + * dired.c (directory_files_internal, file_name_completion): + Assume EAGAIN and EINTR are defined. + * fileio.c (Fcopy_file): Assume EISDIR is defined. + * gmalloc.c (ENOMEM, EINVAL): Assume they're defined. + * gnutls.c (emacs_gnutls_write): Assume EAGAIN is defined. + * lread.c (readbyte_from_file): Assume EINTR is defined. + * process.c (wait_reading_process_output, send_process) [subprocesses]: + Assume EIO and EAGAIN are defined. + * unexcoff.c (write_segment): Assume EFAULT is defined. + 2012-11-23 Eli Zaretskii * makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead === modified file 'src/dired.c' --- src/dired.c 2012-11-23 07:48:43 +0000 +++ src/dired.c 2012-11-23 08:56:17 +0000 @@ -193,19 +193,15 @@ errno = 0; dp = readdir (d); - - if (dp == NULL && (0 -#ifdef EAGAIN - || errno == EAGAIN -#endif -#ifdef EINTR - || errno == EINTR -#endif - )) - { QUIT; continue; } - - if (dp == NULL) - break; + if (!dp) + { + if (errno == EAGAIN || errno == EINTR) + { + QUIT; + continue; + } + break; + } len = dirent_namelen (dp); name = finalname = make_unibyte_string (dp->d_name, len); @@ -480,17 +476,15 @@ errno = 0; dp = readdir (d); - if (dp == NULL && (0 -# ifdef EAGAIN - || errno == EAGAIN -# endif -# ifdef EINTR - || errno == EINTR -# endif - )) - { QUIT; continue; } - - if (!dp) break; + if (!dp) + { + if (errno == EAGAIN || errno == EINTR) + { + QUIT; + continue; + } + break; + } len = dirent_namelen (dp); === modified file 'src/fileio.c' --- src/fileio.c 2012-11-21 21:06:52 +0000 +++ src/fileio.c 2012-11-23 08:56:17 +0000 @@ -1995,10 +1995,8 @@ { if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode))) { -#if defined (EISDIR) /* Get a better looking error message. */ errno = EISDIR; -#endif /* EISDIR */ report_file_error ("Non-regular file", Fcons (file, Qnil)); } } === modified file 'src/gmalloc.c' --- src/gmalloc.c 2012-10-01 06:36:54 +0000 +++ src/gmalloc.c 2012-11-23 08:56:17 +0000 @@ -1645,14 +1645,6 @@ return result; } -#ifndef ENOMEM -#define ENOMEM 12 -#endif - -#ifndef EINVAL -#define EINVAL 22 -#endif - int posix_memalign (void **memptr, size_t alignment, size_t size) { === modified file 'src/gnutls.c' --- src/gnutls.c 2012-09-23 19:36:31 +0000 +++ src/gnutls.c 2012-11-23 08:56:17 +0000 @@ -359,12 +359,7 @@ if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { -#ifdef EWOULDBLOCK - errno = EWOULDBLOCK; -#endif -#ifdef EAGAIN errno = EAGAIN; -#endif return 0; } @@ -384,14 +379,7 @@ appropriately so that send_process retries the correct way instead of erroring out. */ if (rtnval == GNUTLS_E_AGAIN) - { -#ifdef EWOULDBLOCK - errno = EWOULDBLOCK; -#endif -#ifdef EAGAIN - errno = EAGAIN; -#endif - } + errno = EAGAIN; break; } } === modified file 'src/keyboard.c' --- src/keyboard.c 2012-11-17 22:12:47 +0000 +++ src/keyboard.c 2012-11-23 08:56:17 +0000 @@ -6986,10 +6986,7 @@ an EAGAIN error. Does anybody know of a situation where a retry is actually needed? */ #if 0 - nread < 0 && (errno == EAGAIN -#ifdef EFAULT - || errno == EFAULT -#endif + nread < 0 && (errno == EAGAIN || errno == EFAULT #ifdef EBADSLT || errno == EBADSLT #endif === modified file 'src/lread.c' --- src/lread.c 2012-11-20 20:06:17 +0000 +++ src/lread.c 2012-11-23 08:56:17 +0000 @@ -440,7 +440,6 @@ block_input (); c = getc (instream); -#ifdef EINTR /* Interrupted reads have been observed while reading over the network. */ while (c == EOF && ferror (instream) && errno == EINTR) { @@ -450,7 +449,6 @@ clearerr (instream); c = getc (instream); } -#endif unblock_input (); === modified file 'src/process.c' --- src/process.c 2012-11-17 22:12:47 +0000 +++ src/process.c 2012-11-23 08:56:17 +0000 @@ -4432,14 +4432,8 @@ total_nread += nread; got_some_input = 1; } -#ifdef EIO - else if (nread == -1 && EIO == errno) - break; -#endif -#ifdef EAGAIN - else if (nread == -1 && EAGAIN == errno) - break; -#endif + else if (nread == -1 && (errno == EIO || errno == EAGAIN)) + break; #ifdef EWOULDBLOCK else if (nread == -1 && EWOULDBLOCK == errno) break; @@ -5517,13 +5511,10 @@ if (rv < 0) { - if (0 + if (errno == EAGAIN #ifdef EWOULDBLOCK || errno == EWOULDBLOCK #endif -#ifdef EAGAIN - || errno == EAGAIN -#endif ) /* Buffer is full. Wait, accepting input; that may allow the program === modified file 'src/unexcoff.c' --- src/unexcoff.c 2012-09-15 07:06:56 +0000 +++ src/unexcoff.c 2012-11-23 08:56:17 +0000 @@ -332,11 +332,7 @@ a gap between the old text segment and the old data segment. This gap has probably been remapped into part of the text segment. So write zeros for it. */ - if (ret == -1 -#ifdef EFAULT - && errno == EFAULT -#endif - ) + if (ret == -1 && errno == EFAULT) { /* Write only a page of zeros at once, so that we don't overshoot the start