Skip to content

archive/tar: should treat empty tar files as invalid #31012

@tomfitzhenry

Description

@tomfitzhenry

What version of Go are you using (go version)?

https://play.golang.org/

What did you do?

https://play.golang.org/p/VeyYROaJQZu

What did you expect to see?

An error to be printed, similar to how GNU tar produces an error when reading an empty file:

$ touch empty
$ tar --version
tar (GNU tar) 1.29
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
$ tar tf empty
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

What did you see instead?

No error printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions