diff --git a/.gitignore b/.gitignore index 59c9c630512..23fffb08147 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ PYTHON_COMMAND test_completions.txt timing.txt test/common/build_config.sh +.coredump_path diff --git a/autotest.sh b/autotest.sh index 54f6ba4b389..9098eb2a4ac 100755 --- a/autotest.sh +++ b/autotest.sh @@ -28,8 +28,12 @@ fi if [ $(uname -s) = Linux ]; then old_core_pattern=$(< /proc/sys/kernel/core_pattern) mkdir -p "$output_dir/coredumps" - # set core_pattern to a known value to avoid ABRT, systemd-coredump, etc. - echo "|$rootdir/scripts/core-collector.sh %P %s %t %c $output_dir/coredumps" > /proc/sys/kernel/core_pattern + # Set core_pattern to a known value to avoid ABRT, systemd-coredump, etc. + # Dump the $output_dir path to a file so collector can pick it up while executing. + # We don't set in in the core_pattern command line because of the string length limitation + # of 128 bytes. See 'man core 5' for details. + echo "|$rootdir/scripts/core-collector.sh %P %s %t %c" > /proc/sys/kernel/core_pattern + echo "$output_dir/coredumps" > "$rootdir/.coredump_path" # make sure nbd (network block device) driver is loaded if it is available # this ensures that when tests need to use nbd, it will be fully initialized diff --git a/scripts/core-collector.sh b/scripts/core-collector.sh index 28155b39407..b7355df5271 100755 --- a/scripts/core-collector.sh +++ b/scripts/core-collector.sh @@ -31,7 +31,6 @@ args+=(core_pid) args+=(core_sig) args+=(core_ts) args+=(rlimit) -args+=(output_dir) read -r "${args[@]}" <<< "$*" @@ -41,7 +40,7 @@ statm=$(< "/proc/$core_pid/statm") core_time=$(date -d@"$core_ts") core_sig_name=$(kill -l "$core_sig") -core=$output_dir/${exe_path##*/}_$core_pid.core +core=$(< "${0%/*}/../.coredump_path")/${exe_path##*/}_$core_pid.core stderr # RLIMIT_CORE is not enforced when core is piped to us. To make