Skip to content

Keep FTP transaction reads on the committed path - #2464

Merged
martindurant merged 3 commits into
fsspec:masterfrom
Harsh23Kashyap:fix/ftp-transaction-reads
Nov 25, 2026
Merged

martindurant merged 3 commits into
fsspec:masterfrom
Harsh23Kashyap:fix/ftp-transaction-reads

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor
  • Fixes FTP reads inside a transaction use a nonexistent staging path #2463. Read-only FTP opens currently use a random staging path when autocommit=False, so reading an existing input inside fs.transaction fails with FTP 550. Keep rb on the requested path; write modes still stage as before.
  • Added real local-server tests for binary/text reads, default and explicit autocommit settings, seeks, reader lifetime after commit/rollback, and read-then-write transactions. The tests check that readers are not queued, inputs stay unchanged, and staged output is committed or discarded.
  • On the unmodified base, the new tests failed in 10 cases with 6 controls passing, twice. With the fix, all 16 pass in 20 fresh processes. Related FTP tests: 53 passed, 2 skipped, 10 deselected. New tests plus local filesystem tests: 251 passed, 19 skipped. Ruff check/format and git diff --check pass.
  • Tested on Linux with Python 3.11.17 and pyftpdlib 2.2.0. The core spec selection could not collect because this environment lacks aiohttp. Full repository, TLS/native server, Docker/FUSE, cloud backends and downstream suites were not run. This does not change transactional append semantics.

@JonnyFaeth

Copy link
Copy Markdown

Independent Windows confirmation for 2c0ee98: I ran your unmodified test_ftp_transaction_reads.py against a real local pyftpdlib server on Windows / Python 3.12.14 / pyftpdlib 2.2.0. All 16 tests pass (39.25s). Replacing only ftp.py with the pre-fix implementation reproduces 10 failures and 6 passing controls (40.55s), matching your Linux baseline; the source was restored afterward and the checkout is clean.

This covers the binary/text and autocommit combinations, read-then-write commit/rollback, and readers surviving the transaction boundary. It gives an additional platform check for keeping reads on the committed path without changing the staged-write behavior. I did not run the full FTP/repository suite, TLS, or an external FTP server. No additional patch is needed for this confirmation—these are your existing tests. Codex assisted with execution and reporting.

@martindurant
martindurant merged commit a9b970f into fsspec:master Nov 25, 2026
9 checks passed
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.

FTP reads inside a transaction use a nonexistent staging path

3 participants