Breaking change docs: TarWriter now emits HardLink entries for hard-linked files (.NET 11)#52854
Breaking change docs: TarWriter now emits HardLink entries for hard-linked files (.NET 11)#52854
Conversation
…-linked files Fixes #52683 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/docs/sessions/1a965af5-8df4-4072-a179-4d952413f887 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new .NET 11 breaking-change article documenting updated System.Formats.Tar.TarWriter behavior for hard-linked files (subsequent entries become HardLink entries instead of duplicating contents), and wires the article into the compatibility navigation and index.
Changes:
- Adds a new breaking change article for
TarWriterhard-link handling in .NET 11 Preview 3. - Updates
docs/core/compatibility/toc.ymlto include the new article under .NET 11 Core .NET libraries. - Updates
docs/core/compatibility/11.mdto list the new breaking change in the Core .NET libraries table.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/core/compatibility/toc.yml | Adds the new breaking change article to the .NET 11 Core .NET libraries TOC. |
| docs/core/compatibility/core-libraries/11/tarwriter-hardlink-entries.md | New breaking change article describing the TarWriter hard-link entry behavior and mitigation option. |
| docs/core/compatibility/11.md | Adds the new breaking change entry to the .NET 11 index table. |
| If your application depends on duplicating file content for hard-linked files, you can restore the previous behavior. Set the `HardLinkMode` property to `TarHardLinkMode.CopyContents` in a new `TarWriterOptions` instance: | ||
|
|
||
| ```csharp | ||
| using System.Formats.Tar; | ||
| using System.IO; | ||
|
|
||
| string filePath1 = "file1.txt"; | ||
| string filePath2 = "file2.txt"; | ||
|
|
||
| // Create two hard-linked files. | ||
| File.WriteAllText(filePath1, "Hello, world!"); | ||
| File.CreateHardLink(filePath2, filePath1); | ||
|
|
||
| var options = new TarWriterOptions(TarEntryFormat.Pax) | ||
| { | ||
| HardLinkMode = TarHardLinkMode.CopyContents | ||
| }; |
There was a problem hiding this comment.
The article references new/related APIs (TarWriterOptions, HardLinkMode, and TarHardLinkMode.CopyContents) but doesn't use xref links for them. Adding xrefs helps readers navigate to the API docs and helps catch typos in type/member names during doc validation.
| } | ||
| ``` | ||
|
|
||
| Extracting a tar archive that contains `HardLink` entries to a file system without hard link support throws an <xref:System.IO.IOException>. Use the new `TarExtractOptions` class to specify whether to extract hard links as hard links or copy them as separate files. This enables extraction to file systems without hard link support. |
There was a problem hiding this comment.
TarExtractOptions is mentioned as the way to control hard-link extraction behavior, but it's not linked (xref) and isn't referenced elsewhere in the repo. Please add an xref (or link to the specific extraction API/overload that takes these options) so the docs validate the name and readers can find the correct API surface.
| Extracting a tar archive that contains `HardLink` entries to a file system without hard link support throws an <xref:System.IO.IOException>. Use the new `TarExtractOptions` class to specify whether to extract hard links as hard links or copy them as separate files. This enables extraction to file systems without hard link support. | |
| Extracting a tar archive that contains `HardLink` entries to a file system without hard link support throws an <xref:System.IO.IOException>. Use the new <xref:System.Formats.Tar.TarExtractOptions> class to specify whether to extract hard links as hard links or copy them as separate files. This enables extraction to file systems without hard link support. |
BillWagner
left a comment
There was a problem hiding this comment.
This LGTM. I have one question for you to consider.
|
|
||
| # TarWriter uses HardLink entries for hard-linked files | ||
|
|
||
| <xref:System.Formats.Tar.TarWriter> now detects when multiple files are hard-linked to the same inode. It writes a `HardLink` entry for subsequent files instead of duplicating the file content. |
There was a problem hiding this comment.
This article reads as Unix specific. (inode is a Unix term).
Does this apply on Windows? If not, should we state that?
Documents the .NET 11 Preview 3 behavioral change where
TarWriterwritesHardLinkentries for files sharing the same inode instead of duplicating content—aligning with GNU tar behavior.Changes
docs/core/compatibility/core-libraries/11/tarwriter-hardlink-entries.md— covers previous/new behavior, reason for change, and migration pathtoc.yml) — new entry under .NET 11 Core .NET libraries11.md) — new row in Core .NET libraries tableKey migration guidance
If content duplication is required, use the new
TarWriterOptions.HardLinkMode:Also notes that extracting
HardLinkentries on file systems without hard link support throwsIOException, and that .NET 11's newTarExtractOptionscan be used to control extraction behavior.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh auth status(http block)Changes:
docs/core/compatibility/core-libraries/11/tarwriter --noprofile(http block)Internal previews