Repository navigation
fix(alluxio): skip short lines when parsing the mount table - #6285
Open
bhavishyajain545 wants to merge 1 commit into
Open
bhavishyajain545 wants to merge 1 commit into
bhavishyajain545 wants to merge 1 commit into
Conversation
IsMounted and GetMountedAlluxioPaths read the third field of every line of the 'alluxio fs mount' output without checking that the line has one. An empty output or a line with fewer than three fields, such as a blank line, made them panic with an index out of range error. Skip the lines that have no Alluxio path field. Signed-off-by: Bhavishya Jain <65864699+bhavishyajain545@users.noreply.github.com>
|
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.



Ⅰ. Describe what this PR does
Follow-up to #6284, as suggested in its review (#6284 (review)).
IsMountedandGetMountedAlluxioPathsreadfields[2]of every line of thealluxio fs mountoutput without checking how many fields the line has. An empty output, or a line with fewer than three fields such as a blank line, makes them panic withindex out of range [2]. Both functions now skip those lines.The output is trimmed in
kubeclient.ExecWithOptions, so a normal mount table that ends with a newline does not hit this. It needs an empty output or a short line inside the output.Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
TestAlluxioFileUtils_MountOutputWithShortLinescovers, for both functions, an empty output, a blank line between two entries, and a line with fewer than three fields.Ⅳ. Describe how to verify it
go test -gcflags=all=-l ./pkg/ddc/alluxio/operations/passes. Without the change tobase.gothe new test panics atbase.go:323withindex out of range [2] with length 0.Ⅴ. Special notes for reviews
Master Address:line inMasterPodName, and adding the stdout to the parse error) are not changed here.IsMountedandGetMountedAlluxioPaths. The open PRs that touchbase.goorbase_test.go(This PR is to add comments to FindUnmountedAlluxioPaths in fluid/pkg/ddc/alluxio/operations/base.go. #5927, This PR is to add comments to TestAlluxioFileUtils_IsMounted in pkg/ddc/alluxio/operations/base_test.go. #6014, This PR is to add comments to TestAlluxioFileUtils_IsMounted in pkg/ddc/alluxio/operations/base_test.go. #6016, Add comments to TestAlluxioFileUtils_ReportSummary in pkg/ddc/alluxio… #6021, This PR is to add comments to GetMountedAlluxioPaths in pkg/ddc/alluxio/operations/base.go. #6034, docs(test): add comments to TestAlluxioFileUtils_IsMounted #6091) only add comments.make lintlocally (Windows).