Git Product home page Git Product logo

Comments (6)

orangeduck avatar orangeduck commented on July 18, 2024

Hey, could you try making this change to File_Close in File+.c:

void File_Close(var self) {
  FileData* fd = cast(self, File);
  fclose(fd->f);
  fd->f = NULL;
}

And see if it fixes it.

Thanks.

from cello.

codefriend avatar codefriend commented on July 18, 2024

It didn't help - the same result.

from cello.

orangeduck avatar orangeduck commented on July 18, 2024

Perhaps you could also try this change to File_Delete in File+.c

var File_Delete(var self) {
  FileData* fd = cast(self, File);
  if (fd->f != NULL and tell(self) != -1) { close(self); }
  return self;
}

If that still doesn't work I'll wait till I can get to a Ubuntu machine and recreate the result.

from cello.

codefriend avatar codefriend commented on July 18, 2024

It helps from this one. But now we've got new SIGSEGV:

(gdb) where
#0  0x00007ffff7806475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff78096f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff784032b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff7849b76 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff784cbe3 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00007ffff784e990 in malloc () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007ffff783b40b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x00000000004036f5 in File_Open (self=0x7fffffffe110, filename=0x4255b7 "test.txt", access=0x42400c "w") at src/File+.c:39
#8  0x00000000004084b1 in open (self=0x7fffffffe110, name=0x4255b7 "test.txt", access=0x42400c "w") at src/Prelude+.c:354
#9  0x000000000041ddaa in test_file_read () at tests/data.c:1359
#10 0x0000000000420ee4 in pt_run () at tests/ptest.c:225
#11 0x00000000004212fa in main (argc=1, argv=0x7fffffffe688) at tests/test.c:14


Previous one:
---------------------------
(gdb) where
#0  0x00007ffff7806475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff78096f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff784032b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff7849b76 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff784e8ac in free () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00007ffff783aacd in fclose () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00000000004037b8 in File_Close (self=0x8e7eb0) at src/File+.c:51
#7  0x0000000000408518 in close (self=0x8e7eb0) at src/Prelude+.c:360
#8  0x00000000004035f5 in File_Delete (self=0x8e7eb0) at src/File+.c:26
#9  0x0000000000406f48 in delete (self=0x8e7eb0) at src/Prelude+.c:82
#10 0x000000000041dd4c in test_file_create () at tests/data.c:1347
#11 0x0000000000420ec8 in pt_run () at tests/ptest.c:225
#12 0x00000000004212de in main (argc=1, argv=0x7fffffffe698) at tests/test.c:14

from cello.

rrichardson avatar rrichardson commented on July 18, 2024

It is now dying in test_file_read, but that doesn't mean it's still not due to corruption from the deletes in test_file_create. I'm on fedora 16 and gcc 4.7.2. Inspecting with GDB.

from cello.

orangeduck avatar orangeduck commented on July 18, 2024

Had a bit of an inspection and I think Assignment and Copying are just too messy in implementation for File objects. Unless someone has a need for them later this can be considered a fix for now.

from cello.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.