02-12-2018, 05:54 PM | #1 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
Unable to Insert or Split Pages
I am working with an epub 2 document, and if I attempt to split any page at cursor, or even just insert a new blank page, Sigil crashes.
I was using 0.9.7, and upgraded to 0.9.9. No change. I can do this successfully with other documents, but not this one, so I suspect there is a problem with the file. However, Flight Crew says the epub is valid. Any ideas as to what else I can look for? |
02-12-2018, 06:13 PM | #2 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
What platform? Any message that comes with the crash? Sigil 0.9.9 actually has a bug fix to prevent just this bug that was fixed in 0.9.8 so stick with 0.9.9. Some new Windows boxes have the tmp directory default to be automatically emptied and this can cause lots of crashes as Sigil makes heavy use of tmp files.
If it is legal to post the problem epub2, please post it so that authors can try to recreate the issue. |
Advert | |
|
02-12-2018, 06:17 PM | #3 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Also after upgrading to the newest version please use the Sigil About menu to verify the exact version being run.
Another thing to try is saving and renaming your sigil.ini file and let it be recreated to rule out a corrupted settings file. |
02-12-2018, 07:00 PM | #4 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
Platform: Windows 7 64-bit.
Sigil About Menu: Version 0.9.9, Loaded Qt 5.6.2 Problem Details: Problem signature: Problem Event Name: APPCRASH Application Name: Sigil.exe Application Version: 0.9.9.0 Application Timestamp: 5a3c2e1c Fault Module Name: Sigil.exe Fault Module Version: 0.9.9.0 Fault Module Timestamp: 5a3c2e1c Exception Code: c0000005 Exception Offset: 0000000000035e0c OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: d518 Additional Information 2: d518e985c1e133e63c126fef71c422cd Additional Information 3: 3b92 Additional Information 4: 3b928edad88f859fd7b40b3346f09b10 The book is copyrighted, but distributed without DRM. So is it legal to post it for debugging purposes? |
02-12-2018, 07:07 PM | #5 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
I removed the Sigil.ini and let the system create a new one. No difference.
|
Advert | |
|
02-12-2018, 07:40 PM | #6 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No. Without explicit permission of the rights-holder, copyrighted works cannot be uploaded to Mobileread--regardless of its DRM status. What's the title? I'm usually willing to purchase a copy if it's not too terribly high-priced.
|
02-12-2018, 07:42 PM | #7 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
There are four books, as part of the same series, that I just purchased. All of them exhibit the problem.
Looking at the books, what they all have in common is the first file is named "cover.xml" I renamed this file to be "cover.xhtml" and that solved the problem. |
02-12-2018, 08:02 PM | #8 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I can recreate the problem. You're not attempting to split the .xml file, right? Because that should fail with a warning. It seems to only crash when a .xml file is the first file in the Book Browser treeview when splitting.
Thanks. We'll see if we can track it down. In the meantime, the workaround is to rename the .xml file (or temporarily drag it from the first position in the Book Browser treeview). Last edited by DiapDealer; 02-12-2018 at 08:04 PM. |
02-12-2018, 08:24 PM | #9 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
You are correct, I am not attempting to split the xml file.
The error happens if you try to split any file. The error also happens if you try to "Add Blank HTML File", from the context menu on the Text folder. Thanks for replying so quickly. It is no problem to rename the file, so the fix is not urgent. |
02-12-2018, 09:32 PM | #10 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Wow, that is a strange one. I will try to recreate it on my Mac as well and try to get a backtrace from the crash. Thanks for finding and reporting this bug!
|
02-13-2018, 07:31 AM | #11 |
Grand Sorcerer
Posts: 27,546
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
This affects Linux, as well. It crashes any time a Split at Cursor, or Add Blank HTML file is performed when a file with a .xml extension is the first file in the Book Browser's Text container.
Split at Markers gives the "Cannot split since at least one file may not be an HTML file" warning. Which seems a little odd when the .xml file isn't one that's marked for splitting. But it's preferable to a crash. Last edited by DiapDealer; 02-13-2018 at 11:38 AM. |
02-13-2018, 10:04 AM | #12 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Okay I added s new html file and then changed its name to .xml and and moved it to the top.
Then tried to create a new empty html file and it barfed with this backtrace: Code:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.sigil-ebook.Sigil.app 0x000000010fbf3484 Resource::GetEpubVersion() const + 4 1 com.sigil-ebook.Sigil.app 0x000000010fba0b4c Book::CreateEmptyHTMLFile(HTMLResource*) + 44 2 com.sigil-ebook.Sigil.app 0x000000010fed9072 BookBrowser::AddNewHTML() + 98 3 org.qt-project.QtCore 0x000000011398bb4c QMetaObject::activate(QObject*, int, int, void**) + 3020 ... Code:
HTMLResource *Book::CreateNewHTMLFile() { TempFolder tempfolder; QString fullfilepath = tempfolder.GetPath() + "/" + GetFirstUniqueSectionName(); Utility::WriteUnicodeTextFile(PLACEHOLDER_TEXT, fullfilepath); HTMLResource *html_resource = qobject_cast<HTMLResource *>(m_Mainfolder->AddContentFileToFolder(fullfilepath)); SetModified(true); return html_resource; } The problem is then that raw xml files when added to FolderKeeper are not recognized as an html resource and instead is recognized as a misc xml resource since there is no mimetype passed along. Code:
QString Book::GetFirstUniqueSectionName(QString extension) { // If not files just return the default first name QList<HTMLResource *> html_resources = m_Mainfolder->GetResourceTypeList<HTMLResource>(true); if (html_resources.count() < 1) { return FIRST_SECTION_NAME; } // Get the extension of the current file QString first_html_file = html_resources.first()->Filename(); QString first_html_filename = first_html_file.left(first_html_file.lastIndexOf(".")); if (extension.isEmpty()) { extension = first_html_file.right(first_html_file.length() - first_html_file.lastIndexOf(".")); // If no extension use the default first name extension if (extension.isEmpty()) { extension = FIRST_SECTION_NAME; extension = extension.right(extension.length() - extension.lastIndexOf(".")); } } QString filename = FIRST_SECTION_PREFIX + extension; return m_Mainfolder->GetUniqueFilenameVersion(filename); } So we need to do a number of things in Book.cpp and FolderKeeper.cpp: 1. Teach it to treat files with pure xml extensions to default to xhtml files unless a specific mimetype is passed in that would indicate some other xml file. 2. When creating new html resources/files, we should pass in the correct mimetype so that AddContentToFolder in FolderKeeper actually knows we want a xhtml file regardless of the extension. This may happen in a lot of places in the code base where empty xhtml files are created (such as the nav, toc.xhtml, etc) so we should search the code to handle that case and not rely on the file extension since it can be flakey. I am away from my computer almost all day today, so I will try to fix this tomrrow evening in master. I think the same problem happens when splitting files because they start with a new blank xhtml file also. |
02-13-2018, 10:01 PM | #13 |
Connoisseur
Posts: 55
Karma: 847
Join Date: Sep 2007
Device: Kobo H2O, Libre 2
|
I'm curious...
Are there advantages to using different file types in an epub? Why not, for example, just make every file .xhtml? Perhaps there needs to be a system option for the user to select the file type for newly created files. In the case of split file, I would assume that the new file would be the same type as the file being split. |
02-13-2018, 10:42 PM | #14 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
No in fact using different file types/extensions for text in the same epub is a huge pain in the ass. The epub3 standard recommends using only one: .xhtml. For epub2 you see both .xhtml and .html but the .html is a misnomer since proper xhtml is required.
Another problem is xhtml is xml but xml need not be xhtml. Any ebook author that tries to write chapters with mixed extensions is really just asking for trouble, imho. I had never seen a book with a cover.xml followed by lots of .html or .xhtml files before. We can handle it but it really is not a good design approach for any ebook author. Last edited by KevinH; 02-13-2018 at 10:54 PM. |
02-14-2018, 03:36 PM | #15 |
Sigil Developer
Posts: 7,630
Karma: 5433388
Join Date: Nov 2009
Device: many
|
This is now fixed with the latest commit to Sigil master.
Thank you for your bug report which helped make Sigil better! KevinH |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Classic Split PDF pages into smaller pages (images into tiles) | Astro | Barnes & Noble NOOK | 4 | 06-12-2020 10:56 AM |
Tool to split up double pages | fodiator | iRex | 27 | 03-21-2012 09:03 AM |
Plugin to split pages down the middle | metafractal | Plugins | 5 | 12-12-2010 10:21 AM |
How do I split two pages into one? | Christopher888 | 4 | 11-20-2010 02:21 PM | |
Split pdf pages down the middle | Blue_Alien | Calibre | 3 | 08-15-2010 11:12 PM |