Skip to content

Commit f62e5de

Browse files
committed
Merge fix for [4f0b5767ac]. Exec of App Execution Aliases on Windows
2 parents 4f15fed + 5a9b2f0 commit f62e5de

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

tests/exec.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ source [file join [file dirname [info script]] tcltests.tcl]
2323
# Some skips when running in a macOS CI environment
2424
testConstraint noosxCI [expr {![info exists ::env(MAC_CI)]}]
2525

26+
# Need a App Exec Alias for testing exec of reparse points
27+
if {[info exists ::env(LOCALAPPDATA)] &&
28+
[file exists [file join $::env(LOCALAPPDATA) "Microsoft" "WindowsApps" "winget.exe"]]} {
29+
testConstraint haveWinget 1
30+
}
31+
2632
unset -nocomplain path
2733

2834
# Utilities that are like Bourne shell stalwarts, but cross-platform.
@@ -706,6 +712,11 @@ test exec-20.1 {exec .CMD file} -constraints {win} -body {
706712
exec [makeFile "echo %1> $log" exec201.CMD] "Testing exec-20.1"
707713
viewFile $log
708714
} -result "\"Testing exec-20.1\""
715+
716+
test exec-bug-4f0b5767ac {exec App Execution Alias} -constraints haveWinget -body {
717+
exec winget --info
718+
} -result "Windows Package Manager*" -match glob
719+
709720

710721
# ----------------------------------------------------------------------
711722
# cleanup

tools/tcltk-man2html.tcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,9 @@ try {
760760
break
761761
}
762762
}
763+
} on error {} {
764+
puts "package folder without package ignored: $dir"
765+
continue
763766
} finally {
764767
catch {close $f; unset f}
765768
}

win/tclWinPipe.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,11 +1323,22 @@ ApplicationType(
13231323

13241324
hFile = CreateFileW(nativeFullPath,
13251325
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
1326-
FILE_ATTRIBUTE_NORMAL, NULL);
1326+
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OPEN_REPARSE_POINT, NULL);
13271327
if (hFile == INVALID_HANDLE_VALUE) {
13281328
continue;
13291329
}
13301330

1331+
if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
1332+
/*
1333+
* But [4f0b5767ac]. Likely a App Execution Alias. This can only
1334+
* be a Win32 APP. Attempt to ReadFile below will fail. We assume
1335+
* that if it is on the PATH, and it is a reparse point, it is an
1336+
* App Execution Alias.
1337+
*/
1338+
applType = APPL_WIN32;
1339+
break;
1340+
}
1341+
13311342
header.e_magic = 0;
13321343
ReadFile(hFile, (void *) &header, sizeof(header), &read, NULL);
13331344
if (header.e_magic != IMAGE_DOS_SIGNATURE) {

0 commit comments

Comments
 (0)