为什么我的核心文件没有被覆盖? [英] Why is my core file not overwritten?

查看:157
本文介绍了为什么我的核心文件没有被覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu 12.04上,打开一个新的文本文件并写入:

  #include  

int main()
{
abort();
返回0;
}

现在执行:

  g ++ yourfile.cpp 

然后运行可执行文件,将核心转储:

  ./ a.out 

现在检查文件的mtime:

  -rw-r-- --- 1 xxxxx xxxxx 228K 2012-10-01 19:20:20.752136399 -0500 core 

现在再次运行可执行文件:

  ./ a.out 

现在再次检查mtime:

  -rw-r --- -  1 xxxxx xxxxx 228K 2012-10-01 19:20:20.752136399 -0500核心

这是相同!为什么新鲜的核心不会覆盖旧的核心?重建时会导致gdb抱怨核心比可执行文件旧。



为了确保它不是一个许可问题,我在一个新的目录中/ tmp并运行 chmod -R 777 ** / * 里面。运行可执行文件两次仍然没有产生新的内核O_o此外, ulimit -c 报告800000000,对于这个尺寸的内核来说足够绰绰。



我也尝试使用 env - bash --noprofile --norc 运行一个干净的bash,并且仍然运行二进制文件不更新mtime除非我先删除它。

解决方案

如果您引用 https://bugs.launchpad.net/ubuntu/+source/apport/+bug/160999 这是一个bug Ubuntu使用 O_EXCL 打开文件,防止它覆盖现有的核心。


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.

这篇关于为什么我的核心文件没有被覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