Possible 5.5 regression - error in template

Bug #1906063 reported by =anm=
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Charles Haley

Bug Description

I have a custom column, with template shown below.
It's working fine in 5.4.2, but in 5.5 (and 5.6) there is suddenly a lot of errors instead of correct values.
As there were no changes on my part, nor were any of relevance mentioned in changelog, I presume a regression 5.4.2 -> 5.5.

In 5.5, template value is correctly returned for "/Fanfic/Dead" or "/Fanfic/Complete", but where in 5.4.2 was "/Fanfic", in 5.5 is TEMPLATE ERROR - EXCEPTION: Interpreter: Internal error evaluating an expression.

Windows 7 64b, Calibre portable 5.6.

Template:

program:

# Reader path
path = '';
# Book type: 0 = general, 1 = educational, 2 = FF, 3 = HP
type = 0;

age_dead = 1096;

type = in_list(field('tags'), ',', 'Educational', 1, type);
type = in_list(field('tags'), ',', 'FanFiction', 2, type);
type = in_list(field('tags'), ',', 'HP', 3, type);

path = switch(type,
 0, '/',
 1, '/Educational',
 3, '/HP',
 2, strcat(
  '/Fanfic',
  first_non_empty(
   in_list(field('tags'), ',', 'Completed', '/Complete', ''),
   cmp(
    days_between(today(), field('#ff_updated')),
    age_dead,
    '', '', '/Dead'
   )
  )
 ),
'');

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1906063

Changing the component for this bug.

 assignee cbhaley
 status triaged

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: New → Triaged
Revision history for this message
Charles Haley (cbhaley) wrote :

In this case you can work around the problem by adding ' ' (quote, space, quote) as the last argument to first_non_empty

Changed in calibre:
status: Triaged → Fix Committed
Kovid Goyal (kovid)
Changed in calibre:
status: Fix Committed → Fix Released
Revision history for this message
=anm= (anm-nov) wrote :

Verified, no problem in 5.7.1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.