FTP reads inside a transaction use a nonexistent staging path
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in fsspec/implementations/ftp.py, at FTPFile.__init__, where the requested path is swapped for a random path under tempdir whenever autocommit=False; read AbstractFileSystem.open and the transaction context in fsspec/spec.py to see how autocommit reaches the file. The guard should apply only to write modes so rb keeps the caller's path. Verify with the local pyftpdlib setup in fsspec/implementations/tests/test_ftp.py, adding cases for text/binary reads, explicit autocommit=False, reader lifetime, read-then-write rollback/commit, and rerun the existing write-transaction tests. Note the reporter says they are already preparing this fix, so check the thread before starting.
Written by the indexing model from the issue text.
Description
Problem
- Reading a committed FTP file inside
fs.transactionfails withftplib.error_perm: 550 No such file or directory. The same read outside the transaction succeeds. Reproduced twice against a local pyftpdlib 2.2.0 server on master12c823bc. FTPFile.__init__replaces the requested path with a random staging path wheneverautocommit=False, includingrb. This prevents read-then-write transactions from reading their input.
# The FTP server already contains /input and an empty /stage directory.
fs = FTPFileSystem(host, port, username, password, tempdir="/stage")
with fs.open("/input", "rb") as f:
assert f.read() == b"committed input"
with fs.transaction:
with fs.open("/input", "rb") as f:
f.read() # 550: attempts RETR /stage/<random UUID>
Proposed scope
- Keep read-only opens on the requested path, including explicit
autocommit=False. Continue staging writes. No API or data-model change, migration, or transactional append redesign. - Regression checks should cover binary/text reads, explicit autocommit settings, reader lifetime, and read-then-write commit/rollback without changing the input. Existing write transaction tests must still pass.
- Changing
AbstractFileSystem.openglobally would affect unrelated backends; a local FTP guard avoids that. The main risk is changing writer staging, so those controls are part of the fix. - The analogous SFTP change in #2462 touches a different backend. The FTP append work in #2403 is separate. I am preparing the narrow FTP fix and local-server tests.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 577
- Avg merge
- 2d 36m
- Merged PRs (30d)
- 51
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fsspec/filesystem_spec
-
SFTP put_file passes full destination URLs to ParamikoPossibly taken @IlyaKhalafi claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
fsspec/filesystem_spec#2443 ·
Maintainers usually reply within 1 day
-
GistFileSystem.cat ignores start and end read boundsPossibly taken @IlyaKhalafi claimed this 9 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
fsspec/filesystem_spec#2438 ·
Maintainers usually reply within 1 day
-
DBFS append mode silently overwrites existing filesPossibly taken @IlyaKhalafi claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
fsspec/filesystem_spec#2429 ·
Maintainers usually reply within 1 day
-
DirCache.items() and values() raise RuntimeError with bounded LRU cachingPossibly taken @draarivpatel-ui claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
fsspec/filesystem_spec#2419 · 1 comment ·
Maintainers usually reply within 1 day
-
Directory listing cache expiry changes when the system clock jumpsPossibly taken @Dodothereal claimed this 16 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
fsspec/filesystem_spec#2330 ·
Maintainers usually reply within 1 day
All issues in fsspec/filesystem_spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
openvinotoolkit/openvino_notebooks#3858 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
hummingbot/hummingbot-api#256 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
area:other help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
WingedGuardian/GENesis-AGI#4734 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
peach-mitao/peach#693 ·
Maintainers usually reply within 1 day