Bug 746972

Summary: tftp doesn't return proper value after failure
Product: Red Hat Enterprise Linux 6 Reporter: Aleš Mareček <amarecek>
Component: tftpAssignee: Jan Synacek <jsynacek>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2Keywords: Patch
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-14 08:00:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 836160, 947775    
Attachments:
Description Flags
raw test script
none
the patch fixes return codes
mhlavink: review+
the patch removes empty file when wasn't received from server
mhlavink: review+
raw test script none

Description Aleš Mareček 2011-10-18 13:11:05 UTC
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 16:16:20 UTC
Created attachment 551188 [details]
raw test script

Comment 3 Jiri Skala 2012-01-11 14:38:54 UTC
Created attachment 552135 [details]
the patch fixes return codes

Comment 4 Jiri Skala 2012-01-11 14:40:18 UTC
Created attachment 552136 [details]
the patch removes empty file when wasn't received from server

Comment 8 Aleš Mareček 2012-01-11 16:32:07 UTC
Created attachment 552166 [details]
raw test script

Comment 10 Suzanne Logcher 2012-02-14 23:17:56 UTC
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 Program Management 2012-09-07 05:11:03 UTC
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 08:00:04 UTC
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.