log, parallel: fix help flag panicking#509
Merged
ilkinulas merged 4 commits intopeak:masterfrom Sep 13, 2022
Merged
Conversation
after peak#495, `s5cmd --help` started to panic: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x158798e] goroutine 1 [running]: github.com/peak/s5cmd/parallel.(*Manager).Close(...) /Users/boraberkesahin/Documents/s5cmd/parallel/parallel.go:65 github.com/peak/s5cmd/parallel.Close(...) /Users/boraberkesahin/Documents/s5cmd/parallel/global.go:16 github.com/peak/s5cmd/command.glob..func5(0x16af2c0?) /Users/boraberkesahin/Documents/s5cmd/command/app.go:177 +0x10e github.com/urfave/cli/v2.(*App).RunContext.func1() /Users/boraberkesahin/Documents/s5cmd/vendor/github.com/urfave/cli/v2/app.go:309 +0x35 github.com/urfave/cli/v2.(*App).RunContext(0x1bf3c20, {0x1857a30?, 0xc000030e80}, {0xc000020040, 0x2, 0x2}) /Users/boraberkesahin/Documents/s5cmd/vendor/github.com/urfave/cli/v2/app.go:321 +0xa5b github.com/peak/s5cmd/command.Main({0x1857a30, 0xc000030e80}, {0xc000020040, 0x2, 0x2}) /Users/boraberkesahin/Documents/s5cmd/command/app.go:235 +0xa6 main.main() /Users/boraberkesahin/Documents/s5cmd/main.go:23 +0x9b ``` This is caused by (this PR)[urfave/cli@a1c26d5] from urfave/cli. `app.After` is called before `app.Before` is called. Fix this bug by making nil checks.
aykutfarsak
previously approved these changes
Sep 12, 2022
igungor
reviewed
Sep 13, 2022
igungor
approved these changes
Sep 13, 2022
ilkinulas
approved these changes
Sep 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
after #495,
s5cmd --helpstarted to panic:This is caused by this commit from urfave/cli.
app.Afteris deferred beforeshowAppHelpis called. Fix this bug by making nil checks in log.go and parallel.go