fix(pack): handle paths containing spaces in build and dev-server - #525
Open
HoodieYlya13 wants to merge 2 commits into
Open
fix(pack): handle paths containing spaces in build and dev-server#525HoodieYlya13 wants to merge 2 commits into
HoodieYlya13 wants to merge 2 commits into
Conversation
mmso
force-pushed
the
main
branch
2 times, most recently
from
August 5, 2026 16:22
896ff9e to
06694ac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was setting the repo up to look at something in Mail and the dev server
wouldn't start. It turned out to have nothing to do with my change:
proton-packcan't run when the checkout path contains a space.dev-server and build fail to spawn
commandWithLoghands a single string toexeca.command(), which splits it onwhitespace to decide what to execute. The string is built from
require.resolve('webpack-cli/bin/cli.js'), an absolute path, so once the repolives somewhere with a space in it the executable path itself gets split:
ENOENT, with nothing pointing at the real cause.
The cleanup step deletes the wrong directory
buildcleans its output with the same helper:Split the same way,
rmreceives a truncated prefix of the intended path. Ireproduced this in a scratch directory containing
dev/next todev proton/WebClients/applications/mail/dist:dev/was deleteddist/it was supposed to clean was left untouched-fsuppresses the errorSo it removes something unrelated and silently skips its actual job. Whether it
destroys anything depends on the truncated prefix happening to exist, which
isn't a comfortable thing to leave to chance.
validate.sh reports healthy files as empty
With the spawn issue fixed,
buildstill failed.detectEmptyiterates anunquoted command substitution:
bash word-splits each path on spaces,
[ ! -s "$file" ]is true for everyfragment, and real chunks get reported as empty:
Changes
protonPack.js: use execa's array form for the calls containing resolvedpaths, so arguments are passed as argv and never re-parsed.
getWebpackArgsreturns an array instead of a joined string, and the resolved CLI runs through
process.execPathso it doesn't depend on the file's exec bit.commandWithLogis kept for thetarcall, which needsshell: truefor theglob.
validate.sh: read the file list line by line instead of iterating anunquoted substitution. Also switched
((total++))tototal=$((total + 1)),since the former returns exit 1 on the first increment and the script runs
under
set -e.Testing
From a path containing a space:
yarn workspace proton-mail startserves theapp, and
yarn workspace proton-mail build:webcompletes (1086 files indist, 35M bundle) where both previously failed. Therm -rfbehaviour abovewas checked in a scratch directory, before and after.