Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent panic if status line is empty in mdstat #441

Merged
merged 1 commit into from May 2, 2022

Conversation

amakutunowicz
Copy link
Contributor

This change fixes a potential source of panic when the status line in
mdstat is empty and the code is trying to reference the first item in a
zero-sized slice.

@discordianfish @pgier

Signed-off-by: Artur Makutunowicz artur@makutunowicz.net

@discordianfish
Copy link
Member

Thanks, looks reasonable! You still need to sign-off your commit though. Ignore the circleci issues, we'll fix them.

And curious, where did you see mdstat having an empty line?

@amakutunowicz
Copy link
Contributor Author

Looks like my public email setting was incorrect - can we somehow rerun the tests here? It should pass now.

I can't really say what exactly happened (I didn't log the mdstat contents), but sporadically I was able to see panics caused by that particular line.

@SuperQ SuperQ closed this Apr 14, 2022
@SuperQ SuperQ reopened this Apr 14, 2022
@SuperQ
Copy link
Member

SuperQ commented Apr 14, 2022

DCO complains with this:

Commit sha: ed8f4a3, Author: Artur Makutunowicz, Committer: Artur Makutunowicz; Expected "Artur Makutunowicz arma@linkedin.com", but got "Artur Makutunowicz artur@makutunowicz.net".

@SuperQ
Copy link
Member

SuperQ commented Apr 14, 2022

You might need to edit the email in your git commit and force push.

@pgier
Copy link
Collaborator

pgier commented Apr 15, 2022

You might need to rebase to pick up the lint fixes

@amakutunowicz
Copy link
Contributor Author

Hello, is there anything else I can do to make this change merged and release a new version, so it can be picked up by Go modules?

@SuperQ
Copy link
Member

SuperQ commented Apr 25, 2022

If you could rebase your fork and branch, that should fix up the tests.

git checkout master
git remote add upstream https://github.com/prometheus/procfs.git
git fetch --all
git fetch upstream HEAD
git rebase FETCH_HEAD
git push
git checkout statusline-empty
git rebase -i origin/master
git push -f

This change fixes a potential source of panic when the status line in
mdstat is empty and the code is trying to reference first item in a
zero-sized slice.

Signed-off-by: Artur Makutunowicz <arma@linkedin.com>
@amakutunowicz
Copy link
Contributor Author

@SuperQ Thanks, that seemed to work!

@SuperQ SuperQ merged commit b9b5ad9 into prometheus:master May 2, 2022
remijouannet pushed a commit to remijouannet/procfs that referenced this pull request Oct 20, 2022
This change fixes a potential source of panic when the status line in
mdstat is empty and the code is trying to reference first item in a
zero-sized slice.

Signed-off-by: Artur Makutunowicz <arma@linkedin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants