Description
Description
atime
and ctime
are problematic in tar entries - not all tar readers support them. GnuTarEntry
and PaxTarEntry
have been changed to not add these fields by default. The fields will still be preserved when reading, and a user may set them directly, but they will not be set on existing entries that didn't have them to start, or when converting from other entry types.
The behavior TarEntry.ModificationTime
is unchanged. It is initialized to UtcNow
for tar entries created with a constructor, and uses the file modification time for entries created from files.
Other minor fixes have been made to System.Formats.Tar
to prioritize round-tripping of TarEntry
s from read -> write without change.
cc @tmds
Version
.NET 10 Preview 5
Previous behavior
GnuTarEntry
and PaxTarEntry
would always add atime
and ctime
values.
New behavior
GnuTarEntry
and PaxTarEntry
only set atime
and ctime
if read from an entry that had them or the user explicitly set them.
Type of breaking change
- Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
- Behavioral change: Existing binaries might behave differently at run time.
Reason for change
Better compatibility with other tar readers, round-tripping tar files without modification.
Recommended action
No action required for most users.
If you require these fields to be set you can do so directly with GnuTarEntry.AccessTime
, GnuTarEntry.ChangeTime
, or PaxTarEntry(TarEntryType entryType, string entryName, IEnumerable<KeyValuePair<string, string>> extendedAttributes)
- but know that this will create a tar that is not readable by many tar clients.
Feature area
Core .NET libraries
Affected APIs
System.Formats.Tar.GnuTarEntry
System.Formats.Tar.TarReader
System.Formats.Tar.TarWriter
Metadata
Metadata
Assignees
Type
Projects
Status