mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
ignore more tokens in some mountinfo entries (#12104)
it seems to be legitimate to have `mountinfo` lines to have keywords with spaces such as ``` rootfs overlay / overlay rw,relatime,lowerdir... ``` This was not expected, but for our requirement we can just ignore this and move forward. fixes #12047 Signed-off-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
parent
6235bd825b
commit
31dab4e7ff
@ -131,9 +131,11 @@ func parseMountFrom(file io.Reader) (mountInfos, error) {
|
|||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := strings.Fields(line)
|
fields := strings.Fields(line)
|
||||||
if len(fields) != expectedNumFieldsPerLine {
|
if len(fields) != expectedNumFieldsPerLine {
|
||||||
return nil, fmt.Errorf("wrong number of fields (expected %d, got %d): %s", expectedNumFieldsPerLine, len(fields), line)
|
// ignore incorrect lines.
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Freq should be an integer.
|
// Freq should be an integer.
|
||||||
|
@ -214,7 +214,6 @@ func TestReadProcMountFrom(t *testing.T) {
|
|||||||
// Error cases where parsing fails with invalid Freq and Pass params.
|
// Error cases where parsing fails with invalid Freq and Pass params.
|
||||||
{
|
{
|
||||||
errorCases := []string{
|
errorCases := []string{
|
||||||
"/dev/0 /path/to/mount\n",
|
|
||||||
"/dev/1 /path/to/mount type flags a 0\n",
|
"/dev/1 /path/to/mount type flags a 0\n",
|
||||||
"/dev/2 /path/to/mount type flags 0 b\n",
|
"/dev/2 /path/to/mount type flags 0 b\n",
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user