Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 713672 - net-ftp/atftp-0.7.2-r1 client fails writing to local file /proc/self/fd/1 (PATCH)
Summary: net-ftp/atftp-0.7.2-r1 client fails writing to local file /proc/self/fd/1 (PA...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Tobias Klausmann (RETIRED)
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2020-03-20 19:09 UTC by Grant Edwards
Modified: 2021-02-02 13:08 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Avoid unneeded seek() calls when writing local file. (atftp-0.7.2-spurious-seek.patch,1.36 KB, patch)
2020-03-20 19:11 UTC, Grant Edwards
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Edwards 2020-03-20 19:09:58 UTC
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/
Comment 1 Grant Edwards 2020-03-20 19:11:12 UTC
Created attachment 623408 [details, diff]
Avoid unneeded seek() calls when writing local file.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-01-22 02:06:07 UTC
ping
Comment 3 Tobias Klausmann (RETIRED) gentoo-dev 2021-01-22 12:25:23 UTC
*sigh* completely missed this one when making -r2

Oh well, one more yak to shave.
Comment 4 Larry the Git Cow gentoo-dev 2021-01-22 12:31:16 UTC
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(+)
Comment 5 Grant Edwards 2021-01-22 15:08:49 UTC
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.
Comment 6 Martin Dummer 2021-02-01 13:17:29 UTC
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....
Comment 7 Tobias Klausmann (RETIRED) gentoo-dev 2021-02-01 15:02:50 UTC
(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.
Comment 8 Martin Dummer 2021-02-01 16:10:17 UTC
(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.
Comment 9 Larry the Git Cow gentoo-dev 2021-02-02 13:08:32 UTC
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(+)