Skip to content

Clean up TarHeader.GlobalHeadFormatPrefix#77580

Merged
adamsitnik merged 1 commit intodotnet:mainfrom
stephentoub:tarheader
Oct 28, 2022
Merged

Clean up TarHeader.GlobalHeadFormatPrefix#77580
adamsitnik merged 1 commit intodotnet:mainfrom
stephentoub:tarheader

Conversation

@stephentoub
Copy link
Member

Fixes #77555

@ghost ghost added the area-System.IO label Oct 28, 2022
@ghost ghost assigned stephentoub Oct 28, 2022
@ghost
Copy link

ghost commented Oct 28, 2022

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

Issue Details

Fixes #77555

Author: stephentoub
Assignees: -
Labels:

area-System.IO

Milestone: -

Copy link
Contributor

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing.

return result;
string result = $"{tmp}/GlobalHead.{Environment.ProcessId}.{globalExtendedAttributesEntryNumber}";
return result.Length >= FieldLengths.Name ?
string.Concat("/tmp", result.AsSpan(tmp.Length)) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clever way of replacing the tmp path!

// Format: "%d/GlobalHead.%p.%n"
// - %d: The path of the $TMPDIR variable, if found. Otherwise, the value is '/tmp'.
// - %p: The current process ID.
// - %n: The sequence number of the global extended header record of the archive, starting at 1. In our case, since we only generate one, the value is always 1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for removing. Remnant from before we approved the class to describe PAX GEA entries.

/// <exception cref="ArgumentNullException"><paramref name="globalExtendedAttributes"/> is <see langword="null"/>.</exception>
public PaxGlobalExtendedAttributesTarEntry(IEnumerable<KeyValuePair<string, string>> globalExtendedAttributes)
: base(TarEntryType.GlobalExtendedAttributes, TarHeader.GlobalHeadFormatPrefix, TarEntryFormat.Pax, isGea: true)
: base(TarEntryType.GlobalExtendedAttributes, nameof(PaxGlobalExtendedAttributesTarEntry), TarEntryFormat.Pax, isGea: true) // Name == name of type for lack of a better temporary name until the entry is written
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good enough.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @stephentoub !

@adamsitnik adamsitnik merged commit 68cf247 into dotnet:main Oct 28, 2022
@adamsitnik adamsitnik added this to the 8.0.0 milestone Oct 28, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 27, 2022
@stephentoub stephentoub deleted the tarheader branch June 29, 2023 14:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PAX GEA constructor setting the name value to the unformatted string

3 participants