ammachado commented on PR #30536:
URL: https://github.com/apache/camel/pull/30536#issuecomment-7071950685

   @Croway thanks for reproducing this on vsftpd. The log makes the problem 
clear: the embedded MINA server resolves `STOR` against the path of its current 
directory, so the ITs could not see it.
   
   Fixed with the first option: an FTP upload now changes into the directory of 
its file again for each file, even when the previous upload left the connection 
there. It does not send `PWD` (the starting directory is known once per 
connection), and the autoCreate cache is kept, so the per-file existence check 
is still skipped. With the endpoint directory under `/`, each upload into the 
same directory is now:
   
   ```
   CWD /
   CWD p1
   CWD out
   STOR file.txt
   ```
   
   From reading the code on `main`, the same upload sent `PWD`, `CWD p1/out`, 
`CWD /` (the autoCreate check), then `PWD`, `CWD p1`, `CWD out`, `STOR`, `CWD 
/`.
   
   This also covers the third row of your table: after `rm -r p1/out && mkdir 
p1/out`, the `CWD out` resolves to the new directory, so the upload is stored 
instead of failing with `553`.
   
   Tests in `FtpStepwiseCommandsIT`:
   - `uploadsIntoTheSameDirectoryChangeIntoItWithoutAskingOrChecking` asserts 
the exact sequence above for each upload.
   - `directoryRenamedBetweenUploadsIsNotUsed` renames `p1/out` to `p1/out.1` 
and creates `p1/out` between two uploads. Since MINA resolves by path, the file 
location alone would pass either way, so the test also asserts that the second 
upload sends `CWD` into the path again before `STOR`. Without the fix it sends 
only `STOR second.txt`, the same sequence as your vsftpd log.
   
   I did not rerun your vsftpd scenario. If you still have that setup, a run 
against the new head would confirm it.
   
   Downloads and deletes still stay in the directory between files of the same 
poll, as each poll lists the directory first and changes back before the 
listing. I left them as they are. Let me know if you think the same reasoning 
should apply there.
   
   SFTP is unchanged, as you noted. The two points you confirmed from 
@davsclaus' review (the cache bound and the StreamCache retry) are fixed in the 
same commit.
   
   _Claude Code on behalf of Adriano Machado (@ammachado)_
   
   _This was generated by an AI agent and may contain inaccuracies. Please 
verify before relying on it._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to