On 8/16/23 13:22, Ivan Krylov wrote:
On Wed, 16 Aug 2023 09:42:09 +0200
Tomas Kalibera <tomas.kalib...@gmail.com> wrote:

Fixed in R-devel (84960). Please let me know if you see any problem
with the fix.
Thank you for implementing the fix! I gave 叶月光 the link to the
GitHub Action build of the r84960 installer.
Thanks and thanks for looking at the change.

I'm worried that 叶月光 was seeing FindNextFileA fail for a different
reason (all the examples given at the Capital of Statistics forum
seemed to use less than 256/4 = 64 characters per file name...), but
maybe this won't reappear with the switch to FindNextFileW. If this
keeps happening, it might be worth producing a warning when
FindNextFileW() fails with an unexpected GetLastError() value.

I've added a warning to R-devel when list.files() on Windows stops listing a directory due to an error.

There is probably not more we can do unless there is a revised bug report of the original problem.

fs::dir_fs() uses NtQueryDirectoryFile() and WideCharToMultiByte()
instead of FindNextFileW() and wcstombs(), but maybe this shouldn't
matter. In particular, both list.files() and fs::dir_fs() would fail
given a file name that cannot be represented in UTF-8 (invalid UTF-16
surrogate pairs?)

Right, R only support file names that are valid strings, this assumption is present at many places in the code, so it is fine/consistent to be here as well. The choice of opendir/readdir in R was probably motivated by minimization of platform-specific code.

Best
Tomas

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to