Skip to content

Commit

Permalink
Improve stacktrace to fix tech debts
Browse files Browse the repository at this point in the history
Signed-off-by: divyansh42 <diagrawa@redhat.com>
  • Loading branch information
divyansh42 committed Oct 30, 2023
1 parent 3aa55dd commit 4894b3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/.atom-build.yml
/.project
/.vagrant
.vscode/
cmd/s2i/debug
*~

Expand Down
10 changes: 9 additions & 1 deletion pkg/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package docker

import (
"archive/tar"
"bufio"
"bytes"
"encoding/base64"
"encoding/json"
Expand Down Expand Up @@ -995,7 +996,14 @@ func (d *stiDocker) RunContainer(opts RunContainerOptions) error {
if signal == syscall.SIGQUIT {
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
f, err := os.Create("/var/log/s2i_docker_stack_trace.log")
if err != nil {
return
}
defer f.Close()
w := bufio.NewWriter(f)
w.Write(buf)
w.Flush()
}
os.Exit(2)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scripts/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ type FileURLReader struct{}
func (*FileURLReader) Read(url *url.URL) (io.ReadCloser, error) {
// for some reason url.Host may contain information about the ./ or ../ when
// specifying relative path, thus using that value as well
return os.Open(filepath.Join(url.Host, url.Path))
return os.Open(filepath.Clean(filepath.Join(url.Host, url.Path)))
}

// ImageReader just returns information the URL is from inside the image
Expand Down

0 comments on commit 4894b3d

Please sign in to comment.