D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20585 - std.stdio.File open() failure leaves File in invalid state
Summary: std.stdio.File open() failure leaves File in invalid state
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-02-17 08:24 UTC by Manu
Modified: 2020-02-18 00:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2020-02-17 08:24:32 UTC
Eg:

  File f;
  try
    f.open("doesnt_exist.txt"); //
  catch (Exception e)
  {
    // handle open failure
  }

  assert(f.isOpen == false); // FAIL! f.isOpen == true even though open() failed

  if (f.isOpen)
    f.close(); // CRASH! file is not actually open


This seems like a problem.
Comment 1 Dlang Bot 2020-02-17 15:51:44 UTC
@kubo39 created dlang/phobos pull request #7397 "Fix Issue 20585 - std.stdio.File.open() failure leaves File in invalid" fixing this issue:

- Fix Issue 20585 - std.stdio.File.open() failure leaves File in invalid
  state

https://github.com/dlang/phobos/pull/7397
Comment 2 Dlang Bot 2020-02-18 00:32:18 UTC
dlang/phobos pull request #7397 "Fix Issue 20585 - std.stdio.File.open() failure leaves File in invalid" was merged into stable:

- 902e49bb66071e97c9f413251d2672ce32a05341 by Hiroki Noda:
  Fix Issue 20585 - std.stdio.File.open() failure leaves File in invalid
  state

https://github.com/dlang/phobos/pull/7397