Ubuntu Pastebin

Paste from bdrung at Fri, 10 Mar 2017 12:12:16 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
collect_metadata() {
	# Collect metadata information using apport's crash file format.
	# See http://bazaar.launchpad.net/~apport-hackers/apport/trunk/view/head:/doc/data-format.tex
	local coredump_file="$1"
	. /etc/os-release
	local executable_path=$(readlink /proc/$PID/exe)
	local package=$(dpkg -S $executable_path | sed -s 's/:.*$//')
	local package_version=$(dpkg -s $package | sed -n 's/Version: //p')
	if dpkg -s $package | grep -q '^Source:'; then
		local source_package=$(dpkg -s $package | sed -n 's/Source: //p')
	else
		local source_package=$package
	fi
	local dependencies=$(apt-cache --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances --recurse --installed depends ${package}=${package_version} | sed -n 's/.*: //p' | sort | uniq)
	cat <<EOF
ProblemType: Crash
Architecture: $(dpkg --print-architecture)
Date: $(date -d @$TIMESTAMP -R)
DistroRelease: ${NAME} ${VERSION_ID}
ExecutablePath: ${executable_path}
Package: ${package} ${package_version}
SourcePackage: ${source_package}
ProcCmdline: $(sed 's/ /\\ /g' /proc/$PID/cmdline | tr '\0' ' ' | sed 's/ *$//')
Signal: ${SIGNAL}
Uname: $(uname -srm)
CoreDumpFile: ${coredump_file##*/}
Dependencies:
$(dpkg-query -f=' ${Package} ${Version}\n' -W $dependencies)
ProcStatus:
$(sed 's/^/ /' /proc/$PID/status)
ProcMaps:
$(sed 's/^/ /' /proc/$PID/maps)
EOF
}
Download as text