Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: fb1ca4ff9a736a8eb156f72ad6d658dce408387f04f7868693219be401bdd901
Ticket: 344b1a0c0f0e2fda1e4ad6520cbf5e0af35eb332
exec on Windows broken when '%' is used
User & Date: sebres on 2019-01-15 18:43:49
Changes

  1. icomment:
    Confirmed.
    
    Basically, this is not a bug, but feature (I would say, I'm blame for this) to avoid windows vulnerable handling by (un)escape of the parameters, see [21b0629c81].
    
    Just a bit incompatible feature in exactly this case.
    
    The substitution of system variables using percent-char was nowhere described resp. not documented in the exec-manual (still worse it is unclear in documentation of windows command processor too). Furthermore it could cause unexpected or even vulnerable behavior if calling batch-files, or executable from there.
    
    Possible solutions:<br/>
    - restore backwards-compatibility for call of the command-processor;<br/>
    - special option like --safe or --unsafe to use (or avoid) safe escaping at all;<br/>
    - rewrite the code in sqlite like:
    <pre style="padding-left:10pt">
    <b style="color:red">- return [string map [list \\ /] \
    -            [string trim [exec -- $::env(ComSpec) /c echo %CD%]]]</b>
    <b style="color:green">+ return [file normalize [pwd]]</b>
    </pre>
    Or just remove this workaround completely, because pwd always return normalized path now, so this strange attempt to solve "case-mismatch issues on windows" is not expected anymore.
    
    I'm aware of the certain incompatibility here, and because the fix [21b0629c81] is anyway incomplete (see my last comment there), so I'm all ears for the suggestions or proposals how we could solve this.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"