[Toybox] Fix ftpget tool get command exit with error code 1
Rob Landley
rob at landley.net
Mon May 19 12:19:49 PDT 2025
On 5/17/25 08:38, 更好的自己 wrote:
> 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)".
Yeah, I saw that on github. (Well your first one line patch anyway, I
didn't look at the second one.)
You didn't give me a reproduction sequence, so I used busybox's ftp
server: I did a "make clean defconfig; make" in busybox and then ran
"./busybox tcpsvd -vE 127.0.0.1 9876 ./busybox ftpd -A $PWD" in the
busybox source directory (more or less as ./busybox ftpd --help
suggested, except using a high port so nothing had to be root), and then
in another tab I built toybox ftpget and did:
mkdir sub; cd sub
../ftpget -l -p 9876 127.0.0.1 .
../ftpget -p 9876 127.0.0.1 README
The first listed the directory contents, the second fetched a file, and
the sha1sum matched. Without your patch. (Which is why it got checked
in, I did test it.)
But you're right it produced error messages and exited with a nonzero
error code. The problem is ftp_line() shouldn't have a must=-1 case to
skip reading the reply. There's always a reply line to fetch and if we
don't it queues up and gets out of sync.
> Hongsheng Peng
Ah, thanks for the name to go with the bug report.
Commit e5b284ed9e17
Rob
More information about the Toybox
mailing list