Skip to content

Fix hang on cyclic symlinks with -r -f#4691

Open
eyupcanakman wants to merge 1 commit into
facebook:devfrom
eyupcanakman:fix/recursive-symlink-cycle-4081
Open

Fix hang on cyclic symlinks with -r -f#4691
eyupcanakman wants to merge 1 commit into
facebook:devfrom
eyupcanakman:fix/recursive-symlink-cycle-4081

Conversation

@eyupcanakman
Copy link
Copy Markdown
Contributor

With -r -f, zstd follows symbolic links while walking directories, so a symlink that points back into a directory it already sits in makes the walk loop forever and the CLI hangs. UTIL_prepareFileList now records the (device, inode) of each directory on the current path and skips an entry whose target is already an ancestor, printing a warning. The new cli-test covers a cyclic symlink and a non-cyclic one.

Fixes #4081.

With -r -f, the recursive directory walk follows symbolic links, so a symlink pointing back into an ancestor directory makes UTIL_prepareFileList loop forever and the CLI hangs.
Track the (device, inode) of each directory on the current path and skip an entry whose target is already an ancestor.

Fixes facebook#4081.
@meta-cla meta-cla Bot added the CLA Signed label Jun 5, 2026
@facebook facebook deleted a comment from Awadyisif Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant