Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-02-19
02:34 • Closed ticket [219360ffff]: open does not notice EIO in check for tty plus 7... artifact: 049c30a312 user: hobbs
2001-09-13
05:56 • Add attachment 219360.c to ticket [219360ffff] artifact: 6eea7be95f user: hobbs
05:56 • Ticket [219360ffff] open does not notice EIO in check for tty status still O... artifact: d338d2c13c user: hobbs
05:55 • Ticket [219360ffff]: 4 changes artifact: eac58b7f1c user: hobbs
02:57 • Ticket [219360ffff]: 4 changes artifact: ddadec00b4 user: andreas_kupries
02:47 • Add attachment 219360.patch to ticket [219360ffff] artifact: 0537c96040 user: hobbs
02:47 • Ticket [219360ffff] open does not notice EIO in check for tty status still O... artifact: ad82480977 user: hobbs
2001-04-03
13:41 • Ticket [219360ffff]: 1 change artifact: 10b5fe7d06 user: hobbs
06:19 • Ticket [219360ffff]: 1 change artifact: bc48664654 user: dgp
2000-11-13
20:48 • Ticket [219360ffff]: 1 change artifact: 10fef2ddd1 user: dkf
2000-10-26
05:11 • New ticket [219360ffff]. artifact: c68c62aee5 user: nobody

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: