runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Prevent exception when attempting to write PaxTarEntry obtained from TarReader

Open carlossanlop opened this issue 3 years ago • 3 comments

Fixes https://github.com/dotnet/runtime/issues/75215

A PaxTarEntry obtained from a TarReader will have an extended attributes dictionary filled with the fields that get collected by default.

When attempting to write such entry to a TarWriter via WriteEntry(TarEntry), we collect the default extended attribute fields and store them in the dictionary. The problem is that we were using Dictionary.Add, which throws if the key already exists, and that is not the intended behavior.

The fix is to add the key using the indexer. That way, we always write the most up-to-date value to the dictionary.

We should try to get it into 7.0 as mentioned in the issue.

carlossanlop avatar Sep 08 '22 03:09 carlossanlop

Tagging subscribers to this area: @dotnet/area-system-io See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes https://github.com/dotnet/runtime/issues/75215

A PaxTarEntry obtained from a TarReader will have an extended attributes dictionary filled with the fields that get collected by default.

When attempting to write such entry to a TarWriter via WriteEntry(TarEntry), we collect the default extended attribute fields and store them in the dictionary. The problem is that we were using Dictionary.Add, which throws if the key already exists, and that is not the intended behavior.

The fix is to add the key using the indexer. That way, we always write the most up-to-date value to the dictionary.

We should try to get it into 7.0 as mentioned in the issue.

Author: carlossanlop
Assignees: carlossanlop
Labels:

area-System.IO

Milestone: -

ghost avatar Sep 08 '22 03:09 ghost

We should try to get it into 7.0 as mentioned in the issue.

This hasn't moved in 10 days. What's the plan?

stephentoub avatar Sep 19 '22 14:09 stephentoub

This hasn't moved in 10 days. What's the plan?

I had a call with @jozkee today. We have a mutual understanding now and will address the comments today.

carlossanlop avatar Sep 19 '22 18:09 carlossanlop

All the apple queues are failing with an unrelated infra problem that is being investigated right now (thanks Stephen for notifying First Responders).

##[error]Git fetch failed with exit code: 128

carlossanlop avatar Sep 20 '22 17:09 carlossanlop

Closing in favor of https://github.com/dotnet/runtime/pull/76404

jozkee avatar Sep 29 '22 21:09 jozkee