Bug 560362 - Dangerous "rm -fr" and poorly tested makewhatis
Summary: Dangerous "rm -fr" and poorly tested makewhatis
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: man
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-31 08:58 UTC by JW
Modified: 2010-02-02 20:42 UTC (History)
1 user (show)

Fixed In Version: 1.6f-25.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-02-02 20:42:21 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description JW 2010-01-31 08:58:31 UTC
Description of problem:
makewhatis contains this gem:
>
> trap "rm -rf $TMPFILEDIR; exit 255" 1 2 3 15
>
But nowhere is the variable TMPFILEDIR defined.

That means that should somebody for some reason has a TMPFILEDIR=/ defined in their environment then they might lose their entire filesystem!  Or if for some unrelated purpose they have a TMPFILEDIR=/tmp in their environment then they might lose all of /tmp!

And makewhatis runs as root! How does this sort of sloppy coding make its way into "production" code?

Version-Release number of selected component (if applicable):
man-1.6f-22

How reproducible:
Always

Steps to Reproduce:
1. vi /usr/sbin/makewhatis
2. 82G
  
Actual results:
See above

Expected results:
That line should be deleted.

Additional info:
But wait ... there is more.

It is pointless doing a "rm -fr" on $TMPFILE because it is a file not a directory.  It isn't safe practice to go around using "rm -fr" everywhere when a simple "rm -f" is correct.

Also, makewhatis should be re-written in perl because of that horrible, and not very accurate, awk coding (I have already re-written it if you want a copy).

Comment 1 Fedora Update System 2010-02-01 10:51:29 UTC
man-1.6f-25.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/man-1.6f-25.fc12

Comment 2 Ivana Varekova 2010-02-01 10:53:12 UTC
Thanks for the report.
The makewhatis script really deserves rewriting so will be done soon.
Your version is welcomed.

Comment 3 Fedora Update System 2010-02-02 01:13:37 UTC
man-1.6f-25.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update man'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-1329

Comment 4 Fedora Update System 2010-02-02 20:42:16 UTC
man-1.6f-25.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.


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