arcade icon indicating copy to clipboard operation
arcade copied to clipboard

archives.targets: Fix creating tar.gz on Windows

Open radical opened this issue 6 months ago • 1 comments

Creating .tar.gz arhives on windows from _CreateArchive target fails silently with:

tar: could not chdir to ''C:\Users\ankj\source\repos\aspire\artifacts\obj\Aspire.Cli.linux-arm64\Debug\net8.0\output/''

Fixing the mismatched directory separators does not help, neither does removing the trailing /'. Instead this whole thing can be side-stepped by using WorkingDirectory parameter of the Exec task.

Also:

  • fixes the path used in generation of the symbols tarball
  • Construct the various paths using msbuild's NormalizePath, and NormalizeDirectory functions so they get the correct directory separators.

cc @joperezr @danmoseley

radical avatar Jun 18 '25 20:06 radical

An instance of the failure is in https://dev.azure.com/dnceng/internal/_build/results?buildId=2733005&view=logs&j=0bc77094-9fcd-5c38-f6e4-27d2ae131589&t=5138e247-88cb-5ba0-8eee-e2fdd127e7e8 .

radical avatar Jun 18 '25 20:06 radical

/backport to release/9.0

radical avatar Jun 24 '25 16:06 radical

Started backporting to release/9.0: https://github.com/dotnet/arcade/actions/runs/15856525371

github-actions[bot] avatar Jun 24 '25 16:06 github-actions[bot]

@radical backporting to "release/9.0" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: archives.targets: Fix creating tar.gz on Windows
Using index info to reconstruct a base tree...
M	src/Microsoft.DotNet.Build.Tasks.Archives/build/archives.targets
Falling back to patching base and 3-way merge...
Auto-merging src/Microsoft.DotNet.Build.Tasks.Archives/build/archives.targets
CONFLICT (content): Merge conflict in src/Microsoft.DotNet.Build.Tasks.Archives/build/archives.targets
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 archives.targets: Fix creating tar.gz on Windows
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

github-actions[bot] avatar Jun 24 '25 16:06 github-actions[bot]