Some additional notes:

if I launch b2.exe from a shortcut, it works properly. If I launch it form a CMD console it doesn't. In both cases the process binary image and the environment variables are identical (seen with SysInternals Process Explorer). The only difference that I could see with SysInternals Process Monitor is in the call stack for builtin_glob. When the sub-call to file_query()->file_info() returns found=true, the end result is correct. On the other hand, when file_query()->file_info() returns found=false, a recursive call to file_query()->file_query() starts, canonicWindowsPath is never called, and the final result is wrong.

Why in one case does file_query()->file_info() returns true, while in the other it returns false? What could be the difference in launching b2.exe from a shortcut and by typing b2.exe in a CMD console, that could make the program execution diverge at this point?

GOOD call stack (launched from windows explorer shortcut):

0    fltmgr.sys    fltmgr.sys + 0x2067    0xfffff88000e02067    C:\Windows\system32\drivers\fltmgr.sys
1    fltmgr.sys    fltmgr.sys + 0x3329    0xfffff88000e03329    C:\Windows\system32\drivers\fltmgr.sys
2    fltmgr.sys    fltmgr.sys + 0x16c7    0xfffff88000e016c7    C:\Windows\system32\drivers\fltmgr.sys
3    ntoskrnl.exe    ntoskrnl.exe + 0x35e6fd    0xfffff800033c46fd    C:\Windows\system32\ntoskrnl.exe
4    ntoskrnl.exe    ntoskrnl.exe + 0x74e53    0xfffff800030dae53    C:\Windows\system32\ntoskrnl.exe
5    ntdll.dll    ntdll.dll + 0x5160a    0x778d160a    C:\Windows\System32\ntdll.dll
6    wow64.dll    wow64.dll + 0x166b7    0x754366b7    C:\Windows\System32\wow64.dll
7    wow64.dll    wow64.dll + 0xd03b    0x7542d03b    C:\Windows\System32\wow64.dll
8    wow64cpu.dll    wow64cpu.dll + 0x2776    0x753b2776    C:\Windows\System32\wow64cpu.dll
9    wow64.dll    wow64.dll + 0xd132    0x7542d132    C:\Windows\System32\wow64.dll
10    wow64.dll    wow64.dll + 0xc54b    0x7542c54b    C:\Windows\System32\wow64.dll
11    ntdll.dll    ntdll.dll + 0x44966    0x778c4966    C:\Windows\System32\ntdll.dll
12    ntdll.dll    ntdll.dll + 0x41937    0x778c1937    C:\Windows\System32\ntdll.dll
13    ntdll.dll    ntdll.dll + 0x2c34e    0x778ac34e    C:\Windows\System32\ntdll.dll
14    ntdll.dll    ntdll.dll + 0x1fdaa    0x77a7fdaa    C:\Windows\SysWOW64\ntdll.dll
15    KernelBase.dll    KernelBase.dll + 0x1a8e5    0x771fa8e5    C:\Windows\SysWOW64\KernelBase.dll
16    KernelBase.dll    KernelBase.dll + 0x1aaf7    0x771faaf7    C:\Windows\SysWOW64\KernelBase.dll
17    b2.exe    canonicWindowsPath + 0x2ae, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\pathnt.c(166)    0x42d8be    C:\MinGW\bin\b2.exe
18    b2.exe    canonicWindowsPath + 0x19a, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\pathnt.c(139)    0x42d7aa    C:\MinGW\bin\b2.exe
19    b2.exe    path_key + 0x113, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\pathnt.c(250)    0x42d573    C:\MinGW\bin\b2.exe
20    b2.exe    path_as_key + 0xe, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\pathnt.c(281)    0x42d9ae    C:\MinGW\bin\b2.exe
21    b2.exe    file_info + 0xf, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(127)    0x421c1f    C:\MinGW\bin\b2.exe
22    b2.exe    file_query + 0x13, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(179)    0x421d23    C:\MinGW\bin\b2.exe
23    b2.exe    file_dirscan_impl + 0xf, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(267)    0x421eaf    C:\MinGW\bin\b2.exe
24    b2.exe    file_dirscan + 0x2d, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(97)    0x421bbd    C:\MinGW\bin\b2.exe
25    b2.exe    builtin_glob + 0x9b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\builtins.c(725)    0x42335b    C:\MinGW\bin\b2.exe
26    b2.exe    function_run + 0x6e, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(3673)    0x4086ce    C:\MinGW\bin\b2.exe
27    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
28    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
29    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
30    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
31    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
32    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
33    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
34    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
35    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
36    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
37    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
38    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
39    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
40    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
41    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
42    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
43    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
44    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
45    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
46    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
47    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
48    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
49    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
50    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
51    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
52    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
53    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
54    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
55    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
56    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
57    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
58    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
59    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
60    b2.exe    main + 0x80c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\jam.c(502)    0x411bbc    C:\MinGW\bin\b2.exe
61    b2.exe    __tmainCRTStartup + 0xfb, f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c(265)    0x43777b    C:\MinGW\bin\b2.exe
62    kernel32.dll    kernel32.dll + 0x1336a    0x76a5336a    C:\Windows\SysWOW64\kernel32.dll
63    ntdll.dll    ntdll.dll + 0x39f72    0x77a99f72    C:\Windows\SysWOW64\ntdll.dll
64    ntdll.dll    ntdll.dll + 0x39f45    0x77a99f45    C:\Windows\SysWOW64\ntdll.dll


