Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug in zsh/system : `syserror ENOENT` doesn't work



> Actually errnos are defined in /usr/include/errno.h . Linux happens to
> #include a maze of twisty headers, each defining some errors along the
> way.  The zsh configure script looks like it starts at errno.h and
> tries find the included header with the most defines in it.  Maybe it
> should just build a list of candidate files and pass them all to
> errnames1.

Right, that's simple and seems to work (I now get ECANCELED, EOWNERDEAD
and ENOTRECOVERABLE).  The only problem I can see is that we might get
some strange names overriding the normal ones (since we don't process
#ifdef's).  We can cross that bridge when we come to it.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.57
diff -u -r1.57 configure.ac
--- configure.ac	17 Aug 2006 15:28:11 -0000	1.57
+++ configure.ac	8 Sep 2006 21:45:59 -0000
@@ -1320,24 +1320,24 @@
   dnl Try to make sure it doesn't get confused by files that don't
   dnl have real error definitions in.  Count definitions to make sure.
   dnl Definitions of error numbers have become more and more general, so
-  dnl pick the file with the most matches, which must be at least 7.
+  dnl make a list of files containing any definitions in and keep them all.
   dnl Careful with cut and paste in the pattern: the square brackets
   dnl must contain a space and a tab.
   nerrs=`test -f $ERRNO_TRY_H && \
   $EGREP '#[ 	]*define[ 	][ 	]*E[0-9A-Z]*[ 	]*(_HURD_ERRNO )?\(?[_A-Z0-9]' $ERRNO_TRY_H | \
   wc -l | sed 's/[ 	]//g'`
-  if test "x$nerrs" != x && test "$nerrs" -ge 7 && test "$nerrs" -gt "$lnerrs"
+  if test "x$nerrs" != x && test "$nerrs" -ge 1 && test "$nerrs" -gt "$lnerrs"
   then
     lnerrs=$nerrs
-    ERRNO_H=$ERRNO_TRY_H
+    ERRNO_H="$ERRNO_H $ERRNO_TRY_H"
   fi
 done
-if test x$ERRNO_H = x; then
+if test x"$ERRNO_H" = x; then
   AC_MSG_ERROR(ERROR MACROS NOT FOUND:  please report to developers)
 fi
-zsh_cv_path_errno_h=$ERRNO_H
+zsh_cv_path_errno_h="$ERRNO_H"
 ])
-ERRNO_H=$zsh_cv_path_errno_h
+ERRNO_H="$zsh_cv_path_errno_h"
 AC_SUBST(ERRNO_H)dnl
 
 dnl -----------------------------------------------------
Index: Src/Modules/system.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/system.mdd,v
retrieving revision 1.2
diff -u -r1.2 system.mdd
--- Src/Modules/system.mdd	14 Feb 2004 18:50:18 -0000	1.2
+++ Src/Modules/system.mdd	8 Sep 2006 21:45:59 -0000
@@ -11,8 +11,9 @@
 headers="errcount.h"
 
 :<<\Make
+# careful: ERRNO_H may contain a list
 errnames.c: errnames1.awk errnames2.awk $(dir_top)/config.h @ERRNO_H@
-	   if [ x@ERRNO_H@ = x ]; then \
+	   if [ x"@ERRNO_H@" = x ]; then \
 		touch errtmp.out; \
 	   else \
 		$(AWK) -f $(sdir)/errnames1.awk @ERRNO_H@ >errtmp.c; \

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author