SQLite Forum

windows: tester.tcl question
Login

windows: tester.tcl question

(1) By 0xjnml on 2021-01-16 16:31:43 [link]

Hi there.

There's a transpiler-produced port of SQLite for Go - as some of you may have
already noticed. The maintainer of the Windows target [posted at the issue tracker](https://gitlab.com/cznic/sqlite/-/issues/23#note_487024610) a proposed fix for `proc get_pwd`, which seems to work for him.

I'm no Tcl expert. Can someone more familiar with the tester.tcl code please
take a look and provide some insight? In particular it would be good to know if
we're doing something wrong or if it might be an upstream bug.

Thanks in advance.

-j

(2) By Richard Hipp (drh) on 2021-01-16 17:56:45 in reply to 1 [link]

I did look into this.  But I didn't understand the problem.  tester.tcl seems
to work fine on every machine we run it on here.  I don't know why it is not
working on the Go port.  And the description did not help me to understand,
sadly.

(3) By 0xjnml on 2021-01-16 18:53:17 in reply to 2 [link]

`tester.tcl` works fine on all *nix targets for us. The problem manifests only on Windows.

> tester.tcl seems to work fine on every machine we run it on here.

No disrespect intended, but may I ask if there are also Windows machines in "every machine"?

I presume they are and that would imply there's something to fix on Go side. I'm just trying to clarify this so we know which area to look into before digging into it more.

Thank you for your kind cooperation!

(4) By 0xjnml on 2021-01-18 13:56:43 in reply to 2 [link]

The Windows port maintainer did a test with Tcl binary on Windows and [reported the observations](https://gitlab.com/cznic/sqlite/-/issues/23#note_487099104):

```
%  string trim [exec -- $::env(ComSpec) /c %CD% ]
'"%"CD"%"' is not recognized as an internal or external command, operable program or batch file.
%
```

It seems to me like a bug in Tcl per se.

We fixed out local copy of `tester.tcl` [here](https://gitlab.com/cznic/sqlite/-/commit/aabaed09c7fb138a18e1e05ea545e767e52649b9) and it appears to work for us.

I'm aware of at least two places in SQLite repository that use the same `[exec -- $::env(ComSpec) /c %CD% ]` approach on Windows that may need updating and retesting.

- A recent [patch](https://sqlite.org/src/info/0c8e2ede5c325aa7), fixing danp128's report of a different issue the Go port ran into.

- [Here](https://www.sqlite.org/cgi/src/file?udc=1&ci=tip&name=test%2Ftester.tcl&ln=178) it seems to be used in `tester.tcl` at tip.

(5.1) By Larry Brasfield (LarryBrasfield) on 2021-01-18 20:28:57 edited from 5.0 in reply to 4 [link]

Deleted

(6) By 0xjnml on 2021-01-21 10:48:41 in reply to 5.1

I have sadly missed your reply and it seems to have been meanwhile deleted.

I'd still like to know what's the proper resolution of the issue. In particular, if the bug is in SQLite's `tester.tcl`, Tcl per se, or it is actually us doing something wrong. In the last case we have to fix it.

Thanks in advance for your kind cooperation.

-j

(7) By Larry Brasfield (LarryBrasfield) on 2021-01-21 14:24:21 in reply to 6 [link]

I had suggested just using the shell command, 'pwd', without realizing that it is not a built-in and only works for me because a pwd.exe is locally available.

However, I believe a fine resolution is to replace the offending line with:<code>
   string trim [exec -- $::env(ComSpec) /c CD ]
</code>, which works because the shell normally referred to by the ComSpec environment variable interprets a bare 'CD' command by outputting the current working directory. (IOW: delete the two '%' characters.)

(9) By 0xjnml on 2021-01-21 14:43:17 in reply to 7 [link]

Thanks for the suggestion. It's what we [tried to do]( https://gitlab.com/cznic/sqlite/-/commit/c1357b87cd03e78ba1b4d395a28896ccc4a9d117) and it seems to work for us.

-j

(8) By Richard Hipp (drh) on 2021-01-21 14:31:21 in reply to 1 [link]

Please try SQLite check-in [fe1979552f43e052](src:/info/fe1979552f43e052)
or later ([2021-01-18](src:/timeline?c=fe1979552f43e052)) and let us know
whether or not the changes Joe implemented resolve your issue.

(10) By 0xjnml on 2021-01-21 14:46:28 in reply to 8 [link]

Thank you very much!

I'll report back the outcome here in a few days. The Windows port maintainer is located in a different time zone, our communications are slowed down a bit because of that.

-j