Bug 746972 - tftp doesn't return proper value after failure
tftp doesn't return proper value after failure
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tftp (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: Jan Synacek
BaseOS QE Security Team
: Patch
Depends On:
Blocks: 836160 947775
  Show dependency treegraph
 
Reported: 2011-10-18 09:11 EDT by Aleš Mareček
Modified: 2013-05-14 04:00 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-05-14 04:00:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
raw test script (3.40 KB, application/x-sh)
2012-01-06 11:16 EST, Aleš Mareček
no flags Details
the patch fixes return codes (14.75 KB, patch)
2012-01-11 09:38 EST, Jiri Skala
mhlavink: review+
Details | Diff
the patch removes empty file when wasn't received from server (1.92 KB, patch)
2012-01-11 09:40 EST, Jiri Skala
mhlavink: review+
Details | Diff
raw test script (3.34 KB, application/x-sh)
2012-01-11 11:32 EST, Aleš Mareček
no flags Details

  None (edit)
Description Aleš Mareček 2011-10-18 09:11:05 EDT
Description of problem:
tftp doesn't return proper value after failure.

Case #1 - sending non-existent file:
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# tftp 192.168.1.1 -m binary -c put test.txt
tftp: test.txt: No such file or directory
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# echo $?
0

Case #2 - sending existing file to non-existent tftp server:
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# ip -f inet addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    inet 10.16.66.121/21 brd 10.16.71.255 scope global eth0
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# ls server.log 
server.log
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# tftp server.log -m binary -c put 192.168.1.1
Error: Name or service not known
server.log: unknown host
No target machine specified.
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# echo $?
0

Case #3 - getting non-existent file from non-existent server:
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# tftp whatever -m binary -c get 192.168.1.1
Error: Name or service not known
whatever: unknown host
usage: get host:file host:file ... file, or
       get file file ... file if connected
i:x86_64|m:x86_64 root@penguin-a1300-01 [~]# echo $?
0

Case #4 - getting non-existent file from proper tftp server:
i:i386|m:i686 root@hp-bl460c-02 [test]# ls
i:i386|m:i686 root@hp-bl460c-02 [test]# tftp 10.16.65.70 -m binary -c get status
i:i386|m:i686 root@hp-bl460c-02 [test]# echo $?
0
i:i386|m:i686 root@hp-bl460c-02 [test]# ls -la
drwxr-xr-x.  2 root root 4096 Oct 18 09:04 .
dr-xr-x---. 15 root root 4096 Oct 18 09:02 ..
-rw-r--r--. 1 root root 12 Oct 18 09:04 status
# this part works
i:i386|m:i686 root@hp-bl460c-02 [test]# tftp 10.16.65.70 -m binary -c get server.log
Error code 1: File not found
i:i386|m:i686 root@hp-bl460c-02 [test]# echo $?
0
i:i386|m:i686 root@hp-bl460c-02 [test]# ls -la
total 12
drwxr-xr-x.  2 root root 4096 Oct 18 09:04 .
dr-xr-x---. 15 root root 4096 Oct 18 09:02 ..
-rw-r--r--.  1 root root    0 Oct 18 09:04 server.log
-rw-r--r--.  1 root root   12 Oct 18 09:04 status
# this doesn't, and it also create file we want to download



Version-Release number of selected component (if applicable):
tftp-0.49-7.el6

How reproducible:
Always

Steps to Reproduce:
1. See 4 cases above
  
Actual results:
Returns 0 when fails

Expected results:
Return some non-zero value


Additional info:
I think it shouldn't also create file with zero size when it can't download it. But I don't really know if there isn't some kind of routine that could break the downloading process or crash when the file would be created after some received bytes.
Comment 2 Aleš Mareček 2012-01-06 11:16:20 EST
Created attachment 551188 [details]
raw test script
Comment 3 Jiri Skala 2012-01-11 09:38:54 EST
Created attachment 552135 [details]
the patch fixes return codes
Comment 4 Jiri Skala 2012-01-11 09:40:18 EST
Created attachment 552136 [details]
the patch removes empty file when wasn't received from server
Comment 8 Aleš Mareček 2012-01-11 11:32:07 EST
Created attachment 552166 [details]
raw test script
Comment 10 Suzanne Yeghiayan 2012-02-14 18:17:56 EST
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 11 RHEL Product and Program Management 2012-09-07 01:11:03 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 12 Jan Synacek 2013-05-14 04:00:04 EDT
Since this component was not scheduled for update in past releases I am closing this bug as WONTFIX. If PM or reporter thinks otherwise please reopen it.

Note You need to log in before you can comment on or make changes to this bug.