BAD call stack (launched from CMD console):

0    fltmgr.sys    fltmgr.sys + 0x2067    0xfffff88000e02067    C:\Windows\system32\drivers\fltmgr.sys
1    fltmgr.sys    fltmgr.sys + 0x3329    0xfffff88000e03329    C:\Windows\system32\drivers\fltmgr.sys
2    fltmgr.sys    fltmgr.sys + 0x16c7    0xfffff88000e016c7    C:\Windows\system32\drivers\fltmgr.sys
3    ntoskrnl.exe    ntoskrnl.exe + 0x35e6fd    0xfffff800033c46fd    C:\Windows\system32\ntoskrnl.exe
4    ntoskrnl.exe    ntoskrnl.exe + 0x74e53    0xfffff800030dae53    C:\Windows\system32\ntoskrnl.exe
5    ntdll.dll    ntdll.dll + 0x5160a    0x778d160a    C:\Windows\System32\ntdll.dll
6    wow64.dll    wow64.dll + 0x166b7    0x754366b7    C:\Windows\System32\wow64.dll
7    wow64.dll    wow64.dll + 0xd03b    0x7542d03b    C:\Windows\System32\wow64.dll
8    wow64cpu.dll    wow64cpu.dll + 0x2776    0x753b2776    C:\Windows\System32\wow64cpu.dll
9    wow64.dll    wow64.dll + 0xd132    0x7542d132    C:\Windows\System32\wow64.dll
10    wow64.dll    wow64.dll + 0xc54b    0x7542c54b    C:\Windows\System32\wow64.dll
11    ntdll.dll    ntdll.dll + 0x44966    0x778c4966    C:\Windows\System32\ntdll.dll
12    ntdll.dll    ntdll.dll + 0x41937    0x778c1937    C:\Windows\System32\ntdll.dll
13    ntdll.dll    ntdll.dll + 0x2c34e    0x778ac34e    C:\Windows\System32\ntdll.dll
14    ntdll.dll    ntdll.dll + 0x1fdaa    0x77a7fdaa    C:\Windows\SysWOW64\ntdll.dll
15    KernelBase.dll    KernelBase.dll + 0x1a2d0    0x771fa2d0    C:\Windows\SysWOW64\KernelBase.dll
16    KernelBase.dll    KernelBase.dll + 0x1ac34    0x771fac34    C:\Windows\SysWOW64\KernelBase.dll
17    b2.exe    file_collect_dir_content_ + 0x27b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filent.c(124)    0x42c99b    C:\MinGW\bin\b2.exe
18    b2.exe    file_query_ + 0xf4, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filent.c(285)    0x42cd44    C:\MinGW\bin\b2.exe
19    b2.exe    file_query + 0x28, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(189)    0x421d38    C:\MinGW\bin\b2.exe
20    b2.exe    file_query_ + 0x75, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filent.c(268)    0x42ccc5    C:\MinGW\bin\b2.exe
21    b2.exe    file_query + 0x28, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(189)    0x421d38    C:\MinGW\bin\b2.exe
22    b2.exe    file_dirscan_impl + 0xf, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(267)    0x421eaf    C:\MinGW\bin\b2.exe
23    b2.exe    file_dirscan + 0x2d, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\filesys.c(97)    0x421bbd    C:\MinGW\bin\b2.exe
24    b2.exe    builtin_glob + 0x9b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\builtins.c(725)    0x42335b    C:\MinGW\bin\b2.exe
25    b2.exe    function_run + 0x6e, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(3673)    0x4086ce    C:\MinGW\bin\b2.exe
26    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
27    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
28    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
29    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
30    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
31    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
32    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
33    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
34    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
35    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
36    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
37    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
38    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
39    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
40    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
41    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
42    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
43    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
44    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
45    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
46    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
47    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
48    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
49    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
50    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
51    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
52    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
53    b2.exe    evaluate_rule + 0x36c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\compile.c(187)    0x4021fc    C:\MinGW\bin\b2.exe
54    b2.exe    function_call_rule + 0x1de, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(472)    0x40b16e    C:\MinGW\bin\b2.exe
55    b2.exe    function_run + 0x15f0, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4228)    0x409c50    C:\MinGW\bin\b2.exe
56    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
57    b2.exe    function_run + 0x201b, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\function.c(4441)    0x40a67b    C:\MinGW\bin\b2.exe
58    b2.exe    parse_file + 0x64, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\parse.c(56)    0x419a24    C:\MinGW\bin\b2.exe
59    b2.exe    main + 0x80c, c:\xxxxxx\devenv\boost\boost_1_55_0\tools\build\v2\engine\jam.c(502)    0x411bbc    C:\MinGW\bin\b2.exe
60    b2.exe    __tmainCRTStartup + 0xfb, f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c(265)    0x43777b    C:\MinGW\bin\b2.exe
61    kernel32.dll    kernel32.dll + 0x1336a    0x76a5336a    C:\Windows\SysWOW64\kernel32.dll
62    ntdll.dll    ntdll.dll + 0x39f72    0x77a99f72    C:\Windows\SysWOW64\ntdll.dll
63    ntdll.dll    ntdll.dll + 0x39f45    0x77a99f45    C:\Windows\SysWOW64\ntdll.dll


