"Cross-contamination" of modified user template functions when copying books between libraries

Bug #1487949 reported by FaceDeer on 2015-08-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charles Haley

Bug Description

This is a somewhat obscure bug that took me a while to notice and nail down the actual circumstances of, but I can now reproduce it quickly and easily in a small test library.

This is an Imgur album showing me reproducing the bug with screenshots of all the significant steps:


The problem appears to be that when copying a book from one library to a second library, the second (destination) library's user-defined template functions somehow "contaminate" the first (source) library with their definitions. This only lasts until you exit and re-enter the first library, but it remains until you do that.

Repro steps:

* Create a library with a custom column that uses a user-defined template function. Add a book to this library.
* Create a second library by copying the structure of the first library, so that the user-defined template function gets duplicated into the second library.
* Back in the first library, make a modification to the user-defined template function and click "replace" to change the definition in that library.
* Copy the book from the first library (with the modified user template function) to the second library (which still has the original user template function)

Note that the custom column in the first library will now start throwing type exceptions when it tries to evaluate the user-defined template function, complaining that there's a duplicate user function with the name of the user template function that was copied and modified.

If you close Calibre and restart the problem goes away, but returns again the next time a book is copied.

This only happens to user template functions that have been modified - user template functions that are identical between the two libraries don't seem to result in this behaviour.

This isn't a critical bug given that it doesn't appear to actually corrupt any persistent data, but it does disrupt my workflow rather badly since I have a library with a number of custom user template functions that I frequently tweak and frequently copy books out of into secondary libraries.

Versions affected: I don't remember the version number I first noticed this start happening in, it took me a while to figure out what was causing my user template functions to "randomly" go wonky like this. It's been happening for at least six months, though, and is still happening with version 2.34.0. It has happened on both Windows 8.1 and Windows 10.

Changing the component for this bug.

 assignee cbhaley
 status triaged

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: New → Triaged
Charles Haley (cbhaley) on 2015-08-24
Changed in calibre:
status: Triaged → Fix Committed

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers