Skip to content

Commit

Permalink
fix: Remove debug syscall; Tighten perms; Strip spaces in label
Browse files Browse the repository at this point in the history
  • Loading branch information
placer14 committed Sep 27, 2021
1 parent 574b5c0 commit c3faadf
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions build/panic_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"runtime/debug"
"runtime/pprof"
"strconv"
"syscall"
"strings"
"time"

"github.com/icza/backscanner"
Expand Down Expand Up @@ -58,8 +58,7 @@ func GeneratePanicReport(persistPath, repoPath, label string) {
}
}

syscall.Umask(0)
err := os.MkdirAll(reportPath, 0755)
err := os.MkdirAll(reportPath, 0644)
if err != nil {
panicLog.Error(err.Error())
return
Expand Down Expand Up @@ -157,11 +156,7 @@ func writeJournalTail(tailLen int, repoPath, file string) {
}
break
}
if _, err := f.Write(line); err != nil {
panicLog.Error(err.Error())
break
}
if _, err := f.Write([]byte("\n")); err != nil {
if _, err := f.Write(append(line, "\n"...)); err != nil {
panicLog.Error(err.Error())
break
}
Expand All @@ -179,5 +174,6 @@ func getLatestJournalFilePath(repoPath string) (string, error) {
}

func generateReportName(label string) string {
return fmt.Sprintf("report_%s_%s", label, time.Now().Format("2006-01-02T150405Z0700"))
label = strings.ReplaceAll(label, " ", "")
return fmt.Sprintf("report_%s_%s", label, time.Now().Format("2006-01-02T150405"))
}

0 comments on commit c3faadf

Please sign in to comment.