Bump version of imaging

imaging is now panic safe. Also format nested panics a bit better.
This commit is contained in:
Kovid Goyal 2025-10-09 08:00:31 +05:30
parent f067e9cd92
commit 37bd77f4a8
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 13 additions and 5 deletions

2
go.mod
View file

@ -13,7 +13,7 @@ require (
github.com/google/uuid v1.6.0
github.com/kovidgoyal/dbus v0.0.0-20250519011319-e811c41c0bc1
github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032
github.com/kovidgoyal/imaging v1.6.4
github.com/kovidgoyal/imaging v1.6.5
github.com/seancfoley/ipaddress-go v1.7.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/zeebo/xxh3 v1.0.2

4
go.sum
View file

@ -28,8 +28,8 @@ github.com/kovidgoyal/dbus v0.0.0-20250519011319-e811c41c0bc1 h1:rMY/hWfcVzBm6BL
github.com/kovidgoyal/dbus v0.0.0-20250519011319-e811c41c0bc1/go.mod h1:RbNG3Q1g6GUy1/WzWVx+S24m7VKyvl57vV+cr2hpt50=
github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032 h1:TEV9lpo2a6fP1byiDsoJe2fXpvrj2itae41xMM+bEAg=
github.com/kovidgoyal/exiffix v0.0.0-20250919160812-dbef770c2032/go.mod h1:VU38Nlbvb0lbyS5YkopCZMS5HuJ5QLVJBxRWyzq79q4=
github.com/kovidgoyal/imaging v1.6.4 h1:K0idhRPXnRrJBKnBYcTfI1HTWSNDeAn7hYDvf9I0dCk=
github.com/kovidgoyal/imaging v1.6.4/go.mod h1:bEIgsaZmXlvFfkv/CUxr9rJook6AQkJnpB5EPosRfRY=
github.com/kovidgoyal/imaging v1.6.5 h1:Id9DKlz/ydl5Vxt9QG5IjGSiIcHcszSKXxDubdO49PQ=
github.com/kovidgoyal/imaging v1.6.5/go.mod h1:mBprO214rATK/6OaPAUXmHbSMelPSFEmoBAt/IJdmno=
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0gWSiJswwQ2HqDmtX/ZCDJURnKUt1Ik=
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

View file

@ -73,8 +73,16 @@ func Format_stacktrace_on_panic(r any) (text string, err error) {
n := runtime.Callers(3, pcs)
lines := []string{}
frames := runtime.CallersFrames(pcs[:n])
err = fmt.Errorf("Panicked: %s", r)
lines = append(lines, fmt.Sprintf("\r\nPanicked with error: %s\r\nStacktrace (most recent call first):\r\n", r))
rt := fmt.Sprint(r)
if strings.HasPrefix(rt, "Panicked with error:") {
err = fmt.Errorf("%s", rt)
lines = append(lines, "Panic caused by previous panic (probably in a gouroutine). Previous panic:\r\n")
lines = append(lines, rt)
lines = append(lines, "\r\n\r\nStacktrace of current panic (most recent call first):\r\n")
} else {
err = fmt.Errorf("Panicked: %s", r)
lines = append(lines, fmt.Sprintf("\r\nPanicked with error: %s\r\nStacktrace (most recent call first):\r\n", r))
}
found_first_frame := false
for frame, more := frames.Next(); more; frame, more = frames.Next() {
if !found_first_frame {