diff --git a/freeze/bin/check-freeze.sh b/freeze/bin/check-freeze.sh index 6baca914a..a05823b16 100755 --- a/freeze/bin/check-freeze.sh +++ b/freeze/bin/check-freeze.sh @@ -319,7 +319,7 @@ _resolve_path() { printf '%s' "$GSTACK_HOOK_PATH" } -_FREEZE_WHY="a symlink loop, a chain over 40 links, link targets over 8192 characters in all, an unreadable link, or a Windows name that cannot be placed" +_FREEZE_WHY="a symlink loop, a chain over 40 links, a path and link targets over 8192 characters in all, an unreadable link, or a Windows name that cannot be placed" FREEZE_DIR_RAW="$FREEZE_DIR" FREEZE_DIR=$(_resolve_path "$FREEZE_DIR_RAW" physical "$FREEZE_DIR_WIN") || _freeze_unresolved "the freeze boundary $FREEZE_DIR_RAW" "$_FREEZE_WHY" # Hosts disagree on '/..': the OS means the target's parent, a lexical diff --git a/test/hook-scripts.test.ts b/test/hook-scripts.test.ts index 0c84c63bd..ab7814450 100644 --- a/test/hook-scripts.test.ts +++ b/test/hook-scripts.test.ts @@ -1561,15 +1561,14 @@ describe('check-freeze.sh', () => { // of padded links must deny fast instead of running for minutes. test.skipIf(process.platform === 'win32')('a symlink chain whose targets add up past 8192 characters denies quickly', () => { withTree(({ base, home, src, outside }) => { - let next = outside; - for (let i = 40; i >= 1; i--) { - const link = path.join(src, `S${i}`); - fs.symlinkSync('.' + '/'.repeat(3990) + path.relative(src, next), link); - next = link; - } + // Each target pads with 'name/..' pairs (few components, so the walk + // itself stays cheap) to about 3,800 characters; three hops pass 8192. + const pad = ('n'.repeat(250) + '/../').repeat(15); + fs.symlinkSync(pad + path.relative(src, outside), path.join(src, 'p3')); + fs.symlinkSync(pad + 'p3', path.join(src, 'p2')); + fs.symlinkSync(pad + 'p2', path.join(src, 'p1')); const started = Date.now(); - const decision = decide(src, src + '/S1/' + '/'.repeat(3990) + 'x.ts', home, base); - expect(decision).toBe('deny'); + expect(decide(src, src + '/p1/x.ts', home, base)).toBe('deny'); expect(Date.now() - started).toBeLessThan(4000); }); });