Opened 9 years ago

Closed 9 years ago

#546 closed defect (fixed)

logging under perl 5.10 fails

Reported by: mortonda@… Owned by: mortonda@…
Priority: highest Milestone: 1.0.3
Component: amavisd-maia Version: 1.0.2
Severity: blocker Keywords:
Cc:

Description

Gary V and others reported that amavisd-maia under perl 5.10 would log once and then fail. I've reproduced it under Ubuntu 10.4 beta.

Change History (5)

comment:1 Changed 9 years ago by mortonda@…

  • Owner changed from rjl to mortonda@…
  • Status changed from new to accepted

I traced it down to line 5761 in amavisd-maia,

my(@tokens) = $$str_ref =~ /\G \# | \[\?? | [\]|] | % \#? . | \\ [^0-7] |
                          \\ [0-7]{1,3} | [^\[\]\\|%\n#]+ | [^\n]+? | \n /gcsx;

The second time, @tokens is empty.

Joshua Small wrote in with a helpful hint:

It's not by chance the string getting upgraded to UTF-8 somewhere after the functions first call? Refer here: http://www.perlmonks.org/?node_id=672542

Adding this before that call mitigates the problem:

   $$str_ref = Encode::decode("iso-8859-1", $$str_ref);

But is this the right way to fix the problem?

comment:2 Changed 9 years ago by mortonda@…

I attempted to do the decode in do_log() but it didn't work. Apparently the encoding takes place between do_log and expand somehow. That doesn't make sense because do_log calls expand. Does encoding apply at a module level somehow?

comment:3 Changed 9 years ago by mortonda@…

possible solution in [1478]

comment:4 Changed 9 years ago by mortonda@…

  • Resolution set to fixed
  • Status changed from accepted to testing

better solution suggested by Mark Martinec in [1479]

comment:5 Changed 9 years ago by mortonda@…

  • Status changed from testing to closed

all reports indicate this works

Note: See TracTickets for help on using tickets.