Tcl Source Code

View Ticket
Login
Ticket UUID: 500348
Title: fconfigure for serial ports failure
Type: Bug Version: None
Submitter: schroedter Created on: 2002-01-07 11:06:15
Subsystem: 27. Channel Types Assigned To: andreas_kupries
Priority: 6 Severity:
Status: Closed Last Modified: 2002-01-12 03:19:51
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2002-01-11 20:19:51
Description:
Tcl version: Current 8.4 CVS, Windows

There is a bug in the TIP#35 implementation in
SerialSetOptionProc(): It occasionally modifies the 
'value' argument to upper case letters.
The following script demonstrates the problem:

set filename com1
proc openFile {} {
    global filename chan
    set chan [open $filename r+]
    fconfigure $chan -mode 9600,n,8,1    
    fconfigure $chan -handshake none
    fconfigure $chan -buffering none
}
openFile

[fconfigure -handshake none] modifies "none" to "NONE".
The following [fconfigure -handshake buffering none]
reuses the "NONE" value (when byte compiled) and fails.

The attached patch uses lower case comparison instead
of modifying the 'value' argument.

PS: Shouldn't Tcl_DriverSetOptionProc be better 
declared as 
(... const char *optionName, const char *value) ?
User Comments: andreas_kupries added on 2002-01-12 03:19:51:
Logged In: YES 
user_id=75003

Patch here comitted to head. The patches in #438509 are 
owned by Jeff.

schroedter added on 2002-01-10 13:30:22:
Logged In: YES 
user_id=99573

The Unix patches are submitted to patch #438509.

schroedter added on 2002-01-10 13:26:12:

File Deleted - 15613: 



File Added - 15782: tclWinSerial.c.patch

schroedter added on 2002-01-10 13:26:11:
Logged In: YES 
user_id=99573

Okay, here are the new patches:
Win32: using strnicmp()
Unix:   using strncasecmp()

andreas_kupries added on 2002-01-09 23:03:42:
Logged In: YES 
user_id=75003

I believe "strcasecmp" and "strncasecmp" are available for 
all the major unices. There are implementations in 
the 'compat' directory which are used if 'configure' does 
not find these functions. Maybe even for Win*.

schroedter added on 2002-01-09 13:46:06:
Logged In: YES 
user_id=99573

For Windows there is a strnicmp() function which could be 
used instead of strCaseEqu().
I see strncasecmp() in the tclPlatStubs API only for 
MAC_TCL.

I need the same for the Unix implementation of TIP#35.
Can I rely on strncasecmp() for all Unix*es ? 
My Linux manual says it's BSD 4.4.

andreas_kupries added on 2002-01-08 04:43:14:
Logged In: YES 
user_id=75003

The definition of 'strCaseEqu' is not required. The C-
library provides 'strcasecmp' (or equivalent). This 
functionis in the stubs API and thus available, along 
with 'strncasecmp'.

andreas_kupries added on 2002-01-08 04:17:23:
Logged In: YES 
user_id=75003

Regarding the post-skriptum I believe that TIP #27 may 
apply. Please check with Kevin Kenny (kennykb) and Donald 
Porter (dgp).

schroedter added on 2002-01-07 18:06:16:

File Added - 15613: tclWinSerial.c.patch

Attachments: