For many years, I've been using atftp to fetch small blocks of text from TFTP Servers and write them to stdout with a command like this: atftp -g -l /proc/self/fd/1 -r cmd@version 10.0.0.99 That has worked fine for 8-10 years, but started failing earlier this week with the error message below: tftp: error writing to file /proc/self/fd/1 The problem seems to be that somebody introduced code that does a seek() call on the local file every time data is written to the local file. TFTP requires every block to be acked, so I don't see how any block could arrive out-of-order. Perhaps it's done to deal with duplicate blocks? I've submitted the attached patch so that a seek is only done if needed. This restores the ability to write to /proc/self/fd/1 —- unless out-fo-order or duplicate data blocks are encountered, in which case you get the same failure that you do without the patch. Reproducible: Always Steps to Reproduce: $ atftp -g -l /proc/self/fd/1 -r <small text file> <ip> Actual Results: see the error message "tftp: error writing to file /proc/self/fd/1" Expected Results: content of <small text file> written to stdout Patch has been submitted upstream as support ticket #5 https://sourceforge.net/p/atftp/support-requests/5/
Created attachment 623408 [details, diff] Avoid unneeded seek() calls when writing local file.
ping
*sigh* completely missed this one when making -r2 Oh well, one more yak to shave.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=151740dee902b137e326f997a3e8486242b70b71 commit 151740dee902b137e326f997a3e8486242b70b71 Author: Tobias Klausmann <klausman@gentoo.org> AuthorDate: 2021-01-22 12:30:34 +0000 Commit: Tobias Klausmann <klausman@gentoo.org> CommitDate: 2021-01-22 12:30:53 +0000 net-ftp/atftp: Add patch that reduces # of seeks Bug: https://bugs.gentoo.org/713672 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Tobias Klausmann <klausman@gentoo.org> net-ftp/atftp/atftp-0.7.2-r3.ebuild | 69 +++++++++++++++++++++++ net-ftp/atftp/files/atftp-0.7.2-fewer_seeks.patch | 38 +++++++++++++ 2 files changed, 107 insertions(+)
Thanks! I never did figure out the purpose of the seek() calls. Just ignoring received data packets with the wrong index seems like right thing to do.
Hi... I packed all the incoming patches and merge requests together and - after some testing - made a release https://sourceforge.net/projects/atftp/ Klaus - you ad a DEV are closer to another ebuild than me as proxy-maintainer - do you want to add the release to the tree or should I? BTW atftp compiles now also with musl minimal libc, so we don't need to fear Agostino's tinderbox tests....
(In reply to Martin Dummer from comment #6) > Klaus - you ad a DEV are closer to another ebuild than me as > proxy-maintainer - do you want to add the release to the tree or should I? I can look at it later today/tonight. Will poke this bug when I add the ebuild.
(In reply to Tobias Klausmann from comment #7) > (In reply to Martin Dummer from comment #6) > > Klaus - you ad a DEV are closer to another ebuild than me as > > proxy-maintainer - do you want to add the release to the tree or should I? > > I can look at it later today/tonight. Will poke this bug when I add the > ebuild. Sorry, please hold... just discovered that we have bug #687536 open, I will enhance the test script so we can close #687536 together with version bump.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62ed671b337aa94c1ec37d5a0a86e9bb38e81672 commit 62ed671b337aa94c1ec37d5a0a86e9bb38e81672 Author: Martin Dummer <martin.dummer@gmx.net> AuthorDate: 2021-02-02 09:24:40 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2021-02-02 13:06:31 +0000 net-ftp/atftp: version bump to 0.7.4 new version fixes security issues upstream fix self-testing script test.sh fix compile against sys-libs/musl Closes: https://bugs.gentoo.org/713672 Closes: https://bugs.gentoo.org/687536 Package-Manager: Portage-3.0.12, Repoman-3.0.2 Signed-off-by: Martin Dummer <martin.dummer@gmx.net> Closes: https://github.com/gentoo/gentoo/pull/19302 Signed-off-by: Joonas Niilola <juippis@gentoo.org> net-ftp/atftp/Manifest | 1 + net-ftp/atftp/atftp-0.7.4.ebuild | 66 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)