feature: no symbolic link handling (ignored or broken) #34

Closed
opened 2026-07-20 14:57:57 +02:00 by TapTap · 0 comments
Owner

FastSync has no handling for symbolic links:

  1. src/client/scanner.c: When the scanner encounters a symlink, stat() follows the link and treats it as a regular file or directory. The symlink nature is lost. Line 103: stat(cur_path, &stats) — should use lstat() and handle symlinks specially.

  2. src/shared/metadata.c: file_restore_metadata() calls chmod() and chown() which follow symlinks, potentially modifying the target instead of the link itself.

  3. src/shared/file.c: No code path to handle symlink creation on the receiver side.

This means:

  • Symlinks are silently converted to regular files/directories containing the same content as the target
  • This can cause data duplication or unexpected behavior
  • Rsync securely copies symlinks as symlinks by default

Suggested Fix:

  1. Use lstat() in the scanner and detect S_ISLNK()
  2. Add a SYMLINK status code to the protocol
  3. Store the link target path and recreate as a symlink on the receiver

Severity: medium

FastSync has no handling for symbolic links: 1. **`src/client/scanner.c`**: When the scanner encounters a symlink, `stat()` follows the link and treats it as a regular file or directory. The symlink nature is lost. Line 103: `stat(cur_path, &stats)` — should use `lstat()` and handle symlinks specially. 2. **`src/shared/metadata.c`**: `file_restore_metadata()` calls `chmod()` and `chown()` which follow symlinks, potentially modifying the target instead of the link itself. 3. **`src/shared/file.c`**: No code path to handle symlink creation on the receiver side. This means: - Symlinks are silently converted to regular files/directories containing the same content as the target - This can cause data duplication or unexpected behavior - Rsync securely copies symlinks as symlinks by default **Suggested Fix:** 1. Use `lstat()` in the scanner and detect `S_ISLNK()` 2. Add a `SYMLINK` status code to the protocol 3. Store the link target path and recreate as a symlink on the receiver **Severity:** medium
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#34