Bug 17962 – dirEntries now truncates Unicode file names

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-11-03T04:46:18Z
Last change time
2018-12-12T11:11:18Z
Assigned to
No Owner
Creator
Jonathan M Davis

Comments

Comment #0 by issues.dlang — 2017-11-03T04:46:18Z
Thanks to https://github.com/dlang/phobos/pull/5758 (which I _think_ is just on master and didn't make it into 2.077), std.file.dirEntries can no longer handle Unicode file names. It now incorrectly combines countUntil with slicing a string, and Unicode names get truncated. For instance, if you do something like foreach(de; dirEntries("foo", SpanMode.shallow)) { if(de.isDir) { } } and the directory foo contains a file name with Unicode characters, then isDir will throw a FileException, because de.name does not actually exist (since the file's name was truncated).
Comment #1 by issues.dlang — 2017-11-03T04:56:13Z
Comment #2 by dlang-bugzilla — 2017-11-04T16:53:33Z
Heh. I predicted bugs like this would eventually happen years ago during the big autodecoding debates. Auto-decoding must die.
Comment #3 by github-bugzilla — 2017-11-07T14:50:23Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/fc86ca916e7cff5f98a30fc59a71ebedf1707c61 Fix issue 17962: dirEntries is truncating Unicode file names. https://github.com/dlang/phobos/commit/8f9813efd86bd3cddb323f511ae71d1ee03d0207 Merge pull request #5838 from jmdavis/direntry_unicode Fix issue 17962: dirEntries is truncating Unicode file names. merged-on-behalf-of: Steven Schveighoffer <[email protected]>
Comment #4 by github-bugzilla — 2017-12-18T22:56:26Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/fc86ca916e7cff5f98a30fc59a71ebedf1707c61 Fix issue 17962: dirEntries is truncating Unicode file names. https://github.com/dlang/phobos/commit/8f9813efd86bd3cddb323f511ae71d1ee03d0207 Merge pull request #5838 from jmdavis/direntry_unicode
Comment #5 by edi33416 — 2018-12-12T11:11:18Z
*** Issue 19133 has been marked as a duplicate of this issue. ***