Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #458 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

File.write does not truncate

Reported by: Gregor Assigned to: kris
Priority: critical Milestone: 0.98 RC 2
Component: IO Version: 0.97 RC1
Keywords: Cc:

Description

This may be a GDC+Tango issue, I haven't tested with DMD.

$ cat test.d
module test;

import tango.io.File;

int main()
{
    (new File("a")).write("abcdefg\n");
    (new File("a")).write("hello");
    return 0;
}

$ dsss build test.d
test.d => test
+ /opt/gdc-tango/bin/rebuild -Idsss_imports/ -I. -S./ -I/opt/gdc-tango/include/d -S/opt/gdc-tango/lib/   -oqdsss_objs  test.d -oftest 

$ ./test
$ cat a
hellofg

Attachments

ticket458.patch (0.7 kB) - added by Gregor on 05/09/07 15:44:07.
Patch to fix truncation issue

Change History

05/09/07 15:32:40 changed by Gregor

  • priority changed from major to critical.
  • milestone set to 0.98 RC 2.

05/09/07 15:34:50 changed by larsivi

  • owner changed from sean to kris.
  • component changed from Core Functionality to IO.

05/09/07 15:40:36 changed by larsivi

write should probably use WriteTruncate? (or similar) instead of ReadWriteCreate??

05/09/07 15:44:07 changed by Gregor

  • attachment ticket458.patch added.

Patch to fix truncation issue

05/09/07 15:44:57 changed by Gregor

I think the difference is in FileConduit? - create on Windows presumably truncates, O_CREAT on Posix does not.

05/09/07 15:53:54 changed by kris

  • status changed from new to closed.
  • resolution set to fixed.

fixed

thx!