Skip to content

fix(create-astro): scaffold into the correct directory when the path contains non-ASCII characters#17386

Open
felmonon wants to merge 2 commits into
withastro:mainfrom
felmonon:fix/create-astro-nfd-paths
Open

fix(create-astro): scaffold into the correct directory when the path contains non-ASCII characters#17386
felmonon wants to merge 2 commits into
withastro:mainfrom
felmonon:fix/create-astro-nfd-paths

Conversation

@felmonon

Copy link
Copy Markdown
Contributor

Changes

Fixes #17381.

pnpm create astro silently scaffolds into the wrong directory on Linux when the project path contains non-ASCII characters (e.g. /home/user/Masaüstü/). The root cause is in modern-tar (transitive via @bluwy/giget-core): its normalizeUnicode helper NFD-normalizes any non-ASCII string, and validateBounds applies that to the resolved destination path — not just tar entry names. On byte-preserving filesystems (ext4 and friends) NFC and NFD are distinct paths, so the template lands in a parallel decomposed-form directory tree while the CLI exits 0. Details in my triage comment on the issue.

This PR adds relocateNFDFiles(), called after downloadTemplate(): if an NFD-variant of the target directory exists and is a distinct directory (inode check, so normalization-transparent filesystems like APFS/HFS+ are a no-op), its contents are moved back to the intended NFC path and the empty NFD directory chain is removed. The upward rmdir walk stops at the first shared ancestor, which is guaranteed non-empty because the real NFC target lives inside it.

The fix and test originate from the triage bot's exploration branch (triagebot/fix-17381, cherry-picked with authorship preserved); I verified the root cause independently against modern-tar's source, reviewed the relocation/cleanup logic, and added the missing changeset.

A create-astro-side relocation is a mitigation — the durable fix belongs upstream in modern-tar (NFD-normalizing tar entry names for comparison is defensible; rewriting the destination path's Unicode form is not). Happy to open an upstream issue there as a follow-up, but create-astro users are broken today.

Testing

New unit test packages/create-astro/test/units/relocate-nfd.test.ts covers the move-and-cleanup path, the ASCII no-op, and the missing-NFD-dir no-op. Note the suite self-skips on normalization-transparent filesystems (macOS), so the meaningful assertions execute on the Linux CI runners — which is also the only platform where the bug reproduces.

Docs

n/a — bug fix, no behavior change for correctly-scaffolded projects. Changeset included.

astrobot-houston and others added 2 commits July 14, 2026 12:28
…inux

modern-tar normalizes all paths containing non-ASCII characters to NFD
(decomposed Unicode), which on Linux ext4 creates a separate directory
from the user's NFC-encoded original. This caused template files to
silently end up in the wrong directory while create-astro reported success.

After downloadTemplate completes, check if an NFD-variant directory was
created and move its contents back to the intended NFC directory.

Fixes withastro#17381
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2155be8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: create-astro Related to the `create-astro` package (scope) label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: create-astro Related to the `create-astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm create astro fails silently on Linux when path contains non-ASCII characters (Unicode NFC vs NFD normalization bug)

2 participants