Bug #50877 Windows version of my_dir() does not set the MY_S_IFREG bit for regular files
Submitted: 3 Feb 2010 12:13 Modified: 8 Jul 2010 7:26
Reporter: Bjørn Munch Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1+ OS:Microsoft Windows
Assigned to: CPU Architecture:Any
Triage: Triaged: D3 (Medium)

[3 Feb 2010 12:13] Bjørn Munch
Description:
After calling my_dir() to get info on the files in a directory, I try to check if it's not a regular file:

  if (!MY_S_ISREG(file->mystat->st_mode))

This does not work on Windows (this negative test is always true), and I can see from the Win version of the code that it doesn't set the MY_S_IFREG bit.

I needed this for the Windows port of the fix for Bug #39774. A workaround is to instead do:

  if (MY_S_ISDIR(file->mystat->st_mode))

, because the MY_S_IFDIR bit is set. Should be safe enough in this context.

How to repeat:
Get info from a directory that contains regular files using my_dir, then check the mystat->st_mode of each file
[8 Jul 2010 7:26] Sveta Smirnova
Thank you for the report.

Verified as described.