Skip to content
Tcl Source Code History Of Ticket 4ab2ccc4a26e39e6
Login

History Of Ticket 4ab2ccc4a26e39e6

Artifacts Associated With Ticket 4ab2ccc4a26e39e6

  1. Ticket change [7904c6a78a] (rid 140774) by gerhardr on 2014-12-02 12:24:11:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      #
      # Inconsistency between execution (exec) and exec_ok result
      # Incorrect exec_ok result for CMD files (prob. also other executables)
      # Incorrect error message: no such file or directory on exec
      # 
      catch {console show}
      
      puts "Tcl/Tk [info patchlevel] - TCL bug exec/exec_ok"
      
      foreach ext {BAT CMD TXT} {
        set exepath [file join $env(TEMP) ${ext}_Test]
        puts "\nexepath=$exepath"
      
        set cmdfile $exepath.$ext
        if {! [file exists $cmdfile]} {
          puts "File doesn't exists, creating $cmdfile ..."
          set fd [open $cmdfile {WRONLY TRUNC CREAT}]
          puts $fd "@echo %~dpn0 started successfully... "
          close $fd
        }
      
        set execok [auto_execok $exepath]
        set fileex [file exists $execok]
        puts "execok=$execok, file exists=$fileex"
      
        catch {unset tmp}
        set oserrorcode [catch { set tmp [exec  $execok] } oserrormsg]
        if {[info exists tmp]} {
          puts "cmdfile executed: oserrorcode=$oserrorcode, tmp='$tmp'"
        } else {
          puts "cmdfile executed: oserrorcode=$oserrorcode, tmp not set"
        }
      
        if {[info exists oserrormsg]} {
          puts "oserrormsg='$oserrormsg'"
        }
      }
      
    5. foundin initialized to: "8.6, 8.5"
    6. is_private initialized to: "0"
    7. login: "gerhardr"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "9b076687903aba8f5254d84cbc9577f25d0fbe8c"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "gerhardr"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to: "auto_exec and exec inconsistent in Windows"
    16. type initialized to: "Bug"
  2. Ticket change [c9bc3ab1ef] (rid 140776) by gerhardr on 2014-12-02 14:52:29:

    1. icomment:
      Tcl/Tk 8.5.15 - TCL bug exec/exec_ok
      
      exepath=C:/TEMP/BAT_Test
      File doesn't exists, creating C:/TEMP/BAT_Test.BAT ...
      execok=C:/TEMP/BAT_Test.BAT, file exists=1
      cmdfile executed: oserrorcode=0, tmp='C:\Temp\BAT_Test started successfully... '
      oserrormsg='C:\Temp\BAT_Test started successfully... '
      
      exepath=C:/TEMP/CMD_Test
      File doesn't exists, creating C:/TEMP/CMD_Test.CMD ...
      execok=C:/TEMP/CMD_Test.CMD, file exists=1
      cmdfile executed: oserrorcode=1, tmp not set
      oserrormsg='couldn't execute "C:\TEMP\CMD_Test.CMD": no such file or directory'
      
      exepath=C:/TEMP/TXT_Test
      File doesn't exists, creating C:/TEMP/TXT_Test.TXT ...
      execok=, file exists=0
      cmdfile executed: oserrorcode=1, tmp not set
      oserrormsg='couldn't execute "": no such file or directory'
      
      === Remarks ===
      Test 1: extension BAT - auto_execok expanding ok, file exists, cmd executed
      Test 2: extension CMD - auto_execok expanding ok, file exists, cmd not executed
      Test 2: extension TXT - auto_execok expanding not ok, further tests fail (ok!)
      
      From the exec manpage: Then, in order, .com, .exe, and .bat are appended ...
      In this case the CMD file must not become expanded by autoexec_ok.
      
      From the auto_execok: Determines whether there is an executable file or shell builtin by the name cmd. If so, it returns a list of arguments to be passed to exec to execute the executable file or shell builtin named by cmd.
      In this case the CMD file must be executable (which is tha case on Windows) and it can also be executed by CMD.exe.
      
      The error message: "... no such file or directory" 
      is definitely not correct as the "file exists" stetes before.
      
      Information: Windows treats all extensions which are shown in the evironment variable PATHEXT as executable (created on some registry entry), e. g.:
      PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
      
    2. login: "gerhardr"
    3. mimetype: "text/plain"
    4. username: "Output of the code"
  3. Ticket change [f89e597e4a] (rid 140777) by gerhardr on 2014-12-02 14:56:43:

    1. login: "gerhardr"
    2. mimetype: "text/plain"
    3. subsystem changed to: "16. Commands A-H"
  4. Ticket change [a3bf9a0c5d] (rid 141148) by dkf on 2014-12-09 09:17:59:

    1. assignee changed to: "dkf"
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. subsystem changed to: "38. Init - Library - Autoload"
  5. Ticket change [ed25b8d518] (rid 141812) by dkf on 2015-05-17 11:22:58:

    1. icomment:
      I'm guessing that the problem is that it needs the native name. (I wonder what searches were actually done, and what the COMSPEC, PATH, WINDIR and PATHEXT environment variables contain.)
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  6. Ticket change [b0d4817bc6] (rid 147755) by apnadkarni on 2016-07-09 15:45:59:

    1. icomment:
      One part of this has been fixed with check-in [2b6ee27091] for 8.6.6. exec now understands .cmd extensions. Other inconsistencies between exec and auto_execok remain.
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [781769f9da] (rid 174955) by anonymous on 2019-09-08 00:49:58:

    1. icomment:
      The "file" command needs help also.
      file executable x.cmd  returns 0
      file executable x.bat  returns 1
      
      In each case the file exists.
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
    4. username: "Tom Turkey"
  8. Ticket change [69f2ae6699] (rid 253648) by apnadkarni on 2026-05-18 10:26:54:

    1. closedate changed to: "2461178.9353579399"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Purportedly fixed for 9.1 in TIP 753 commit [de961e8d](https://core.tcl-lang.org/tcl/info/de961e8dee5470e6).
      
      Aside from some underlying bugs, the original code was incorrect. 
      
      - `exec $execok` is the wrong idiom, should be `exec -- {*}$execok`, 
      - `auto_execok` will not attach .TXT, has to be explicitly specified.
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"