Skip to Content.
Sympa Menu

devel - Re: [sympa-dev] Re: Bug ou feature?

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Dominique ROUSSEAU <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-dev] Re: Bug ou feature?
  • Date: Mon, 18 Oct 1999 09:05:40 +0200

On Mon, Oct 18, 1999 at 08:31:37AM +0200, Aumont - Comite Reseaux des
Universites wrote:
> Christian perrier reports the following bug :
>
> When defining editor email, spaces at the end of the line are part
> of the email editor attribut so all mails coming from this editor
> are forward to editors where it should be sent to subscribers.
>
> This bug is part of List::load_admin_file :
>
> the original buggy code :
> $* = 1; $/ = '';
> ...
> $user->{'email'} = $1 if (/^\s*email\s+(.+)\s*$/o);
>
>
> A successful patch I test (but don't understand):
>
> $* = 1; $/ = '';
> ...
> $user->{'email'} = $1 if (/^\s*email\s+(.+)\s*$/o);
> $user->{'email'} =~ s/\s*$// ;
>
> Is there any perl guru who can explain that ?

I think it's the greedy aspect of regexes.
A space at end of the string can go in th (.+) part on in the \s* part
and in such cases, there are some strange behaviors than happen...

It should work with (\S+) instead of (.+) [an email adress shoudl'nt
have spaces into it, right ?]

Dom

PS: for more information about the greediness or REs, look in the perlre
man page and earch for greedy

--
Dominique Rousseau <address@concealed>
Neuronnexion - http://www.neuronnexion.com



Archive powered by MHonArc 2.6.19+.

Top of Page