Tcl Source Code

View Ticket
Login
Ticket UUID: 413100
Title: fileevent problem
Type: Bug Version: None
Submitter: lewandowski Created on: 2001-04-02 11:17:36
Subsystem: 02. Event Loops Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-09-14 06:25:51
Resolution: None Closed By: andreas_kupries
    Closed on: 2001-09-13 23:25:51
Description:
Fileevent don't work on transfered (thread::transfer)
socket channel when using setuid extension (from
tclhttpd).
Command after works fine.

I'am using: tclsh8.4a3, libthread2.2, setuid
User Comments: andreas_kupries added on 2001-09-14 04:37:39:
Logged In: YES 
user_id=75003

The location of the 'load libsetuid.so' statement
implies that you try to set the effective user id
for a single thread, right ?

Note that the relevant system call always affects
the whole process, i.e. all threads in it. See the
manpage of 'setuid'.

andreas_kupries added on 2001-09-14 04:27:12:
Logged In: YES 
user_id=75003

How did you compile and link 'setuid' ?

When I do it I get a segfault when loading
the extension into tclsh8.4/cvs.

Also, is 'loading' setuid enough to cause the error ? If 
not, where do I place the 'setuid' call to cause the 
problem ?

andreas_kupries added on 2001-08-07 07:55:02:
Logged In: YES 
user_id=75003

I see a couple of problems in the attached scripts:

proc serverOpen {channel addr Port} {
    
    fileevent $channel readable "NewThread $channel $addr"
    puts $channel "Server OK"
    flush $channel
}

Why is 'NewThread' attached to a 'readable event' ?
A simple [after idle] would be sufficient to move the
transfer out of the sockey-handler.

But more important is the fact that a thread is started, 
some event handlers are setup and then the event loop is 
_not_ entered ! The last command in the script should be a 
[vwait Stop] or similar and not the [proc]. As is the 
thread will setup the eventhandlers first and then delete 
itself, never having the opportunity to fire the events.

lewandowski added on 2001-04-03 14:51:41:
Logged In: YES 
user_id=174470

Please use new version script (4897:script).
I can't delete old (4896:script)

lewandowski added on 2001-04-03 14:43:21:

File Added - 4898: server

lewandowski added on 2001-04-03 14:43:20:
Logged In: YES 
user_id=174470

if use setuid "fileevent" and "after" don't work
if use setuid and disable "fileevent", "after" is fine.

lewandowski added on 2001-04-03 14:34:58:

File Added - 4897: script

lewandowski added on 2001-04-03 14:08:57:

File Added - 4896: script

andreas_kupries added on 2001-04-02 21:41:20:
Logged In: YES 
user_id=75003

I don't understand "Command after works fine". Also, is it
possible to attach a small script which exercises this
problem ?

Attachments: