Prevent exception when attempting to write PaxTarEntry obtained from TarReader
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.
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: |
|
| Milestone: | - |
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?
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.
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
Closing in favor of https://github.com/dotnet/runtime/pull/76404