Skip to content

Commit ab7dcfd

Browse files
Copilotgewarren
andcommitted
Add breaking change documentation for GnuTarEntry and PaxTarEntry atime/ctime behavior
Co-authored-by: gewarren <[email protected]>
1 parent 50f0f3a commit ab7dcfd

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
3030
| [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 |
3131
| [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 |
3232
| [Default trace context propagator updated to W3C standard](core-libraries/10.0/default-trace-context-propagator.md) | Behavioral change | Preview 4 |
33+
| [GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default](core-libraries/10.0/tar-atime-ctime-default.md) | Behavioral change | Preview 5 |
3334
| [LDAP DirectoryControl parsing is now more stringent](core-libraries/10.0/ldap-directorycontrol-parsing.md) | Behavioral change | Preview 1 |
3435
| [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |
3536
| [System.Linq.AsyncEnumerable included in core libraries](core-libraries/10.0/asyncenumerable.md) | Source incompatible | Preview 1 |
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Breaking change: GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default"
3+
description: "Learn about the breaking change in .NET 10 where GnuTarEntry and PaxTarEntry no longer automatically set access time and change time fields."
4+
ms.date: 01/30/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/46465
7+
---
8+
# GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default
9+
10+
Starting in .NET 10, <xref:System.Formats.Tar.GnuTarEntry> and <xref:System.Formats.Tar.PaxTarEntry> no longer automatically set access time (`atime`) and change time (`ctime`) fields when creating new entries. These fields are problematic in tar entries because not all tar readers support them.
11+
12+
## Version introduced
13+
14+
.NET 10 Preview 5
15+
16+
## Previous behavior
17+
18+
Previously, `GnuTarEntry` and `PaxTarEntry` always added `atime` and `ctime` values when creating new entries.
19+
20+
## New behavior
21+
22+
Starting in .NET 10, `GnuTarEntry` and `PaxTarEntry` only set `atime` and `ctime` if:
23+
24+
- The entry was read from a tar archive that already contained these fields
25+
- The user explicitly sets them using the appropriate properties
26+
27+
The behavior of <xref:System.Formats.Tar.TarEntry.ModificationTime?displayProperty=nameWithType> remains unchanged. It's initialized to <xref:System.DateTime.UtcNow?displayProperty=nameWithType> for tar entries created with a constructor, and uses the file modification time for entries created from files.
28+
29+
## Type of breaking change
30+
31+
This is a [behavioral change](../../categories.md#behavioral-change).
32+
33+
## Reason for change
34+
35+
Better compatibility with other tar readers and improved round-tripping of tar files without modification. The `atime` and `ctime` fields create tar files that aren't readable by many tar clients.
36+
37+
## Recommended action
38+
39+
No action required for most users. If you require these fields to be set, you can do so directly:
40+
41+
- For `GnuTarEntry`: Use <xref:System.Formats.Tar.GnuTarEntry.AccessTime?displayProperty=nameWithType> and <xref:System.Formats.Tar.GnuTarEntry.ChangeTime?displayProperty=nameWithType> properties
42+
- For `PaxTarEntry`: Use the constructor that accepts extended attributes: <xref:System.Formats.Tar.PaxTarEntry.%23ctor(System.Formats.Tar.TarEntryType,System.String,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}})?displayProperty=nameWithType>
43+
44+
However, be aware that setting these fields creates a tar file that might not be readable by many tar clients.
45+
46+
## Affected APIs
47+
48+
- <xref:System.Formats.Tar.GnuTarEntry?displayProperty=fullName>
49+
- <xref:System.Formats.Tar.PaxTarEntry?displayProperty=fullName>
50+
- <xref:System.Formats.Tar.TarReader?displayProperty=fullName>
51+
- <xref:System.Formats.Tar.TarWriter?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ items:
2424
href: core-libraries/10.0/generic-math.md
2525
- name: Default trace context propagator updated to W3C Standard
2626
href: core-libraries/10.0/default-trace-context-propagator.md
27+
- name: GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default
28+
href: core-libraries/10.0/tar-atime-ctime-default.md
2729
- name: LDAP DirectoryControl parsing is now more stringent
2830
href: core-libraries/10.0/ldap-directorycontrol-parsing.md
2931
- name: MacCatalyst version normalization

0 commit comments

Comments
 (0)