Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 172781 - [PATCH] mail-filter/dspam dspam.cron is not POSIX compliant
Summary: [PATCH] mail-filter/dspam dspam.cron is not POSIX compliant
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Alin Năstac (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-30 11:35 UTC by Natanael Copa
Modified: 2007-04-16 17:24 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dspam.cron.patch (dspam.cron.patch,6.04 KB, patch)
2007-03-30 11:46 UTC, Natanael Copa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Natanael Copa 2007-03-30 11:35:20 UTC
cron script uses bash which is not necessary and not wanted for embedded.
Its trivial to fix.
Comment 1 Natanael Copa 2007-03-30 11:46:46 UTC
Created attachment 114942 [details, diff]
dspam.cron.patch

Should fix it without changing the behaviour of the script.

I do have a suggestion of a change though. Why not ignore the *.data files when detecting the DSPAM_HOMEDIR and only look for the dspam.conf file?
Replace this:

DSPAM_HOMEDIR="$(getent passwd dspam | awk -F : '{print $6}')"
[[ ! -d "${DSPAM_HOMEDIR}" ]] && exit 2
DSPAM_DATA_FILES=( "${DSPAM_HOMEDIR}"/*.data )
if [ ! -f "${DSPAM_DATA_FILES[0]}" ]
then
        DSPAM_DATA_FILES=( /etc/mail/dspam/*.data )
        if [ -f "${DSPAM_DATA_FILES[0]}" ]
        then
                DSPAM_HOMEDIR="/etc/mail/dspam"
        fi
fi

[[ ! -f "${DSPAM_HOMEDIR}/dspam.conf" ]] && exit 2


whith this:
DSPAM_HOMEDIR="$(getent passwd dspam | awk -F : '{print $6}')"
if [ ! -f "${DSPAM_HOMEDIR}/dspam.conf" -a -f /etc/mail/dspam/dspam.conf ]
then
    DSPAM_HOMEDIR=/etc/mail/dspam
else
    exit 2
fi

my $0.02
My patch don't does this in case of wierd situation where there are dspam.conf in both dirs but no *.data in one of them.
Comment 2 steveb 2007-04-06 13:44:37 UTC
(In reply to comment #1)
> Created an attachment (id=114942) [edit]
> dspam.cron.patch
> 
> Should fix it without changing the behaviour of the script.
> 
> I do have a suggestion of a change though. Why not ignore the *.data files when
> detecting the DSPAM_HOMEDIR and only look for the dspam.conf file?
> Replace this:
> 
> DSPAM_HOMEDIR="$(getent passwd dspam | awk -F : '{print $6}')"
> [[ ! -d "${DSPAM_HOMEDIR}" ]] && exit 2
> DSPAM_DATA_FILES=( "${DSPAM_HOMEDIR}"/*.data )
> if [ ! -f "${DSPAM_DATA_FILES[0]}" ]
> then
>         DSPAM_DATA_FILES=( /etc/mail/dspam/*.data )
>         if [ -f "${DSPAM_DATA_FILES[0]}" ]
>         then
>                 DSPAM_HOMEDIR="/etc/mail/dspam"
>         fi
> fi
> 
> [[ ! -f "${DSPAM_HOMEDIR}/dspam.conf" ]] && exit 2
> 
> 
> whith this:
> DSPAM_HOMEDIR="$(getent passwd dspam | awk -F : '{print $6}')"
> if [ ! -f "${DSPAM_HOMEDIR}/dspam.conf" -a -f /etc/mail/dspam/dspam.conf ]
> then
>     DSPAM_HOMEDIR=/etc/mail/dspam
> else
>     exit 2
> fi
> 
> my $0.02
> My patch don't does this in case of wierd situation where there are dspam.conf
> in both dirs but no *.data in one of them.
> 


You are right about the *.data file. The *.data file only exists on some installations. If you use the hash driver or SQLite, then there is no *.data file.

I have created a new ebuild for DSPAM (Bug ID: #172929) and I will add there a new DSPAM cron script which is hopefully fixing that issue.

Comment 3 Alin Năstac (RETIRED) gentoo-dev 2007-04-16 17:24:05 UTC
The cron script in dspam-3.8.0 will be (hopefully) POSIX compliant (see bug 172929).
If not, please let me know ASAP.