Mailing List Archive

Exim 4.04: ${sg ...} in command
The following transport

| list_subscribe_transport:
| driver = pipe
| user = MAILMAN_USER
| group = MAILMAN_GROUP
| current_directory = MAILMAN_HOME
| home_directory = MAILMAN_HOME
| log_output
| command = /usr/local/sbin/ezmlm-to-mailman \
| ${sg{$local_part}{-(?:un)?subscribe\$}{}} \
| $domain \
| ${sg{$local_part}{^.*-}{}}

is invoked with "authors-subscribe" for $local_part.

Enabling debugging reveals that

| direct command:
| argv[0] = /usr/local/sbin/ezmlm-to-mailman
| argv[1] = ${sg{$local_part}{-(?:un)?subscribe\$}{}}
| argv[2] = $domain
| argv[3] = ${sg{$local_part}{^.*-}{}}

is expanded to:

| direct command after expansion:
| argv[0] = /usr/local/sbin/ezmlm-to-mailman
| argv[1] = authors
| argv[2] = lists.cert.uni-stuttgart.de
| argv[3] = authors

while I would have expected:

| direct command after expansion:
| argv[0] = /usr/local/sbin/ezmlm-to-mailman
| argv[1] = authors
| argv[2] = lists.cert.uni-stuttgart.de
| argv[3] = subscribe

Is my expectation wrong? If yes, why?

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
On Sat, May 25, 2002 at 11:04:58PM +0200, Florian Weimer wrote:
> The following transport
>
> | list_subscribe_transport:
> | driver = pipe
> | user = MAILMAN_USER
> | group = MAILMAN_GROUP
> | current_directory = MAILMAN_HOME
> | home_directory = MAILMAN_HOME
> | log_output
> | command = /usr/local/sbin/ezmlm-to-mailman \
> | ${sg{$local_part}{-(?:un)?subscribe\$}{}} \
> | $domain \
> | ${sg{$local_part}{^.*-}{}}
>
> is invoked with "authors-subscribe" for $local_part.
>
> Enabling debugging reveals that
>
> | direct command:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = ${sg{$local_part}{-(?:un)?subscribe\$}{}}
> | argv[2] = $domain
> | argv[3] = ${sg{$local_part}{^.*-}{}}
>
> is expanded to:
>
> | direct command after expansion:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = authors
> | argv[2] = lists.cert.uni-stuttgart.de
> | argv[3] = authors
>
> while I would have expected:
>
> | direct command after expansion:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = authors
> | argv[2] = lists.cert.uni-stuttgart.de
> | argv[3] = subscribe
>
> Is my expectation wrong? If yes, why?

I think i understand that's happening.

Your first search-replace modifies tha $local_part variable (unfortunately)
so that when you work with it again, its value is already "subscribe"
You can verify this by replacing
${sg{$local_part}{^.*-}{}}
with just $local_part

I'm afraid I don't have a solution to your problem though, you'd somehow
have to make a copy of local_part before you start applying a substitution
to it.

Marc
--
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking

Home page: http://marc.merlins.org/ | Finger marc_f@merlins.org for PGP key
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
On Sun, 26 May 2002, Marc MERLIN wrote:

>
> I think i understand that's happening.
>
> Your first search-replace modifies tha $local_part variable (unfortunately)
> so that when you work with it again, its value is already "subscribe"
> You can verify this by replacing
> ${sg{$local_part}{^.*-}{}}
> with just $local_part


Yikes! that seems counter intuituve - I wouldnt expect sg to actualy
modify its input, only take the input and give its result.

He didnt show his director - perhaps it isnt really passing the
-subscribe as part of local part. $local_part_suffix, perhaps?
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
Marc MERLIN <marc_news@vasoftware.com> writes:

> Your first search-replace modifies tha $local_part variable (unfortunately)

Does ${sg ...} really copy this part of Perl's s/// operator?

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
"Dave C." <djc@microwave.com> writes:

> He didnt show his director - perhaps it isnt really passing the
> -subscribe as part of local part. $local_part_suffix, perhaps?

Indeed this was the cause. I didn't expect that the
suffix is automatically stripped. Thanks for this clarification.

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
On Mon, May 27, 2002 at 12:46:27PM +0200, Florian Weimer wrote:
> Marc MERLIN <marc_news@vasoftware.com> writes:
>
> > Your first search-replace modifies tha $local_part variable (unfortunately)
>
> Does ${sg ...} really copy this part of Perl's s/// operator?

Sorry, I went on a limb to try and explain your problem. I was heading in
the right direction, but didn't get the right guess :-)

Marc
--
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking

Home page: http://marc.merlins.org/ | Finger marc_f@merlins.org for PGP key
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
On Sat, 25 May 2002, Florian Weimer wrote:

> Enabling debugging reveals that
>
> | direct command:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = ${sg{$local_part}{-(?:un)?subscribe\$}{}}
> | argv[2] = $domain
> | argv[3] = ${sg{$local_part}{^.*-}{}}
>
> is expanded to:
>
> | direct command after expansion:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = authors
> | argv[2] = lists.cert.uni-stuttgart.de
> | argv[3] = authors
>
> while I would have expected:
>
> | direct command after expansion:
> | argv[0] = /usr/local/sbin/ezmlm-to-mailman
> | argv[1] = authors
> | argv[2] = lists.cert.uni-stuttgart.de
> | argv[3] = subscribe
>
> Is my expectation wrong? If yes, why?

Your expectation is correct. However, I cannot reproduce this error. I
get this:

--------> authors-subscribe@my.host <--------
locking /home/ph10/exim4/test/spool/db/retry.lockfile
locked /home/ph10/exim4/test/spool/db/retry.lockfile
opened hints database /home/ph10/exim4/test/spool/db/retry: flags=0
dbfn_read: key=T:authors-subscribe@my.host
no retry record exists
search_tidyup called
changed uid/gid: local delivery to authors-subscribe <authors-subscribe@my.host> transport=list_subscribe_transport
uid=1169 gid=1169
auxiliary group list: <none>
home=/ current=/
set_process_info: 12001 delivering 17FXYU-00037X-00 to authors-subscribe using list_subscribe_transport
list_subscribe_transport transport entered
direct command:
argv[0] = /usr/local/sbin/ezmlm-to-mailman
argv[1] = ${sg{$local_part}{-(?:un)?subscribe\$}{}}
argv[2] = $domain
argv[3] = ${sg{$local_part}{^.*-}{}}
direct command after expansion:
argv[0] = /usr/local/sbin/ezmlm-to-mailman
argv[1] = authors
argv[2] = my.host
argv[3] = subscribe


So the question now becomes, what is different on your host? I copied
your transport exactly, changing only the user and directories.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
Philip Hazel <ph10@cus.cam.ac.uk> writes:

> So the question now becomes, what is different on your host? I copied
> your transport exactly, changing only the user and directories.

I used local_part_suffix without reading the documentation. Sorry
about that.

--
Florian Weimer Weimer@CERT.Uni-Stuttgart.DE
University of Stuttgart http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT +49-711-685-5973/fax +49-711-685-5898
Re: Exim 4.04: ${sg ...} in command [ In reply to ]
On Sun, 26 May 2002, Dave C. wrote:

> > Your first search-replace modifies tha $local_part variable (unfortunately)
> > so that when you work with it again, its value is already "subscribe"
> > You can verify this by replacing
> > ${sg{$local_part}{^.*-}{}}
> > with just $local_part
>
>
> Yikes! that seems counter intuituve - I wouldnt expect sg to actualy
> modify its input, only take the input and give its result.

Correct. It doesn't modify its input.

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.