Version 1 of Tk in a set-userid application

Updated 2001-12-03 18:38:08

Purpose: to investigate issues relating to writing set-userid Tk applications.

Here's a simple set-userid application that I'm trying to get to run.

$ cat setuid.tcl

 #!/bin/sh
 # \
 exec tclsh "$0" ${1+"$@"}

 package require Tclx

 set effective [id effective userid]
 puts $effective
 set real [id  userid ]
 puts $real

 id userid $real
 puts "realid = $real  effectiveid = $effective"
 package require Tk

 proc quitApp { args } {
        puts [format "%s" $args]
 }
 set res [wm protocol . WM_DELETE_WINDOW quitApp]

 puts $res


 $ su differentuid
 Password: 
 % chmod 4755 setuid.tcl
 $
 $ /home/lvirden/setuid.tcl

invalid command name "id"

    while executing

"id effective userid"

    invoked from within

"effective id effective userid"

    (file "/dev/fd/4" line 1)

Looking for insights on what might be going on. Without the setuid permissions, the application works okay.