Edit Book: Count all + Case sensitive is "broken"

Bug #1263461 reported by arspr on 2013-12-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

A small little bug.

Check that Case sensitive is active. Look for a long sentence (so you will only have one match). Well if you "Count all", you'll get Constant + 1 as the number of matches.

(In a book I have Constant = 65 and in another one 44).

If you unselect Case sensitive, you'll get 1 as expected (or 2, or 3, or 56, or whatever).

Running Portable, (I'm on holidays outside home), v1.16 on W7 64 bit

I cannot replicate this, steps I tried:

1) Open a book, edit some html file inside it, at the bottom of the file
type in xxx XXX
2) Search for xxx (normal mode)
3) Set case sensitive
4) Count all -> 1 match found
5) Turn off case sensitive
6) Count all ->2 matches found
7) Repeat in regex mode -- same results.

The above was tried in both current file and all text files.

Maybe I misunderstood what you are saying? Do yo have some other
settings like wrap changed?

 status invalid

Changed in calibre:
status: New → Invalid
arspr (arspr) wrote :

Don't worry.

Next week when I'm on home or sooner if possible I'll provide a reliable example. This morning I found it in two books in a row. But maybe I did something wrong...

arspr (arspr) wrote :

Fully reproducible again.

More over, I'm nearly sure that the "Constant" is the number of html files inside the book (why?).

I update a screenshot and a simple test book.

arspr (arspr) wrote :

And the screenshot here

Kovid Goyal (kovid) wrote :

I get only 1 for that book,s ee screenshot

arspr (arspr) wrote :


Anything special to test on my side?

(Remember I'm on Portable. I'm on my mother-in-law's Laptop with my whole library and Calibre on an USB stick.)

Kovid Goyal (kovid) wrote :

Not that I can think of, unless you are willing to run from source.
We'll wait and see if someone else reports the issue. It may also be
that something I have changed since the last release had the sideeffect
of fixing this, so try with the next release.

arspr (arspr) wrote :

I'll happily wait till 1.17.

(About running from source: unless there's some kind of detailed instructions somewhere, I'm afraid it's out of my reach. As example I was perfectly capable of building PRS+ for my Sony PRS-650 from source following the instructions posted in the PRS+ page. If Calibre is similar I can give it a try if the trouble persists).

Adding weirdness to the issue: If I search for something that begins with a normal space, the counting issue is not present.

Kovid Goyal (kovid) wrote :

Running calibre from source is very simple, look under setting up a
development environment in the user manual.

arspr (arspr) wrote :

Just tested with 1.17 and the issue is still here.

Therefore, the next step is running from source when I return home... (I'll ask for help if needed).

(The worst thing that can happen is that, when having returned home, I wasn't able to reproduce it, because then it would mean that it is completely dependant on something about the host PC).

arspr (arspr) wrote :

A small update and a question for my future run from source.

I've tested on another laptop with the same portable installation and the issue is still there... (Good "bad" news ;-) )

I've read your instructions on the development environment and they seem pretty straightforward (even for me).

Now the question. When I return home, I'll have my USB portable installation (which also stores a copy of my library) and my main W-64bit installation. After I follow all the steps, (getting the source code and setting the environment variable), does it matter if I launch Calibre from the PC executable or from the USB portable installation? Or is it irrelevant? (I mean, in either case, what Calibre is going to run is the source code itself because of the "order" implied by the environment variable).

OTOH I cannot reproduce https://bugs.launchpad.net/calibre/+bug/1264387 (the Regex one) any more, even in the original laptop... (Patience and step by step).

arspr (arspr) wrote :

Hi Kovid,

Development environment set and running. (A pretty * appears beside the 1.17 version number).

But I need you to guide me about HOW I debug the issue...

Nevertheless I can give you what I think it's a very good hint. My home PC is running Windows Vista 64bit. And now I have two possible Calibres running:
+ My installed one, which is the 64-bit version.
+ My portable one on an USB stick. (Which I suppose is a 32-bit version). (I've switched the Library setting of my portable for the time being, so both Calibres are using the same one, which is my PC one).

Well, either from source or normally running, I CANNOT REPLICATE THE ISSUE ON CALIBRE 64-BIT. But either from source or normally running, IT'S STILL PRESENT ON MY CALIBRE PORTABLE. (Both versions running against the same source code).

arspr (arspr) wrote :

I think I've found the trigger. The issue is present when running Calibre 32-bit. I've also installed 1.17 32-bit and it also suffers the issue.

As a summary:
+ Calibre 1.17. Issue is present.
+ Calibre Portable 1.17. Issue is present.
+ Calibre 1.17 64-bit. Issue is NOT present.

(It doesn't matter if running normally or from source. And always the same source obviously...)

I'm going to post a dedicated thread in Editor subforum in Mobileread in order to ask other people if they can confirm the issue.

Kovid Goyal (kovid) wrote :

It looks like a bug in the 32bit version of the regex library that
calibre uses on windows, probably caused by windows' use of the LP64
pointer model. I'll pass on the bug report when I have a few moments to
generate a simple test case and hopefully it will get fixed.

In the meantime, just use the 64bit version :)

 status new

Changed in calibre:
status: Invalid → New

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

 status fixreleased

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

Other bug subscribers

Remote bug watches

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