[Issue 21657] New: MmFile cannot map empty files

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 22 13:37:46 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21657

          Issue ID: 21657
           Summary: MmFile cannot map empty files
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: deadalnix at gmail.com

First, let's create an empty file:

$ touch me

Now let's run the following sample code:

int main(string[]) {
        import std.mmfile;
        scope f = new MmFile("me");
        return 0;
}

It fails with the following error:

std.exception.ErrnoException at std/mmfile.d(351): Could not map file me (Invalid
argument)

Now, let's add some content to our file

$ echo love > me

Running the program again now works as expected.

--


More information about the Digitalmars-d-bugs mailing list