mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-19 19:10:34 +00:00
pkg/report: fix linux path prefix trimming
After f613a7c4 ("pkg/cover: fix prefix computation") we stopped trimming starting "/" from linux path names. This broke get_maintainers.pl script which is now given non-existent absolute paths (e.g. "/mm/mmap.c"), as the result syzbot can't find any maintainers for bug reports and mails them into lkml limbo. Trim starting slashes and dots. Extend tests for catch this.
This commit is contained in:
parent
d9ec038e02
commit
78f30a5156
@ -386,7 +386,7 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err
|
||||
for _, frame := range frames {
|
||||
file := frame.File
|
||||
file = strings.TrimPrefix(file, strip)
|
||||
file = strings.TrimPrefix(file, "./")
|
||||
file = strings.TrimLeft(file, "./")
|
||||
info := fmt.Sprintf(" %v:%v", file, frame.Line)
|
||||
modified := append([]byte{}, line...)
|
||||
modified = replace(modified, match[7], match[7], []byte(info))
|
||||
|
@ -220,7 +220,7 @@ func TestLinuxSymbolizeLine(t *testing.T) {
|
||||
}
|
||||
for i, test := range tests {
|
||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||
result := symbolizeLine(symb, symbols, "vmlinux", "/linux/", []byte(test.line))
|
||||
result := symbolizeLine(symb, symbols, "vmlinux", "/linux", []byte(test.line))
|
||||
if test.result != string(result) {
|
||||
t.Errorf("want %q\n\t get %q", test.result, string(result))
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ func TestNetbsdSymbolizeLine(t *testing.T) {
|
||||
return []symbolizer.Frame{
|
||||
{
|
||||
Func: "closef",
|
||||
File: "netbsd/src/kern_descrip.c",
|
||||
File: "/netbsd/src/kern_descrip.c",
|
||||
Line: 1241,
|
||||
},
|
||||
}, nil
|
||||
@ -67,13 +67,13 @@ func TestNetbsdSymbolizeLine(t *testing.T) {
|
||||
return []symbolizer.Frame{
|
||||
{
|
||||
Func: "sleep_finish_timeout",
|
||||
File: "netbsd/src/kern_synch.c",
|
||||
File: "/netbsd/src/kern_synch.c",
|
||||
Line: 336,
|
||||
Inline: true,
|
||||
},
|
||||
{
|
||||
Func: "sleep_finish_all",
|
||||
File: "netbsd/src/kern_synch.c",
|
||||
File: "/netbsd/src/kern_synch.c",
|
||||
Line: 157,
|
||||
},
|
||||
}, nil
|
||||
@ -83,8 +83,8 @@ func TestNetbsdSymbolizeLine(t *testing.T) {
|
||||
}
|
||||
nbsd := netbsd{
|
||||
config: &config{
|
||||
kernelSrc: "netbsd/src",
|
||||
kernelBuildSrc: "netbsd/src",
|
||||
kernelSrc: "/netbsd/src2",
|
||||
kernelBuildSrc: "/netbsd/src",
|
||||
kernelObj: "/netbsd/src/obj/sys/arch/amd64/compile/GENERIC",
|
||||
},
|
||||
kernelObject: "netbsd.gdb",
|
||||
|
@ -83,7 +83,7 @@ func TestOpenbsdSymbolizeLine(t *testing.T) {
|
||||
}
|
||||
obsd := openbsd{
|
||||
config: &config{
|
||||
kernelSrc: "/usr/src",
|
||||
kernelSrc: "/usr/src2",
|
||||
kernelBuildSrc: "/usr/src",
|
||||
kernelObj: "/usr/src/sys/arch/amd64/compile/SYZKALLER/obj",
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user