You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/04/08 18:34:25 UTC

[GitHub] [trafficcontrol] ocket8888 opened a new pull request #4622: Fixed segfault in types test when a test fails

ocket8888 opened a new pull request #4622: Fixed segfault in types test when a test fails
URL: https://github.com/apache/trafficcontrol/pull/4622
 
 
   ## What does this PR (Pull Request) do?
   - [x] This PR fixes #REPLACE_ME OR is not related to any Issue
   
   There was a part of the types tests that looked something like:
   ```go
   resp, err := toclient.SomeAPIFunc()
   if err != nil || len(resp) == 0 {
   	t.Fatalf("error: %v", err.Error())
   }
   ```
   When there was no error but the response was empty this caused a segfault as `err.Error` was dereferenced while `err` was `nil`. When using formatting like `t.Fatalf`/`fmt.Printf`/etc. it's not necessary to call `error.Error` for arguments formatted with `%v`, so the fix was simple: get rid of that call. For consistency and to maybe help avoid the same problem in the future as the codebase evolves, I removed calls to `error.Error` everywhere in the file where they weren't necessary (which was everywhere).
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Control Client (Go) (tests)
   
   ## What is the best way to verify this PR?
   Run the client/api integration tests. Hopefully they all pass, but if the DeleteTypesTest were to fail because there were no configured types in the database at the moment (which you could maybe force by removing all types from the test data? It might not get that far, though) it shouldn't segfault.
   
   I wasn't able to reproduce whatever happened to make that check fail, unfortunately.
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   - master
   
   ## The following criteria are ALL met by this PR
   
   - [x] This PR includes tests
   - [x] Documentation is unnecessary
   - [x] An update to CHANGELOG.md is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR does not include a database migration
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] rawlinp merged pull request #4622: Fixed segfault in types test when a test fails

Posted by GitBox <gi...@apache.org>.
rawlinp merged pull request #4622: Fixed segfault in types test when a test fails
URL: https://github.com/apache/trafficcontrol/pull/4622
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services