Tcl Source Code

View Ticket
Login
Ticket UUID: 1067708
Title: bad argv handling for fconfigure -ttycontrol
Type: Bug Version: obsolete: 8.4.7
Submitter: nobody Created on: 2004-11-16 23:25:18
Subsystem: 24. Channel Commands Assigned To: andreas_kupries
Priority: 6 Severity:
Status: Closed Last Modified: 2005-10-05 13:34:26
Resolution: Fixed Closed By: hobbs
    Closed on: 2005-10-05 06:34:26
Description:
Tcl 8.4.7, built with threads enabled, crashes when
configuring a serial port on a Linux system. The
following code  reproduces the problem:

> % info patchlevel
> 8.4.7
> % open /dev/ttyS0 {RDWR}
> file7
> % fconfigure file7 -mode "9600,n,8,1"
> % fconfigure file7 -ttycontrol {RTS 1 DTR 1}
> Segmentation fault

The fault appears to be specific to the 'ttycontrol'
option and does not happen on a non-threaded build. The
platform is Slackware Linux 9.1 with GCC 3.2.3 and
glibc 2.3.2. The configure options used to compile Tcl
were "--enable-shared --enable-threads".

George
fr30 at dial dot pipex dot com
User Comments: hobbs added on 2005-10-05 13:34:26:
Logged In: YES 
user_id=72656

properly free argv in 8.4.12 and 8.5a4.

andreas_kupries added on 2004-12-02 05:26:07:
Logged In: YES 
user_id=75003

No, because we still have to fix the memleak on windows.

dgp added on 2004-12-02 05:22:02:
Logged In: YES 
user_id=80530

should this be closed now?

hobbs added on 2004-11-17 09:53:34:
Logged In: YES 
user_id=72656

Fixed this in 8.4.8 and 8.5a2.  Noticed that tclWinChan.c
avoided this by never freeing the argv array!  This moves to
an open bug on win/tclWinChan.c to free that memory
(correctly!).

dgp added on 2004-11-17 07:50:28:
Logged In: YES 
user_id=80530

patch applies to both branches, and
after application the crash is gone in
both branches.

changes look correct too.

hobbs added on 2004-11-17 06:57:49:

File Added - 109035: 1067708.patch

hobbs added on 2004-11-17 06:57:48:
Logged In: YES 
user_id=72656

I believe the following patch is correct for 8.4.8.  Please
verify - may need adjustment for 8.5a2.

Attachments: