Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7b8a65fc15d86fce89af76263020824b8a00ce53f711bbf0a575297a8ee6cecd
Ticket: f91ab723f3dfbc0d2b720a70a1fa09eebfa1cde5
exec+wish fails to handle windows batch file with arguments and spaces
User & Date: oehhar on 2024-02-26 14:09:08
Changes

  1. icomment:
    Please find two possible branches:
    
    <H1>Adding quotes</H1>
    
    See branch bug-f91ab723f3-quoting starting with commit [0530fbcf2d].
    
    A verbatim " is added around the argument.
    
    This causes the following test failure:
    
    <verbatim>
    ==== winFCmd-3.10 TclpDeleteFile: path is readonly FAILED
    ==== Contents of test case:
    
        createfile tf1
        testchmod 0 tf1
        testfile rm tf1
        file exists tf1
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: EACCES
        while executing
    "testfile rm tf1"
        ("uplevel" body line 4)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: NONE
    ==== winFCmd-3.10 FAILED
    </verbatim>
    
    <H1>Removing cmd.exe</H1>
    
    See branch bug-f91ab723f3-no-cmd starting with commit [bdca8a3971].
    
    The special handling with "cmd.exe /c" of batch files is totally removed.
    
    <H1>Dead Code</H1>
    
    While looking into this, I remarked, that the following stubs-function returns a constant value:
    
    <verbatim>
    int
    TclWinGetPlatformId(void)
    {
        return VER_PLATFORM_WIN32_NT;
    }
    </verbatim>
    
    Thus, the else branch in win/tclWinPipe.c line 1092
    <verbatim>
        if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
            ....
       } else {
           if (HasConsole()) {
               createFlags = 0;
           } else {
               createFlags = DETACHED_PROCESS;
           }
    
           if (applType == APPL_DOS) {
               Tcl_SetObjResult(interp, Tcl_NewStringObj(
                       "DOS application process not supported on this platform",
                       -1));
               Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "DOS_APP",
                       NULL);
               goto end;
           }
       }
    </verbatim>
    can never be reached.
    
    This part is removed with commit [69a34921d1] in branch bug-f91ab723-dead-code-removal.
    Unfortunately, I always get a lot of test failures I am not able to explain (see below).
    
    <H1>Test failures</H1>
    
    I ran tests in all 3 branches plus core-8-6-branch.
    I always get the following test failures.
    
    This is quite annoying, as the current 8.6.14rc1 has no test failures.
    
    <verbatim>
    ==== fCmd-9.3 file rename: comprehensive: file to new name FAILED
    ==== Contents of test case:
    
        createfile tf1
        createfile tf2
        testchmod 0o444 tf2
        file rename tf1 tf3
        file rename tf2 tf4
        list [lsort [glob tf*]] [file writable tf3] [file writable tf4]
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: error renaming "tf2" to "tf4": permission denied
        while executing
    "file rename tf2 tf4"
        ("uplevel" body line 6)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: POSIX EACCES {permission denied}
    ==== fCmd-9.3 FAILED
    
    
    
    ==== fCmd-9.5 file rename: comprehensive: file to self FAILED
    ==== Contents of test case:
    
        createfile tf1 tf1
        createfile tf2 tf2
        testchmod 0o444 tf2
        file rename -force tf1 tf1
        file rename -force tf2 tf2
        list [contents tf1] [contents tf2] [file writable tf1] [file writable tf2]
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: error renaming "tf2": permission denied
        while executing
    "file rename -force tf2 tf2"
        ("uplevel" body line 6)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: POSIX EACCES {permission denied}
    ==== fCmd-9.5 FAILED
    
    
    
    ==== fCmd-9.7 file rename: comprehensive: file to existing file FAILED
    ==== Contents of test case:
    
        createfile tf1
        createfile tf2
        createfile tfs1
        createfile tfs2
        createfile tfs3
        createfile tfs4
        createfile tfd1
        createfile tfd2
        createfile tfd3
        createfile tfd4
        testchmod 0o444 tfs3
        testchmod 0o444 tfs4
        testchmod 0o444 tfd2
        testchmod 0o444 tfd4
        set msg [list [catch {file rename tf1 tf2} msg] $msg]
        file rename -force tfs1 tfd1
        file rename -force tfs2 tfd2
        file rename -force tfs3 tfd3
        file rename -force tfs4 tfd4
        list [lsort [glob tf*]] $msg [file writable tfd1] [file writable tfd2] [file writable tfd3] [file writable tfd4]
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: error renaming "tfs2" to "tfd2": permission denied
        while executing
    "file rename -force tfs2 tfd2"
        ("uplevel" body line 18)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: POSIX EACCES {permission denied}
    ==== fCmd-9.7 FAILED
    
    ==== fCmd-9.10 file rename: comprehensive: file to new name and dir FAILED
    ==== Contents of test case:
    
        createfile tf1
        createfile tf2
        file mkdir td1
        testchmod 0o444 tf2
        file rename tf1 [file join td1 tf3]
        file rename tf2 [file join td1 tf4]
        list [catch {glob tf*}] [lsort [glob -directory td1 t*]]  [file writable [file join td1 tf3]] [file writable [file join td1 tf4]]
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: error renaming "tf2" to "td1/tf4": permission denied
        while executing
    "file rename tf2 [file join td1 tf4]"
        ("uplevel" body line 7)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: POSIX EACCES {permission denied}
    ==== fCmd-9.10 FAILED
    
    ==== winFCmd-3.10 TclpDeleteFile: path is readonly FAILED
    ==== Contents of test case:
    
        createfile tf1
        testchmod 0 tf1
        testfile rm tf1
        file exists tf1
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: EACCES
        while executing
    "testfile rm tf1"
        ("uplevel" body line 4)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: NONE
    ==== winFCmd-3.10 FAILED
    
    </verbatim>
    
    <H1>Questions</H1>
    
    May I ask for an opinion what is wise?
    Those are the actions of a person with no experience here.
    May someone double-check the removal of the dead code?
    
    Thank you all and take care,
    Harald
    
  2. login: "oehhar"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "oehhar"