After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795153 - W32: g_stat() and GIO fileinfo fail on root directories
W32: g_stat() and GIO fileinfo fail on root directories
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks: 795855
 
 
Reported: 2018-04-11 11:22 UTC by LRN
Modified: 2018-05-12 16:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
W32 gstdio: Don't try to get reparse tag unconditionally (1.95 KB, patch)
2018-04-11 11:22 UTC, LRN
committed Details | Review

Description LRN 2018-04-11 11:22:33 UTC
g_stat() returns -1 when called on paths such as "C:/".
Comment 1 LRN 2018-04-11 11:22:41 UTC
Created attachment 370784 [details] [review]
W32 gstdio: Don't try to get reparse tag unconditionally

We do not need to use FindFirstFileW() to get a reparse tag if the
file that is being examined is not a reparse point.

This is a quick and relatively painless fix for the fact that
FindFirstFileW() fails on root directories. Since root directories
are unlikely to be reparse points (is it even possible?), not using
this function on non-reparse-points just sidesteps the issue.
Comment 2 LRN 2018-04-11 11:24:19 UTC
It might be possible to get reparse point tags for root directories
without using FindFirstFileW() (see _g_win32_readlink_utf16_raw()),
but we'd need to find a root directory that is also a reparse point,
for testing purposes. Otherwise it's impossible to tell whether this
method will work or not. If someone feels adventurous, try calling
DeviceIoControl (<handle>, FSCTL_SET_REPARSE_POINT, ...) on a root
directory of some mounted filesystem you have. But i cannot guarantee that it will continue to function after that. Nor can i say whether the result will actually work as a reparse point (a symlink or a junction).
Comment 3 Ignacio Casal Quinteiro (nacho) 2018-04-11 12:42:48 UTC
Review of attachment 370784 [details] [review]:

Fine for me
Comment 4 LRN 2018-04-11 12:52:24 UTC
Attachment 370784 [details] pushed as 5741f20 - W32 gstdio: Don't try to get reparse tag unconditionally
Comment 5 LRN 2018-04-11 12:54:15 UTC
Should i backport this?
Comment 6 Ignacio Casal Quinteiro (nacho) 2018-04-11 12:55:44 UTC
I'd say yes
Comment 7 LRN 2018-04-11 13:02:25 UTC
Backported to glib-2-56 as commit 96904149e20a04066290bc1592469930c2f57ed0.
Doesn't apply to glib-2-54, as new stat code didn't exist back then.