Thread overview
[Issue 2689] New: seek behaves incorrectly on MAC OSX
Feb 25, 2009
d-bugmail
Feb 26, 2009
d-bugmail
Mar 30, 2009
d-bugmail
Apr 01, 2009
d-bugmail
February 25, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2689

           Summary: seek behaves incorrectly on MAC OSX
           Product: D
           Version: 1.040
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: swadenator@gmail.com


The following code behaves differently on OSX than LINUX (DMD 1.040):

import std.stdio;
import std.stream;
import std.file;

int Lines(Stream f)
{
  int ln = 0;

  foreach (char[] line; f) ln++;
  return ln;
}

void main(char[][] args)
{
  auto f = new BufferedFile(args[1]);
  int l = Lines(f);
  f.seek(0, SeekPos.Set);
  int r = Lines(f);
  fwritef(stderr, "Lines before: %d, Lines after: %d\n", l, r);
}

Results for OSX:
Lines before: 1633, Lines after: 0

Results for LINUX
Lines before: 1633, Lines after: 1633

Seek not working properly perhaps?

wade


-- 

February 26, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2689





------- Comment #1 from maxmo@pochta.ru  2009-02-26 09:18 -------
lseek signature is wrong for osx.
I wonder, whether POSIX.1 can be extracted according to standard?
http://www.unix.org/version3/online.html


-- 

March 30, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2689





------- Comment #2 from sean@invisibleduck.org  2009-03-30 09:42 -------
Fixed in DMD 2.027.  DMD 1.x still needs to be fixed however, so this ticket can't be closed quite yet.


-- 

April 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2689


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #3 from bugzilla@digitalmars.com  2009-04-01 13:47 -------
Fixed DMD 1.042 and 2.027


--