On Ubuntu 12.04, open a new text file and write:
#include <stdlib.h>
int main()
{
abort();
return 0;
}
Now run:
g++ yourfile.cpp
Then run the executable, which will core dump:
./a.out
Now check the mtime of the file:
-rw-r----- 1 xxxxx xxxxx 228K 2012-10-01 19:20:20.752136399 -0500 core
Now run the executable again:
./a.out
Now check the mtime again:
-rw-r----- 1 xxxxx xxxxx 228K 2012-10-01 19:20:20.752136399 -0500 core
It's the same! Why doesn't a fresh core overwrite the old one? When rebuilding this causes gdb to complain the core is older than the executable.
Just to be sure it wasn't a permissioning problem, I tried this in a fresh directory in /tmp and ran chmod -R 777 **/*
inside. Running the executable twice still didn't produce a new core O_o Also, ulimit -c
reports 800000000, more than enough for a core this size.
I also tried running a clean bash with env - bash --noprofile --norc
and still running the binary doesn't update the mtime of the core unless I delete it first.
If you refer to https://bugs.launchpad.net/ubuntu/+source/apport/+bug/160999 this is a bug in Ubuntu using O_EXCL
to open the file, preventing it from overwriting an existing core.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With