Bug 427335

Summary: Bug patch #44798 replaces "dangerous" code with "malfunctioning" code
Product: [Fedora] Fedora Reporter: JW <ohtmvyyn>
Component: mailxAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-04 10:09:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 44798    

Description JW 2008-01-03 07:48:01 UTC
Description of problem:
Patch mailx-8.1.1-bug44798.patch which was accepted without testing in 2004
turned working code into malfunctioning code. But at least the compiler warning
about "dangerous" code disappeared!

Version-Release number of selected component (if applicable):
mailx-8.1.1-46

How reproducible:
Always

Steps to Reproduce:
1. read mailx-8.1.1-bug44798.patch
2.
3.
  
Actual results:
mail file not correctly edited

Expected results:
mail file should be correctly edited


Additional info:
The patch introduced the following:
     tempfd = mkstemp(tempname);
     obuf = Fopen(tempname, "w")
but the Fopen will always fail because mkstemp() just created the file!
So remainder of edstop() function never executes.

Obviously the patch should have replaced Fopen(tempname,..) with Fdopen(tempfd,...).

It has taken 3 years for anybody to detect this glaring error in this obviously
untested patch. That should be worth something. At least the compiler doesn't
generate error message about possibly "dangerous" code any more. Pity it doesn't
emit error messages about possible "malfunctioning" code.

Comment 1 Ivana Varekova 2008-01-04 10:09:51 UTC
Thanks for your bug report. Fopen(tempname,..) command is right there (see man
3p fopen) problems are: open file descriptor tempfd which is not closed here and
mkstemp command outuput is not tested here - fixed in mailx-8.1.1-47.fc9.