You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems to me like it's just a fast-path to avoid work when the header is known to be empty. If it's not causing any observable bug then I would leave it.
Are you thinking of a case where the checksum is 0 and the header is not empty? Could we craft such a case to prove we have a bug?
(PS: please assign a milestone when removing untriaged - milestone should be where we want to take action. In this case since a bug here would mean data corruption I've assigned 10.0.0)
Seems to me like it's just a fast-path to avoid work when the header is known to be empty.
It doesn't look like that. On a checksum that has a value zero it returns as if there is no entry to be read.
I think the expected behavior is to check the checksum is correct and throw InvalidDataException if it isn't.
Currently, the checksum is never checked.
I think the expected behavior is to check the checksum is correct and throw InvalidDataException if it isn't.
Do other tools (tar(1), 7zip etc.) allow invalid checksum during extraction; warn-and-continue behavior? If so, would be nice to add a bail-out switch for lenient extraction.
If the checksum is incorrect, do you want to assume the size is correct to move to the next entry.
I'm not sure this is a use-case the TarReader should try to support.
I tried to add checksum checking in #118577, but there are failing tests (some tests expect us to pass on invalid checksums). Also, if we go ahead with this, there would be no way to ignore the checksum mismatches, which can potentially break some users. @ericstj do you think we should proceed with the change?
I'm reluctant to take any change here unless there is real customer impact. I think @tmds noticed this through code inspection and felt it was necessary follow up from other changes that were made.
If fixing this introduces new failure points without fixing any customer-impacting bug, then I'd suggest we move it to next release or even wont-fix it. We try to be as compatible as possible with file formats that may have come from many different clients, while still being spec compliant. I'm not hearing a super strong argument for spec compliance here, but if there is one then that could drive a fix-in-net11 vs wont-fix decision.
The behavior of GNU tar is to skip to the next entry and try and extract that. The error code of the tar command will be non-zero when there is an incorrect checksum.
An incorrect checksum indicates a corruption in the tar file.
I agree, but I am reluctant to introduce this change this late in .NET 10 cycle. If we want to do it in 10, then I would err on the side of caution and add an app context switch to escape to previous behavior.
I'm not hearing a super strong argument for spec compliance here, but if there is one then that could drive a fix-in-net11 vs wont-fix decision.
I agree with moving this to next release for now. And maybe we can figure out some reasonable API change that would allow users ignore checksum failures (at their own peril).
I am starting to see a pattern here. Given the amount of implementations that enforce checksum matches, I would try to make the change for .NET 11. Since it is early in the release, there is enough time for community to give feedback. Thoughts, @ericstj?
Activity
tmds commentedon Jul 9, 2025
Separate issue/question:
I don't find code that verifies the checksum has the expected value for the header that is read. Is this missing?
[-]Tar reader doesn't permit a zero checksum[/-][+]Tar reader checksum checking[/+]dotnet-policy-service commentedon Jul 9, 2025
Tagging subscribers to this area: @dotnet/area-system-formats-tar
See info in area-owners.md if you want to be subscribed.
ericstj commentedon Jul 9, 2025
Seems to me like it's just a fast-path to avoid work when the header is known to be empty. If it's not causing any observable bug then I would leave it.
Are you thinking of a case where the checksum is 0 and the header is not empty? Could we craft such a case to prove we have a bug?
(PS: please assign a milestone when removing
untriaged- milestone should be where we want to take action. In this case since a bug here would mean data corruption I've assigned 10.0.0)tmds commentedon Jul 9, 2025
It doesn't look like that. On a checksum that has a value zero it returns as if there is no entry to be read.
I think the expected behavior is to check the checksum is correct and throw
InvalidDataExceptionif it isn't.Currently, the checksum is never checked.
am11 commentedon Jul 10, 2025
Do other tools (
tar(1), 7zip etc.) allow invalid checksum during extraction; warn-and-continue behavior? If so, would be nice to add a bail-out switch for lenient extraction.tmds commentedon Jul 10, 2025
tarhas no options to ignore invalid checksums.If the checksum is incorrect, do you want to assume the size is correct to move to the next entry.
I'm not sure this is a use-case the
TarReadershould try to support.tmds commentedon Jul 11, 2025
I won't have time to work on this till mid/end of August. If the issue is still open then, I'll pick it up.
1 remaining item
rzikm commentedon Aug 11, 2025
I tried to add checksum checking in #118577, but there are failing tests (some tests expect us to pass on invalid checksums). Also, if we go ahead with this, there would be no way to ignore the checksum mismatches, which can potentially break some users. @ericstj do you think we should proceed with the change?
ericstj commentedon Aug 11, 2025
I'm reluctant to take any change here unless there is real customer impact. I think @tmds noticed this through code inspection and felt it was necessary follow up from other changes that were made.
If fixing this introduces new failure points without fixing any customer-impacting bug, then I'd suggest we move it to next release or even wont-fix it. We try to be as compatible as possible with file formats that may have come from many different clients, while still being spec compliant. I'm not hearing a super strong argument for spec compliance here, but if there is one then that could drive a fix-in-net11 vs wont-fix decision.
tmds commentedon Aug 11, 2025
The behavior of GNU
taris to skip to the next entry and try and extract that. The error code of thetarcommand will be non-zero when there is an incorrect checksum.An incorrect checksum indicates a corruption in the tar file.
Imo checksums should be checked by default.
rzikm commentedon Aug 12, 2025
I agree, but I am reluctant to introduce this change this late in .NET 10 cycle. If we want to do it in 10, then I would err on the side of caution and add an app context switch to escape to previous behavior.
I agree with moving this to next release for now. And maybe we can figure out some reasonable API change that would allow users ignore checksum failures (at their own peril).
rzikm commentedon Oct 2, 2025
I did some investigation, I created a tar file and manually corrupted the checksum,
I am starting to see a pattern here. Given the amount of implementations that enforce checksum matches, I would try to make the change for .NET 11. Since it is early in the release, there is enough time for community to give feedback. Thoughts, @ericstj?
tmds commentedon Oct 2, 2025
And returns an error code. So a script that checks for failure will stop at this point.
ericstj commentedon Oct 6, 2025
Yep, I'm supportive of making this change early in .NET 11 and documenting it as breaking.
Check checksum when reading TAR archives (dotnet#118577)