On Sat Feb 17 03:20:14 2024 +0000, Jinoh Kang wrote:
Maybe, but that's very much a "what if". It also makes more sense than
trying to dereference the symlink exactly once. `/proc/.../fd/...` points to the final resolved pathname (unless `O_PATH|O_NOFOLLOW` is specified), so it should be the same as realpath (recursively follow link) in most cases. I don't see a problem here. Again, I'm not here to speculate. Let's just wait for the other thread, shall we?
@iamahuman is this the kind of test you were looking for?
```c #include <windows.h> #include <stdio.h>
int main(int argc, char **argv) { char buf[4096] = {0}; FILE_NAME_INFO *name_info = (FILE_NAME_INFO*)buf;
if (!GetFileInformationByHandleEx(GetStdHandle(STD_OUTPUT_HANDLE), FileNameInfo, name_info, sizeof(buf))) { fprintf(stderr, "GetFileInformationByHandleEx failed %08lx\n", GetLastError()); return 1; }
WriteFile(GetStdHandle(STD_ERROR_HANDLE), name_info->FileName, name_info->FileNameLength, NULL, NULL); return 0; } ``` On Windows: ``` test.exe > C:\Temp\test.txt ``` Output: `\Temp\test.txt`
On wine: ``` wine test.exe > /tmp/wine/testprefix/drive_c/Temp/test.txt ``` Upstream output: `GetFileInformationByHandleEx failed 00000006` With this MR: `\Temp\test.txt` ```