Hi Maintainers,

ftpget tool use with get command like: "ftpget 192.168.0.123 /data/test.txt 
test.txt" will exit with error code 1 instead of 0.
I check the code flow in "ftp_line" function, it will enter "error_exit_raw" 
because "rc != must (must==226)".

The ftpget needs to receive a 150 status code from the server before proceeding 
to receive actual data, then followed by get 226 status code before sending the 
"QUIT" command.
The implementation in BusyBox 1.35.0 (networking/ftpgetput.c, lines 
233(ftp_receive) and 183(pump_data_and_QUIT)) follows this logic, allowing it 
to successfully send "QUIT" and exit without errors.

With this patch applied, the message like: "150 Opening BINARY mode data 
connection for test.txt (10 bytes)" will no longer be misinterpreted as an 
error. The program can then exit with code 0 instead of 1.


BTW, I also created Pull requests on GitHub.


Thanks.
Best regards
Hongsheng Peng

Attachment: 0001-Fix-ftpget-tool-exit-with-error-code-1.patch
Description: Binary data

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to