New Upstream Release - panicparse

Ready changes

Summary

Merged new upstream version: 2.3.1 (was: 2.3.0).

Diff

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9e44610..8ce8a43 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -30,7 +30,7 @@ jobs:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
         # Do not forget to bump every 6 months!
-        gover: ["1.18"]
+        gover: ["1.19"]
     env:
       PYTHONDONTWRITEBYTECODE: x
     steps:
@@ -101,7 +101,7 @@ jobs:
         # Windows.
         os: [ubuntu-latest, macos-latest, windows-latest]
         # Do not forget to bump every 6 months!
-        gover: ["1.18"]
+        gover: ["1.19"]
     env:
       PYTHONDONTWRITEBYTECODE: x
     steps:
@@ -280,7 +280,7 @@ jobs:
       matrix:
         os: [ubuntu-latest]
         # Do not forget to bump every 6 months!
-        gover: ["1.18"]
+        gover: ["1.19"]
     permissions:
       security-events: write
     steps:
diff --git a/cmd/panic/main.go b/cmd/panic/main.go
index 9c071da..d523a8f 100644
--- a/cmd/panic/main.go
+++ b/cmd/panic/main.go
@@ -7,17 +7,20 @@
 // It is a tool to help test pp, it is used in its unit tests.
 //
 // To install, run:
-//   go install github.com/maruel/panicparse/v2/cmd/panic
-//   panic -help
-//   panic str |& pp
+//
+//	go install github.com/maruel/panicparse/v2/cmd/panic
+//	panic -help
+//	panic str |& pp
 //
 // Some panics require the race detector with -race:
-//   go install -race github.com/maruel/panicparse/v2/cmd/panic
-//   panic race |& pp
+//
+//	go install -race github.com/maruel/panicparse/v2/cmd/panic
+//	panic race |& pp
 //
 // To use with optimization (-N) and inlining (-l) disabled, build with
 // -gcflags '-N -l' like:
-//   go install -gcflags '-N -l' github.com/maruel/panicparse/v2/cmd/panic
+//
+//	go install -gcflags '-N -l' github.com/maruel/panicparse/v2/cmd/panic
 package main
 
 // To add a new panic stack signature, add it to types type below, keeping the
diff --git a/cmd/panicweb/main.go b/cmd/panicweb/main.go
index 489f22c..284ad30 100644
--- a/cmd/panicweb/main.go
+++ b/cmd/panicweb/main.go
@@ -107,7 +107,11 @@ func main() {
 		w.Header().Set("Content-Type", "text/html; charset=utf-8")
 		_, _ = w.Write(rootPage)
 	})
-	go http.Serve(ln, http.DefaultServeMux)
+	srv := &http.Server{
+		Handler:           http.DefaultServeMux,
+		ReadHeaderTimeout: 2 * time.Second,
+	}
+	go srv.Serve(ln)
 
 	// Start many clients.
 	a := ln.Addr()
