[Issue 23392] New: "File does not exist" while the real error is "ENAMETOOLONG (File name too long)"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 6 14:44:40 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23392
Issue ID: 23392
Summary: "File does not exist" while the real error is
"ENAMETOOLONG (File name too long)"
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: kdevel at vogtner.de
```fdne-vs-fntl.d
module file_does_not_exist__vs__file_name_too_long;
import std.stdio;
import std.file;
version (Posix):
string make_long_filename ()
{
immutable char [256] longname = 'X'; // assuming NAME_MAX is 255
return (cast (string) longname).dup ();
}
void main ()
{
auto fsoname = make_long_filename ();
auto de = DirEntry (fsoname);
}
```
$ dmd -g fdne-vs-fntl.d
$ strace -festat,lstat ./fdne-vs-fntl
lstat("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
0x7fffffffd6d8) = -1 ENAMETOOLONG (File name too long)
std.file.FileException at std/file.d(3887):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
File does not exist
----------------
??:? ref @safe std.file.DirEntry std.file.DirEntry.__ctor(immutable(char)[])
[0x4b383d]
./fdne-vs-fntl.d:16 _Dmain [0x4b1130]
The lstat call is performed in existsImpl while DirEntry is constructed. Alas,
errno is not checked.
--
More information about the Digitalmars-d-bugs
mailing list