Bug 88531 - dangerous code ''rm''
dangerous code ''rm''
Status: CLOSED RAWHIDE
Product: Red Hat Raw Hide
Classification: Retired
Component: postfix (Show other bugs)
1.0
All Linux
medium Severity high
: ---
: ---
Assigned To: John Dennis
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-10 14:12 EDT by acount closed by user
Modified: 2007-04-18 12:52 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-13 11:11:58 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)

  None (edit)
Description acount closed by user 2003-04-10 14:12:17 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020913

Description of problem:
I don't like this funtion into %preun.
It is very dangerous to use _rm_ for delete queues dirs and  It is possible lost
mail!!!
I would like see that rpm delete them (if it can -> empty dirs) automatically
and not by hand.


-thanks-

# selectively remove the rest of the queue directory structure
# first remove the "queues" (and assume the hash depth is still 2)
queue_directory_remove () {
    for dir in active bounce defer deferred flush incoming; do
        for a in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
            test -d $dir/$a && {
                for b in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
                    test -d $dir/$a/$b && (
                        /bin/rm -f $dir/$a/$b/*
                        /bin/rmdir $dir/$a/$b
                    )
                done
                /bin/rmdir $dir/$a || echo "WARNING: preun - unable to remove
directory %{_var}/spool/postfix/$dir/$a"
            }
        done
        /bin/rmdir $dir || echo "WARNING: preun - unable to remove directory
%{_var}/spool/postfix/$dir"
    done

    # now remove the other directories
    for dir in corrupt maildrop pid private public saved; do
        test -d $dir && {
            /bin/rm -f $dir/*
            /bin/rmdir $dir || echo "WARNING: preun - unable to remove directory
%{_var}/spool/postfix/$dir"
        }
    done
}


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


How reproducible:
Always

Steps to Reproduce:
1.-
2.-
3.-
    

Additional info:
Comment 1 John Dennis 2003-06-12 11:01:11 EDT
I'm not 100% sure I understand what you are asking for. Is your suggestion not
to remove a queue directory if its not empty or are you saying not to remove any
of the queue directories? Why would that be the proper uninstall behavior?

If one is uninstalling postfix as opposed to upgrading then why is the loss of
mail left in queue that will never be accessed again an issue?
Comment 2 acount closed by user 2003-06-12 11:45:57 EDT
>I'm not 100% sure I understand what you are asking for. Is your suggestion not
to remove a queue directory if its not empty or are you saying not to remove any
of the queue directories? Why would that be the proper uninstall behavior?

It means "doesn't delete any file or dir placing *rm* code into a spec file"
rpm knowns how to handle it automatically, this is a job for %files section

>If one is uninstalling postfix as opposed to upgrading then why is the loss of
mail left in queue that will never be accessed again an issue?

because to delete a file/dir, which was *not into the rpm package*, is very bad
rule. And worse if it delete mail!!!


-thanks-
Comment 5 John Dennis 2003-06-12 14:41:48 EDT
I will make the change if you can provide a reasonable argument as to why the
queue directories and their contents are of value after removing postfix from
the machine, any mail that is stuck there will never be processed anyway. Fair
enough?
Comment 6 acount closed by user 2003-06-12 18:27:49 EDT
>I will make the change if you can provide a reasonable argument as to why the

ok I will do:
- to delete files not in possession of a package is a dangerous/bad habit.
- no other rpm package use rm to delete files or dirs, 'rpm' knows how to do it
_automatically_. rpm is *the* package management!! 
People hope that, more or less, all rpm packages will have the same behaviour.
Sendmail doesn't delete _any_ queue files. 
rpm saves in a .rpmsave files that have been modified and it's strange that
postix delete files not in his own

>queue directories and their contents are of value after removing postfix from
the machine, any mail that is stuck there will never be processed anyway. 

rpm automatically deletes empty dirs, if rpm is unable to delete them then
directories contain files out of this package. maybe other package or the admin
had created them.

I hope that maintainer of filesystem spec doesn't use rm }:-)




Comment 7 John Dennis 2003-06-13 11:11:58 EDT
I have removed all the code in the spec file which deletes files and directories
duing an uninstall.
Comment 8 acount closed by user 2003-06-13 20:36:58 EDT
thank you

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