diff --git a/debian/changelog b/debian/changelog
index cc62f8e..91d37fd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+panicparse (2.3.1-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 01 Jun 2023 04:06:48 -0000
+
 panicparse (2.3.0-1) unstable; urgency=medium
 
   * Revert debian/watch to track release tarballs
diff --git a/debian/patches/001-fix-non-go-module-support.patch b/debian/patches/001-fix-non-go-module-support.patch
index 7b55b9b..be34935 100644
--- a/debian/patches/001-fix-non-go-module-support.patch
+++ b/debian/patches/001-fix-non-go-module-support.patch
@@ -7,9 +7,11 @@ Reviewed-by: Anthony Fok <foka@debian.org>
 Last-Update: 2021-12-01, 2022-06-21
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/internal/internaltest/internaltest.go
-+++ b/internal/internaltest/internaltest.go
-@@ -185,7 +185,7 @@
+Index: panicparse.git/internal/internaltest/internaltest.go
+===================================================================
+--- panicparse.git.orig/internal/internaltest/internaltest.go
++++ panicparse.git/internal/internaltest/internaltest.go
+@@ -185,7 +185,7 @@ func build(tool string, race bool) strin
  	if runtime.GOOS == "windows" {
  		p += ".exe"
  	}
@@ -18,9 +20,11 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  	if IsUsingModules() {
  		path = "github.com/maruel/panicparse/v2/cmd/"
  	}
---- a/stack/context_test.go
-+++ b/stack/context_test.go
-@@ -1454,9 +1454,7 @@
+Index: panicparse.git/stack/context_test.go
+===================================================================
+--- panicparse.git.orig/stack/context_test.go
++++ panicparse.git/stack/context_test.go
+@@ -1454,9 +1454,7 @@ func TestGetGOPATHs(t *testing.T) {
  // of go modules using the "replace" statement.
  func TestGomoduleComplex(t *testing.T) {
  	// This test cannot run in parallel.
@@ -31,7 +35,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  	old := os.Getenv("GOPATH")
  	defer os.Setenv("GOPATH", old)
  	root, err := ioutil.TempDir("", "stack")
-@@ -1827,9 +1825,6 @@
+@@ -1834,9 +1832,6 @@ func testPanicMismatched(t *testing.T, s
  		t.Fatalf("output: %q", b.String())
  	}
  	ver := "/v2"
@@ -41,7 +45,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  	want := []*Goroutine{
  		{
  			Signature: Signature{
-@@ -2004,9 +1999,6 @@
+@@ -2011,9 +2006,6 @@ func testPanicUTF8(t *testing.T, s *Snap
  		t.Fatalf("output: %q", b.String())
  	}
  	ver := "/v2"
@@ -51,7 +55,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  	want := []*Goroutine{
  		{
  			Signature: Signature{
-@@ -2045,6 +2037,8 @@
+@@ -2052,6 +2044,8 @@ func testPanicUTF8(t *testing.T, s *Snap
  // "net" package causes a background thread to be started, which breaks "panic
  // asleep".
  func TestPanicweb(t *testing.T) {
diff --git a/internal/internaltest/static_panic_race.go b/internal/internaltest/static_panic_race.go
index b4260c5..e6e34fc 100644
--- a/internal/internaltest/static_panic_race.go
+++ b/internal/internaltest/static_panic_race.go
@@ -6,8 +6,8 @@ package internaltest
 
 // staticPanicRace is a snapshot created with:
 //
-//  go install -race github.com/maruel/panicparse/cmd/panic
-//  panic race |& sed "s#$HOME##g"
+//	go install -race github.com/maruel/panicparse/cmd/panic
+//	panic race |& sed "s#$HOME##g"
 //
 // when installed within $GOPATH.
 const staticPanicRace = `
diff --git a/internal/internaltest/static_panicweb.go b/internal/internaltest/static_panicweb.go
index e2b6207..1ea2bd4 100644
--- a/internal/internaltest/static_panicweb.go
+++ b/internal/internaltest/static_panicweb.go
@@ -6,7 +6,7 @@ package internaltest
 
 // staticPanicweb is a snapshot created by running:
 //
-//  bash static_panicweb.sh
+//	bash static_panicweb.sh
 //
 // Not using go:generate here since it takes 2 minutes to complete.
 const staticPanicweb = `goroutine 135 [running]:
diff --git a/internal/main.go b/internal/main.go
index 3bce04a..0e9e3af 100644
--- a/internal/main.go
+++ b/internal/main.go
@@ -8,10 +8,10 @@
 // making the crash dump harder to read than strictly necessary.
 //
 // Colors:
-//  - Magenta: first goroutine to be listed.
-//  - Yellow: main package.
-//  - Green: standard library.
-//  - Red: other packages.
+//   - Magenta: first goroutine to be listed.
+//   - Yellow: main package.
+//   - Green: standard library.
+//   - Red: other packages.
 //
 // Bright colors are used for exported symbols.
 package internal
diff --git a/internal/main_test.go b/internal/main_test.go
index 559d614..8eb4924 100644
--- a/internal/main_test.go
+++ b/internal/main_test.go
@@ -41,7 +41,7 @@ func TestProcess(t *testing.T) {
 			palette: testPalette,
 			simil:   stack.AnyPointer,
 			path:    basePath,
-			want:    "GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain Fmain.go:71 GmainR()A\n",
+			want:    "GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain Fmain.go:74 GmainR()A\n",
 		},
 		{
 			name:    "FullPath",
@@ -49,14 +49,14 @@ func TestProcess(t *testing.T) {
 			simil:   stack.AnyValue,
 			path:    fullPath,
 			// "/" is used even on Windows.
-			want: fmt.Sprintf("GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain F%s:71 GmainR()A\n", strings.Replace(filepath.Join(filepath.Dir(d), "cmd", "panic", "main.go"), "\\", "/", -1)),
+			want: fmt.Sprintf("GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain F%s:74 GmainR()A\n", strings.Replace(filepath.Join(filepath.Dir(d), "cmd", "panic", "main.go"), "\\", "/", -1)),
 		},
 		{
 			name:    "NoColor",
 			palette: &Palette{},
 			simil:   stack.AnyValue,
 			path:    basePath,
-			want:    "GOTRACEBACK=all\npanic: simple\n\n1: running\n    main main.go:71 main()\n",
+			want:    "GOTRACEBACK=all\npanic: simple\n\n1: running\n    main main.go:74 main()\n",
 		},
 		{
 			name:    "Match",
@@ -72,7 +72,7 @@ func TestProcess(t *testing.T) {
 			simil:   stack.AnyValue,
 			path:    basePath,
 			filter:  regexp.MustCompile(`notpresent`),
-			want:    "GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain Fmain.go:71 GmainR()A\n",
+			want:    "GOTRACEBACK=all\npanic: simple\n\nC1: runningA\n    Emain Fmain.go:74 GmainR()A\n",
 		},
 	}
 	for i, line := range data {
@@ -107,14 +107,14 @@ func TestProcessTwoSnapshots(t *testing.T) {
 		"GOTRACEBACK=all\n" +
 		"panic: simple\n\n" +
 		"1: running\n" +
-		"    main main.go:71 main()\n" +
+		"    main main.go:74 main()\n" +
 		"Ye\n" +
 		"GOTRACEBACK=all\n" +
 		"panic: 42\n\n" +
 		"1: running\n" +
-		"    main main.go:90  panicint(0x2a)\n" +
-		"    main main.go:312 glob..func9()\n" +
-		"    main main.go:73  main()\n" +
+		"    main main.go:93  panicint(0x2a)\n" +
+		"    main main.go:315 glob..func9()\n" +
+		"    main main.go:76  main()\n" +
 		"Yo\n")
 	compareString(t, want, out.String())
 }
diff --git a/stack/context_test.go b/stack/context_test.go
index d45ede9..063244e 100644
--- a/stack/context_test.go
+++ b/stack/context_test.go
@@ -1362,7 +1362,7 @@ func TestScanSnapshotSyntheticTwoSnapshots(t *testing.T) {
 							"main.main",
 							Args{},
 							pathJoin(ppDir, "main.go"),
-							71,
+							74,
 						),
 					},
 				},
@@ -1392,19 +1392,19 @@ func TestScanSnapshotSyntheticTwoSnapshots(t *testing.T) {
 							"main.panicint",
 							Args{Values: []Arg{{Value: 42}}},
 							pathJoin(ppDir, "main.go"),
-							90,
+							93,
 						),
 						newCallLocal(
 							"main.glob..func9",
 							Args{},
 							pathJoin(ppDir, "main.go"),
-							312,
+							315,
 						),
 						newCallLocal(
 							"main.main",
 							Args{},
 							pathJoin(ppDir, "main.go"),
-							73,
+							76,
 						),
 					},
 				},
@@ -1546,11 +1546,18 @@ func TestGomoduleComplex(t *testing.T) {
 	}
 	rootLocal := rootRemote
 	if runtime.GOOS == "darwin" {
-		// On MacOS, the path is a symlink and it will be somehow evaluated when we
-		// get the traces back. This must NOT be run on Windows otherwise the path
-		// will be converted to 8.3 format.
-		if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
-			t.Fatal(err)
+		if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
+			// On MacOS, $TMPDIR path is a symlink /var -> /private/var.
+			//
+			// On versions before go1.19, it was somehow evaluated by exec.Cmd.Run().
+			// This stopped being true on go1.19. I suspect it is a side-effect of
+			// https://go.dev/doc/go1.19#os-exec-path
+			//
+			// This must NOT be run on Windows otherwise the path will be converted
+			// to 8.3 format.
+			if rootRemote, err = filepath.EvalSymlinks(rootLocal); err != nil {
+				t.Fatal(err)
+			}
 		}
 	}
 
@@ -1881,7 +1888,7 @@ func testPanicRace(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
 							"main.main",
 							Args{},
 							pathJoin(ppDir, "main.go"),
-							73,
+							76,
 						),
 					},
 				},
@@ -1917,7 +1924,7 @@ func testPanicRace(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
 							"main.main",
 							Args{},
 							pathJoin(ppDir, "main.go"),
-							73,
+							76,
 						),
 					},
 				},
@@ -2352,7 +2359,7 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
 				t.Fatal("expected Locked")
 			}
 			// This is a change detector on internal/main.go.
-			want := Stack{Calls: []Call{newCallLocal("main.main", Args{}, pathJoin(pwebDir, "main.go"), 141)}}
+			want := Stack{Calls: []Call{newCallLocal("main.main", Args{}, pathJoin(pwebDir, "main.go"), 145)}}
 			compareStacks(t, &b.Signature.CreatedBy, &want)
 			for i := range b.Signature.Stack.Calls {
 				if strings.HasPrefix(b.Signature.Stack.Calls[i].ImportPath, "github.com/mattn/go-colorable") {
@@ -2386,9 +2393,15 @@ func identifyPanicwebSignature(t *testing.T, b *Bucket, pwebDir string) panicweb
 				if l := len(b.Stack.Calls); l != 4 {
 					t.Fatalf("expected %d calls, got %d", 4, l)
 				}
-				// The first item shall be an assembly file independent of the OS.
-				if s := b.Stack.Calls[0].RelSrcPath; !strings.HasSuffix(s, ".s") {
-					t.Fatalf("expected assembly file, got %q", s)
+				// The first item shall be an assembly file independent of the OS on Go
+				// < 1.19.
+				s := b.Stack.Calls[0].RelSrcPath
+				if ver := internaltest.GetGoMinorVersion(); ver > 0 && ver < 19 {
+					if !strings.HasSuffix(s, ".s") {
+						t.Fatalf("expected assembly file, got %q", s)
+					}
+				} else if !strings.HasPrefix(s, "syscall") && !strings.HasSuffix(s, ".go") {
+					t.Fatalf("expected syscall go file, got %q", s)
 				}
 			}
 			// Process the golang.org/x/sys call specifically.

More details

Full run details

Historical runs