Skip to content

Replication: find node files with a space in the name - #2097

Merged
fog-workflows[bot] merged 1 commit into
dev-branchfrom
fix/replication-ftp-filename-spaces
Nov 13, 2026
Merged

fog-workflows[bot] merged 1 commit into
dev-branchfrom
fix/replication-ftp-filename-spaces

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Forum 18313: the image replicator copied the same files again every cycle.

A name with a space never existed on the node. FOGFTP::exists() split each LIST line on every space and took the 9th field as the name. So 7450 AIO-WIN11-A10-YHP57.CAB became 7450. rawsize() then reported 0, and the replicator deleted the file and copied it again on every cycle. The poster's log shows this for every file with a space (718000218 != 0). The recursive delete parsed the same lines. Both now read the name through _listName(), which splits into at most 9 fields and drops a symlink's -> target.

The HTTP remote size was never used. replicateItems() tested the node's getsize.php reply with is_int(). FOGURLRequests::process() returns the body as a string, so that test never matched, and every remote size came from the FTP listing. It now accepts an all-digit reply. A reply that is not digits still falls back to HTTPS, then FTP. Behavior change: the replicator now trusts getsize.php first, which was the intended order.

Both bugs are the same in 1.5.10.

The same log also shows files with no space reporting the same smaller node size every hour, on both nodes. This PR does not claim to explain that. The poster has been asked for ls -l and the lftp transfer log.

tests/ftp-exists-name-with-spaces.test.php runs the shipped exists() against a vsftpd-shaped listing. It fails on the old split. Both phpstan passes are clean.

🤖 Generated with Claude Code

FOGFTP::exists() split each LIST line on every space and took the 9th
field as the name, so "7450 AIO-WIN11-A10-YHP57.CAB" became "7450". The
file never existed on the node, rawsize() reported 0, and the image
replicator deleted and copied it again every cycle (forum 18313). The
recursive delete parsed the same lines. Both now read the name through
_listName(), which splits into at most 9 fields and drops a symlink's
" -> target".

replicateItems() tested the node's getsize.php reply with is_int(). A
response body is a string, so that never matched, and every remote size
came from the FTP listing. It now accepts an all-digit reply. A reply
that is not digits falls back to HTTPS, then FTP, as before.

tests/ftp-exists-name-with-spaces runs the shipped exists() against a
vsftpd-shaped listing and fails on the old split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fog-workflows
fog-workflows Bot enabled auto-merge November 13, 2026 12:57
@fog-workflows
fog-workflows Bot added this pull request to the merge queue Nov 13, 2026
Merged via the queue into dev-branch with commit 8622ea9 Nov 13, 2026
12 checks passed
@fog-workflows
fog-workflows Bot deleted the fix/replication-ftp-filename-spaces branch November 13, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant