Skip to content

mc head <file> Returns EOF failure on lines with trailing empty lines #5168

@andrewzlchen

Description

@andrewzlchen

Expected behavior

I'd expect the mc head command to not return an error.

Actual behavior

Running mc head on a file with a trailing newline character causes the command to return an EOF error.

Image

Here's a screenshot with --debug

Image

Steps to reproduce the behavior

Upload a file to MinIO that ends in a newline character. Run mc head on that file.

I think this bug comes from here. This bug was reproducible using go's bufio.Reader

Example go playground:

https://go.dev/play/p/CmMqSopy6l3

mc --version

  • (paste output of mc --version)
mc version RELEASE.2025-01-17T23-25-50Z (commit-id=cc8758c88da31b95dde7b0b6997980ebfb8b98c4)
Runtime: go1.23.5 linux/amd64
Copyright (c) 2015-2025 MinIO, Inc.
License GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>

System information

sh-5.1# uname -v
#22~22.04.1-Ubuntu SMP Fri Jun 14 16:31:00 UTC 2024

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions