0

I'm trying to put core dumps in home directory but for whatever reason a core pattern starting with ~ does not work while using full path works just fine. Can't seem to find this rule in docs.

Not working, no core dumps generated:

sysctl -w kernel.core_pattern=~/.coredump/%E.%t.core

Working, core dumps generated:

sysctl -w kernel.core_pattern=/home/$USER/.coredump/%E.%t.core

How come the lines works differently? Is it just my machine?

Andreas
  • 113
  • 3

1 Answers1

1

In the first command the substitution of the ~ isn't done. If you will check later the value of this sysctl variable, you'll see that. The path should be absolute.

The ~ is a shell feature. And not every shell implements it. Better use the $HOME environment variable defined by POSIX.

Anton Danilov
  • 5,082
  • 2
  • 13
  • 23
  • 1
    That is my conclusion too - no substitution performed. However there is no mention of this behavior in any docs I know of that `~` shouldn't be substituted, which makes me wonder if it's a bug or (more likely) by-design according to docs I don't know about. To me `~` is as fundamental as it gets, and I would assume it's substituted on creating the core dump file. – Andreas Sep 03 '19 at 14:36
  • To get yourself familiar with fundamental things, you're talking about, you need to study them. `~` is _SHELL_'s notation. – poige Sep 03 '19 at 14:43
  • 1
    @Andreas It's not a bug. And `~` is not really fundamental. It's a shell feature, and only in some shells, not a fundamental feature of the OS. – Michael Hampton Sep 03 '19 at 15:50
  • @MichaelHampton thanks, didn't realize "it's a shell feature". – Andreas Sep 04 '19 at 07:00