Bug 427335 - Bug patch #44798 replaces "dangerous" code with "malfunctioning" code
Summary: Bug patch #44798 replaces "dangerous" code with "malfunctioning" code
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mailx
Version: 8
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 44798
TreeView+ depends on / blocked
 
Reported: 2008-01-03 07:48 UTC by JW
Modified: 2008-01-04 10:09 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-04 10:09:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


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