Regards.




2014-03-22 22:16 GMT+01:00 Jose . <kasty.jose@gmail.com>:
I finally isolated the bug in builtin GLOB. Consider the following example:

# Jamroot file at C:\Jam.
# A dummy text file at C:\AaA\BbB\File.txt

using msvc ;
import path ;

path-constant TOP : . ;
ECHO [ GLOB $(TOP)/../AaA/BbB : * ] ;

We execute:

C:\Jam>  bjam

The output should be:

C:\Jam\..\AaA\BbB\File.txt

but in fact is:

C:\Jam\..\aaa\bbb\File.txt

I think there might be a bug either in:

a) canonicWindowsPath() (pathnt.c). It takes as input a normalized string like c:\\jam\\..\\aaa\\bbb\\file.txt. Notice that folder separator are normalized windows-style (\\), and all characters are lower-case. At some point, it uses FindFirstFileA() and replaces the first part of the path, until "..", with the correct one as read from the filesystem, leaving the rest unchanged: "c:\\Jam\\..\\aaa\\bbb\\File.txt. Funny: the file name is ok, it just leaves the normalization in the subdirs between the ".." and the file name.

b) path_key() (pathnt.c). It normalizes the input string. Surely because that's a pre-requisite for canonicWindowsPath(). The point is: why does canonicWindowsPath() have such a pre-requisite?

I guess any solution will need to fix canonicWindowsPath() anyway, which states itself as "FIXME: work-in-progress". I tried to replace most of its code with a call to Win32 API GetFullPathName() but it didn't work. May someone more experienced have a look?

Regards.