Duplicate file extension check in [file executable] on Windows
Closed / Fixed85d1fa7d07de7c86f0dd8165569d5ee5045283dcCreated 6 years agoUpdated 6 years ago
Descriptionplain2021-04-09 19:15:36
This is essentially a minor code cleanup issue. There is no
user-visible error, just a bit of unneeded extra processing time.
NativeIsExec() in win/tclWinFile.c contains the following:
if ((_wcsicmp(path, L"exe") == 0)
|| (_wcsicmp(path, L"com") == 0)
|| (_wcsicmp(path, L"cmd") == 0)
|| (_wcsicmp(path, L"cmd") == 0)
|| (_wcsicmp(path, L"bat") == 0)) {
It unnecessarily checks for a ".cmd" extension twice. Just delete one
of them to correct this.
Note that earlier versions of this function checked for ".ps1"
(Powershell scripts) where the second ".cmd" is now located. The commit
from 2018-03-22 (da169b16 in the repo on GitHub) seems to be the last
one like that. The next commit affecting tclWinFile.c, from 2018-04-30,
(19642193 on GitHub) has two checks for ".cmd", although it is still
using the Microsoft macro _tcsicmp and TEXT macro to allow switching
between Unicode and ASCII. Since versions of Windows descended from
Win95 are no longer supported by Tcl this was later simplified and the
current version simply uses _wcsicmp(). All subsequent versions of
tclWinFile.c have contained this duplicate check for ".cmd".
[Sorry for the Git commit IDs, I have not yet installed fossil on my
system.]
I can't tell whether this might be an edit artefact or a merge
artefact or something else, but in any case the fix is trival.
Referenced by2
e5150f7a36Fix [85d1fa7d07]: Duplicate file extension check in [file executable] on Windows check-in2021-04-15 09:08:232ac66f04deFix [85d1fa7d07]: Duplicate file extension check in [file executable] on Windows. It looks like checking for "ps1" is a mistake. check-in2021-04-15 09:06:13
jan.nijtmanswiki2021-04-15 09:12:37
Fixed in all branches now.
It looks like "ps1" (in Tcl 8.5 only) was a mistake, I just removed it there. Otherwise someone would have filed a bug report for 8.6 already.
Log in (anonymous is fine) to add a comment.