-
-
Notifications
You must be signed in to change notification settings - Fork 741
Add note about Issue 7648 to std.stdio.File
.
#1238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
An apology: I did my best to use |
Two weeks ping. |
If there's an issue with Unicode in File, shouldn't we try to fix the bug? |
As I told, I did my best. 12 years of having silently incorrectly working in some case which are relatively hard to predict in debugging main file IO functionality is inexcusable. The main issue it that we use C runtime which is full of undocumented implementation defined features and even experienced coders often can't do very simple things with C runtime (see Phobos for examples of how one mustn't use C runtime and see druntime for examples of how one must use C runtime). |
Pinging @andralex. |
Circle dependency detected! Andrei doesn't code for Windows and asks others to revise such pulls. |
Yes, I wouldn't have much to comment. On the face of it, if it's a documentation note that makes technical sense, I'm all for it. I'll merge now, please amend as necessary. |
Add note about Issue 7648 to `std.stdio.File`.
I was just worried about basically telling people not to use |
Better then letting them shoot their feet off I guess. |
AFAIK, MSVC doesn't have such issues. So it will work if my (never tested) fix is correct. |
What I believe that means is that we basically need a proper (modern and open-source) run-time for Win32 then. In the long run I think 32-bit Windows systems are here to stay for a few years at least (with Windows on ARM devices if not x86) even if the most of the "market" is going to 64 bit. |
Isn't it better to use e.g. |
You are proposing to make failures even less debugable as it will just fix some random cases where it is possible to represent a UTF8 string via CP_ACP. |
And how is your comment on the function debuggable? And what is the alternative the user should look into if they want to use files? AFAIK |
One have to read documentation about stuff he use. So he will not hit the issue.
Written in the note.
I mean you propose to increase amount of cases the function will work correct by accident. It is unacceptable. If the function is fundamentally broken it must be documented appropriately and not used. |
I proposed we call transcode internally, which (if I'm not mistaken) will throw an exception if a string can't be converted to another encoding. Where's the accident?
Thanks, I didn't notice. Note however that the generated doc line is a bit broken, this is what I'm getting:
It should be fixed, people have been using |
I mean the case passed string is convertible is an accident.
Works for me.
You are welcome!
Doesn't matter.
Being a constant and happy D user, I can tell that it isn't an issue at all in current language state as there are more serious problems (like the fact you program can accidentally become unable to build because of any change or wrong code bugs). |
Using transcode internally will not change this. It will only ensure an exception is thrown if it can't be converted. The real accident is passing a string which isn't converted and ends up being interpreted as something else by the OS, possibly leading to things like opening the wrong file (or worse, deleting a file if the File was opened with the |
Right, but Windows on ARM will not use DMC's runtime. |
Hence what I told above all was:
I know there are some shortcomings with using M$ run-time such as not being able to control how they change it (nor easily update towards newer versions). Even current Win64 version could cause us some grief later on. I'd be crazy enough to suggest basically taking Musl (UTF-8 only smallish and neat C run-time for Linux) and porting the "syscall" part over to WinAPI. And I'd gladly lend a hand anyone trying this ;) |
Issue URL: http://d.puremagic.com/issues/show_bug.cgi?id=7648
IMHO, this note must be added as the issue is unexpected and may result in big troubles for someone.