open does not notice EIO in check for tty
Closed / Out of Date219360ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 24 years ago
Descriptionplain2000-10-26 05:11:26
OriginalBugID: 5888 Bug
Version: 8.3.1
SubmitDate: '2000-06-13'
LastModified: '2000-10-25'
Severity: MED
Status: UnAssn
Submitter: techsupp
OS: Linux-SuSE
Machine: celeron 466 128MB idedisk ..2tty
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'
Name:
Uwe Klein
ReproducibleScript:
tty with devicenote entry in dev but no hardware ( most installations have this )
wish
% open /dev/ttyS4 {RDWR}
return: file4
ObservedBehavior:
throught the isatty(fd) call in tclUnixChan.c:1323 tcl determines if it is a tty or not
this returns a 0 for "Inapropriate IOctrl" as well as for EIO
now tcl goes happily on with a file that in its own opinion is not a tty when it
actually has a tty with an error.
DesiredBehavior:
check for EIO, if yes close file, return an error in open!!
Patch:
*** tclUnixChan.c Tue Jun 13 09:49:40 2000
--- tclUnixChan.c.orig Tue Jun 13 09:55:00 2000
***************
*** 1332,1344 ****
translation = "auto crlf";
channelTypePtr = &ttyChannelType;
fsPtr = TtyInit(fd);
- } else if ( errno == EIO ) {
- close(fd);
- if (interp != (Tcl_Interp *) NULL) {
- Tcl_AppendResult(interp, "Error in open \"", fileName, "\": ",
- Tcl_PosixError(interp), (char *) NULL);
- }
- return NULL;
} else
#endif /* SUPPORTS_TTY */
{
--- 1332,1337 ----
PatchFiles:
tclUnixChan.c
dkf Ticket [219360ffff]: 1 change
[History diff]2000-11-13 20:48:17
dgp Ticket [219360ffff]: 1 change
[History diff]2001-04-03 06:19:52
hobbs Ticket [219360ffff]: 1 change
[History diff]2001-04-03 13:41:51
hobbsplain2001-09-13 02:47:39
File Added - 10713: 219360.patch Logged In: YES user_id=72656 The correct patch against core-8-3-1-branch is attached. However, I want to know why open isn't returning -1, as it should, when an error should occur. We shouldn't be able to rely on errno unless open returned -1. I can't check this on Solaris because it doesn't seem to create the bogus /dev entries. Is this really a bug in Linux?
andreas_kupriesplain2001-09-13 02:57:27
Logged In: YES user_id=75003 Note Uwe Klein = <[email protected]>
hobbsplain2001-09-13 05:55:35
Logged In: YES user_id=72656 Attached is a C file which gives more information. The interesting thing to note is that isatty is setting errno, not open (although I see nothing in the man pages about that). OK, RH 6.2 mentions nothing about errno, but other man pages indicate EBADF or ENOTTY can be returned - but not EIO. Why, even on open source OSes, do we have to rely on magic in the OS?
hobbsplain2001-09-13 05:56:11
File Added - 10724: 219360.c Logged In: YES user_id=72656 oops, forgot to attach C file...
hobbsplain2003-02-19 02:34:25
Logged In: YES user_id=72656 I believe this has been corrected in updated tty checking behavior for 8.4.
Log in (anonymous is fine) to add a comment.
Attachments:
- 219360.c [download] added by hobbs on 2001-09-13 05:56:11. [details]
- 219360.patch [download] added by hobbs on 2001-09-13 02:47:39. [details]