# maildroprc not correctly interpreted after update

## hubsif

Hi there,

I upgraded maildrop on my server (I think from 2.0.2 to 2.0.4) and now maildrop doesn't "interpret" my maildroprc correctly anymore.

this is my maildroprc:

```

# Global maildrop filter file

LOGNAME=tolower("$LOGNAME")

RECIPIENT=tolower("$1")

USER=tolower("$2")

HOST=tolower("$3")

SENDER="$4"

DEFAULT="/var/spool/mail/virtual/$HOST/$USER/"

`test -f /var/spool/mail/virtual/$HOST/$USER/mailfilter`

if ( $RETURNCODE == 0 )

{

  include "/var/spool/mail/virtual/$HOST/$USER/mailfilter"

}

to $DEFAULT;

```

This is the output of a maildrop test:

```

# maildrop -V 4 -d test@domain.de test@domain.de test domain.de sender@domain2.de < testmail

maildrop: authlib: groupid=12

maildrop: authlib: userid=1000

maildrop: authlib: logname=test@domain.de, home=/var/mail/virtual, mail=/var/mail/virtual/domain.de/test

maildrop: Changing to /var/mail/virtual

Message start at 0 bytes, envelope sender=test@domain.de

/etc/maildroprc(2): LOGNAME=""

/etc/maildroprc(3): RECIPIENT=""

/etc/maildroprc(4): USER=""

/etc/maildroprc(5): HOST=""

/etc/maildroprc(6): SENDER="sender@domain2.de"

/etc/maildroprc(7): DEFAULT="/var/spool/mail/virtual///"

maildrop: Filtering through `test -f /var/spool/mail/virtual/$HOST/$USER/mailfilter`

/etc/maildroprc(10): Evaluating IF condition.

/etc/maildroprc(10): IF evaluated, result=0

```

When I change in maildroprc e.g. "USER=tolower("$2")" to "USER=$2", the output is "/etc/maildroprc(4): USER="test"", which means "tolower()" does not work.

And the "maildrop: Filtering through" line shows that $HOST and $USER are not substituted (should be empty at least).

Can anyone help?

Thank you!

hubsif.

----------

## andreas_st

I had the same problem today after upgrading to maildrop-2.2.0. After a lot of testing and searching I found that this seems to be a compiler error.

The problem was gone after I changed cflag "-O2" in /etc/make.conf to "-O1" and recompiled mail-filter/maildrop.

See here for reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536253

----------

## hubsif

Andreas,

I did what you suggested and changed -O2 to -O1 et voilà: it worked!

Seems like you're a better googler than I   :Wink: 

Thank you very much!

hubsif.

----------

## andreas_st

Of course I don't want my complete system compiled with -O1. So I was looking for an easy method to set different CFLAGS for single packages. I found it documented here: http://usrportage.de/archives/898-Specific-env-vars-for-Gentoo-packages.html

It just needs the file /etc/portage/bashrc with this content:

```
for conf in ${PN} ${PN}-${PV} ${PN}-${PV}-${PR}; do

        env=/etc/portage/env/${CATEGORY}/${conf}.env

        if [[ -f  ${env} ]]; then

                einfo "Reading specific environment from ${env}"

                . ${env}

        fi

done
```

And then I can use /etc/portage/env/mail-filter/maildrop.env to set special environment variables for mail-filter/maildrop

```
CFLAGS="-O1 -mtune=native -pipe"

CXXFLAGS="${CFLAGS}"
```

So I can ensure that future upgrades of maildrop are compiled with -O1 and all other packages are compiled with the standard CFLAGS from /etc/make.conf. Of course in the end this should be set in the ebuild but with the special environment in /etc/portage/env I don't need to wait for that change.

----------

