bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dangling errno in _nc_access (ncurses-4.3/ncurses/tinfo/access.c)


From: Toomas Rosin
Subject: dangling errno in _nc_access (ncurses-4.3/ncurses/tinfo/access.c)
Date: Fri, 14 Feb 2003 04:14:58 +0200 (EET)

Ladies and gentlemen,

My program uses the Readline library, which uses ncurses.  When
debugging it, I was very surprised to find that the first (and
successful) call to readline() set errno to ENOENT.  At the point
where errno changed, the stack trace looked like this:

#0  0x40182155 in access () from /lib/libc.so.6
#1  0x4008e4eb in _nc_access () from /lib/libncurses.so.5
#2  0x4009be49 in _nc_read_entry () from /lib/libncurses.so.5
#3  0x400958ca in setupterm () from /lib/libncurses.so.5
#4  0x40095cb9 in tgetent () from /lib/libncurses.so.5
#5  0x4005de99 in _rl_init_terminal_io () from /lib/libreadline.so.4
#6  0x4004bdbb in readline_initialize_everything () from /lib/libreadline.so.4
#7  0x4004bd25 in rl_initialize () from /lib/libreadline.so.4
#8  0x4004b2a2 in readline () from /lib/libreadline.so.4
...

strace reveals:
...
[pid  8717] access("/home/toomas/.terminfo/l/linux", R_OK) = -1 ENOENT (No such 
file or directory)
[pid  8717] access("/usr/share/terminfo/l/linux", R_OK) = 0
[pid  8717] open("/usr/share/terminfo/l/linux", O_RDONLY) = 3
[pid  8717] read(3, "\32\1\24\0\35\0\20\0}\1\324\2", 12) = 12
[pid  8717] read(3, "linux|linux console\0", 20) = 20
...

I.e. the ENOENT was a result of not finding a terminfo entry for $TERM
under $HOME/.terminfo.  As the entry was happily found in the system
terminfo database, and as nothing in ncurses seems to use the errno
value that was set in _nc_access, should _nc_access (or setupterm, or
tgetent) not reset errno to zero?

Peace,
Toomas.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]