You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by me...@gmx.net on 2005/04/08 18:28:25 UTC

Applying a patch to Util.pm

In SpamAssassin version 3.0.2 running on Perl version 5.8.4 I have tried to 
apply the patch suggested in
http://bugzilla.spamassassin.org/show_bug.cgi?id=4191
but it does not work as expected:
> The fix is trival.  Apply the following patch to lib/SpamAssassin/Util.pm:
> 
> --- Util.pm.orig        Mon Mar 14 10:38:59 2005
> +++ Util.pm     Mon Mar 14 10:39:12 2005
> @@ -788,7 +788,7 @@
>    $uri =~ s#^[a-z]+:/{0,2}##gsi;       # drop the protocol
>    $uri =~ s,^[^/]*\@,,gs;              # username/passwd
>    $uri =~ s,[/\?\&].*$,,gs;            # path/cgi params
> -  $uri =~ s,:\d+$,,gs;                 # port
> +  $uri =~ s,:\d*$,,gs;                 # port
> 
>    return if $uri =~ /\%/;         # skip undecoded URIs.
>    # we'll see the decoded version as well

I copied that from my browser to a file and ran
patch -p0 < /root/Util.pm.patch in
/usr/share/perl5/Mail/SpamAssassin.
Error:
patching file Util.pm
Hunk #1 FAILED at 788.
1 out of 1 hunk FAILED -- saving rejects to file Util.pm.rej

# cat Util.pm.rej 
***************
*** 788,794 ****
    $uri =~ s#^[a-z]+:/{0,2}##gsi;       # drop the protocol
    $uri =~ s,^[^/]*\@,,gs;              # username/passwd
    $uri =~ s,[/\?\&].*$,,gs;            # path/cgi params
-   $uri =~ s,:\d+$,,gs;                 # port
  
    return if $uri =~ /\%/;         # skip undecoded URIs.
    # we'll see the decoded version as well
--- 788,794 ----
    $uri =~ s#^[a-z]+:/{0,2}##gsi;       # drop the protocol
    $uri =~ s,^[^/]*\@,,gs;              # username/passwd
    $uri =~ s,[/\?\&].*$,,gs;            # path/cgi params
+   $uri =~ s,:\d*$,,gs;                 # port
  
    return if $uri =~ /\%/;         # skip undecoded URIs.
    # we'll see the decoded version as well

How exactly should i apply the patch?


Re: Applying a patch to Util.pm

Posted by me...@gmx.net.
In an older episode (Friday 08 April 2005 20:23), Stuart Johnston wrote:
> Theo Van Dinter wrote:
> > On Fri, Apr 08, 2005 at 06:28:25PM +0200, mewolf1@gmx.net wrote:
> > 
> >>>-  $uri =~ s,:\d+$,,gs;                 # port
> >>>+  $uri =~ s,:\d*$,,gs;                 # port
> >>
> >>How exactly should i apply the patch?
> > 
> > 
> > Since it's a 1 character change, you can just edit the file manually. :)

Good point, thanks!
Done.

> > 
> 
> While you're in there, you might want to change the line above it as 
> well (if you haven't already).  Bug #4213
> 
> -  $uri =~ s,[/\?\&].*$,,gs;            # path/cgi params
> +  $uri =~ s,[/\?].*$,,gs;              # path/cgi params

Done. Thanks to you, too.


Re: Applying a patch to Util.pm

Posted by Stuart Johnston <st...@ebby.com>.
Theo Van Dinter wrote:
> On Fri, Apr 08, 2005 at 06:28:25PM +0200, mewolf1@gmx.net wrote:
> 
>>>-  $uri =~ s,:\d+$,,gs;                 # port
>>>+  $uri =~ s,:\d*$,,gs;                 # port
>>
>>How exactly should i apply the patch?
> 
> 
> Since it's a 1 character change, you can just edit the file manually. :)
> 

While you're in there, you might want to change the line above it as 
well (if you haven't already).  Bug #4213

-  $uri =~ s,[/\?\&].*$,,gs;            # path/cgi params
+  $uri =~ s,[/\?].*$,,gs;              # path/cgi params

Re: Applying a patch to Util.pm

Posted by Theo Van Dinter <fe...@kluge.net>.
On Fri, Apr 08, 2005 at 06:28:25PM +0200, mewolf1@gmx.net wrote:
> > -  $uri =~ s,:\d+$,,gs;                 # port
> > +  $uri =~ s,:\d*$,,gs;                 # port
> 
> How exactly should i apply the patch?

Since it's a 1 character change, you can just edit the file manually. :)

-- 
Randomly Generated Tagline:
bpi: Gambling term, as in, "You bet your bpi."