Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

std::ifstream::failure doesn't report system error codes #40038

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR41068
Status NEW
Importance P normal
Reported by Yuri (yuri@tsoft.com)
Reported on 2019-03-14 08:24:24 -0700
Last modified on 2020-04-07 21:10:54 -0700
Version 8.0
Hardware PC FreeBSD
CC fwage73@gmail.com, llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
Fixed by commit(s)
Attachments io.cpp (308 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 21596
test.cpp

On FreeBSD the attached testcase triggers the errno=2 (No such file or
directory):
>  71779 io       CALL
open(0x4065e0,0x601<O_WRONLY|O_CREAT|O_TRUNC>,0666<S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH>)
>  71779 io       NAMI  "a/b"
>  71779 io       RET   open -1 errno 2 No such file or directory

But the error message printed through the exception std::ifstream::failure
doesn't contain this information:
> ios_base::clear: unspecified iostream_category error

Why is it "unspecified"?

It should say exactly what happened.

FreeBSD 11.2.
Quuxplusone commented 5 years ago

Attached io.cpp (308 bytes, text/x-c++src): test.cpp