zsh-workers
 help / color / mirror / code / Atom feed
* bug in zsh/system : `syserror ENOENT` doesn't work
@ 2006-09-08 17:01 arno.
  2006-09-08 17:53 ` Dan Nelson
  0 siblings, 1 reply; 3+ messages in thread
From: arno. @ 2006-09-08 17:01 UTC (permalink / raw)
  To: zsh-workers

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

Hi,

In module, zsh/system, some symbolic names are not recognized, but are 
recognized otherwise by my system (Debian testing)

? zmodload zsh/system                                                                                              
? syserror ENOENT
? echo $?                                                                                           
2                                             

So, I have to refer to them with their number

? syserror E2   
No such file or directory
? syserror 2   
No such file or directory

errnos are defined on my system in /usr/include/asm-generic/errno.h
and that file contains the line :
#include <asm-generic/errno-base.h>

/usr/include/asm-generic/errno-base contains a few (about 30) errnos 
definitions (for example, ENOENT is among them)

At compile time, /usr/include/asm-generic/errno.h is recognized as ERRNO_H
When Src/Modules/errnames1.awk parses it, it outputs errnames only from that file.
If I modify Src/Modules/Makefile by hand 

$(AWK) -f $(sdir)/errnames1.awk /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h >errtmp.c; \

instead of

$(AWK) -f $(sdir)/errnames1.awk /usr/include/asm-generic/errno.h >errtmp.c; \

that works, ENOENT and others are recognized

I don't known awk scripting, but may be it is possible to make 
errnames1.awk recognize include directives and parse also the second 
file ?
Hope that helps

arno

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: bug in zsh/system : `syserror ENOENT` doesn't work
  2006-09-08 17:01 bug in zsh/system : `syserror ENOENT` doesn't work arno.
@ 2006-09-08 17:53 ` Dan Nelson
  2006-09-08 21:50   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nelson @ 2006-09-08 17:53 UTC (permalink / raw)
  To: arno.; +Cc: zsh-workers

In the last episode (Sep 08), arno. said:
> In module, zsh/system, some symbolic names are not recognized, but are 
> recognized otherwise by my system (Debian testing)
> 
> ? zmodload zsh/system                                                                                              
> ? syserror ENOENT
> ? echo $?                                                                                           
> 2                                             
> 
> So, I have to refer to them with their number
> 
> ? syserror E2   
> No such file or directory
> ? syserror 2   
> No such file or directory
> 
> errnos are defined on my system in /usr/include/asm-generic/errno.h
> and that file contains the line :
> #include <asm-generic/errno-base.h>

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.

-- 
	Dan Nelson
	dnelson@allantgroup.com


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

* Re: bug in zsh/system : `syserror ENOENT` doesn't work
  2006-09-08 17:53 ` Dan Nelson
@ 2006-09-08 21:50   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2006-09-08 21:50 UTC (permalink / raw)
  To: zsh-workers

> 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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

end of thread, other threads:[~2006-09-08 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08 17:01 bug in zsh/system : `syserror ENOENT` doesn't work arno.
2006-09-08 17:53 ` Dan Nelson
2006-09-08 21:50   ` Peter Stephenson

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).