Ticket UUID: | 219360 | |||
Title: | open does not notice EIO in check for tty | |||
Type: | Bug | Version: | obsolete: 8.3.1 | |
Submitter: | nobody | Created on: | 2000-10-26 05:11:26 | |
Subsystem: | 27. Channel Types | Assigned To: | hobbs | |
Priority: | 4 | Severity: | ||
Status: | Closed | Last Modified: | 2003-02-19 02:34:25 | |
Resolution: | Out of Date | Closed By: | hobbs | |
Closed on: | 2003-02-18 19:34:25 | |||
Description: |
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 | |||
User Comments: |
hobbs added on 2003-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. hobbs added on 2001-09-13 05:56:11: File Added - 10724: 219360.c Logged In: YES user_id=72656 oops, forgot to attach C file... hobbs added on 2001-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? andreas_kupries added on 2001-09-13 02:57:27: Logged In: YES user_id=75003 Note Uwe Klein = <[email protected]> hobbs added on 2001-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? |