Search code examples
linuxpipemipscoredump

Core dump to a pipe is failing


Tried this on MIPS platform:

> uname -a
Linux (none) 2.6.29 #2 Mon Jan 14 13:26:04 PST 2013 mips GNU/Linux
> ulimit -c unlimited
> which gzip
/bin/gzip
> echo "|/bin/gzip - > /home/core-%t-%s-%e.gz" > /proc/sys/kernel/core_pattern
> ./fault
hello there
Segmentation fault (core dumped)
> ls /home/core*.gz
ls: /home/core*: No such file or directory

i.e. piping to a program doesn't work. if I specify a file:

> echo "/home/core-%t-%s-%e" > /proc/sys/kernel/core_pattern

then it works. What did I miss?


Solution

  • Perhaps it fail because the kernel doesn't run any shell, but try to execute a program. Try to wrap the gzip invocation with the redirection in a script and use that script.