Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 05-30-2018, 05:47 PM   #1
Tex2002ans
Guru
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 999
Karma: 5860817
Join Date: Jul 2012
Device: Nook
Bug (Crash): Replace File Capitalization

I have attached an EPUB + XHTML file to show the problem.

Problem

If the EPUB has a filename:

Code:
Thisisacover.xhtml (capital T)
and you Add Existing Files:

Code:
thisisacover.xhtml (lowercase T)
Sigil crashes.

Steps to Reproduce

1. Open EPUB.
2. Right Click + Add Existing Files, and add thisisacover.xhtml to EPUB.

Versions Tested

Latest Sigil 0.9.9 on Windows 10 and Mac High Sierra (10.13.4).

* * * * *

Other Replace File Issue

If you use Add Existing Files to replace files that already exist in the ePUB:

If it reaches an image file, you get:

Code:
The multimedia file "filename.jpg" already exists in the book.

OK to replace?

						OK + Cancel
You can press OK to replace, or Cancel to skip.

But with an HTML file you get:

Code:
Unable to load "filename.xhtml"

A file with this name already exists in the book.

						OK
The only choice is to skip.

It would be helpful if:
  • HTML files could also be overwritable
  • There was a "Replace All"
  • There was a "Skip All"

Currently, it is frustrating if you try to replace a lot of files and have to click through them one-by-one.
Attached Files
File Type: epub Sigil.Crash.Bug.-.Capitalization.Filename.epub (1.8 KB, 16 views)
File Type: zip thisisacover.zip (374 Bytes, 16 views)
Tex2002ans is offline   Reply With Quote
Old 05-30-2018, 06:04 PM   #2
JustinThought
Zealot
JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.
 
JustinThought's Avatar
 
Posts: 146
Karma: 3517858
Join Date: May 2016
Location: Monterrey, Mexico
Device: Samsung Tab-3 7"
Oh, my! It certainly does! I quickly ginned up a little practice session, and it did just as you say.

As far as your second scenario, the same occurs with the stylesheet.css, and any external fonts. IMHO, this is more of a protection than a problem.
JustinThought is offline   Reply With Quote
Advert
Old 05-30-2018, 07:15 PM   #3
Tex2002ans
Guru
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 999
Karma: 5860817
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by JustinThought View Post
As far as your second scenario, the same occurs with the stylesheet.css, and any external fonts. IMHO, this is more of a protection than a problem.
The use-case on #2 is: I have an old EPUB + I have a set of template files:
  • cover.xhtml
  • titlepage.xhtml
  • stylesheet.css
  • cover.jpg
  • [...]

I plop template files into the EPUB.

Many times, the old EPUB has the same common filenames.

If there was a conflict, then you should be able to overwrite/skip (just like you currently can with images).

Currently, you have to remember which HTML files were conflicts, then manually delete them out of your book, then readd the template files all over again.

Most of the time, I only notice the title page wasn't overwritten until quality checking, and then it's just easier for me to copy/paste code instead of using the Add Existing Files functionality.

This becomes quite the pain when the amount of replaced files becomes large.
Tex2002ans is offline   Reply With Quote
Old 05-30-2018, 08:11 PM   #4
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,994
Karma: 1922532
Join Date: Nov 2009
Device: many
Travelling but I will create a fix upon my return. The problem is my OSX dev machine uses a case sensitive file system (an advanced option on Macs) and therefore no crash. I will add an external hard drive with a case insensitive file system to recreate the crash.
KevinH is offline   Reply With Quote
Old 05-30-2018, 09:36 PM   #5
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,994
Karma: 1922532
Join Date: Nov 2009
Device: many
Took a look and the file name being added is compared to a list and if it is not contained in the list of existing files, it is added. The filenames.contains() test in the AddExisting code needs to add the Qt:CaseInsensitive flag.

I will push this change to master to prevent any crash.
KevinH is offline   Reply With Quote
Advert
Old 05-31-2018, 08:26 AM   #6
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,994
Karma: 1922532
Join Date: Nov 2009
Device: many
Also, #2 not a big issue if you load template ePub first and only load non-template files from old ePub. This is even easier if you preface your template ePub files with names indicating their source (preface filenames with template or temp or std or ...).

Replacing multiple possibly linked in html can result in lost footnotes, orphan images, orphan multi-media. Using global rename on the old ePub in Sigil before merging should also work.
KevinH is offline   Reply With Quote
Old 05-31-2018, 09:14 AM   #7
JustinThought
Zealot
JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.
 
JustinThought's Avatar
 
Posts: 146
Karma: 3517858
Join Date: May 2016
Location: Monterrey, Mexico
Device: Samsung Tab-3 7"
Quote:
Originally Posted by Tex2002ans View Post
The use-case on #2 is: I have an old EPUB + I have a set of template files:
  • cover.xhtml
  • titlepage.xhtml
  • stylesheet.css
  • cover.jpg
  • [...]

I plop template files into the EPUB.

Many times, the old EPUB has the same common filenames.

If there was a conflict, then you should be able to overwrite/skip (just like you currently can with images).

Currently, you have to remember which HTML files were conflicts, then manually delete them out of your book, then readd the template files all over again.

Most of the time, I only notice the title page wasn't overwritten until quality checking, and then it's just easier for me to copy/paste code instead of using the Add Existing Files functionality.

This becomes quite the pain when the amount of replaced files becomes large.
I understand that. I do basically the same procedure, but I think the difference is the process we each use to create the final e-pub.

I have a--probably irrational--aversion to adding garbage code to my epub, so I create the new book basically from scratch, pulling in my template pages; then, from the original e-pub, I copy/paste only the body text into my template page, making sure not to include anything from above the <body> element. Also, normally I only need to copy from/to one page, as I have merged all the actual text into one file after placing a Sigil chapter break where I'm going to want a separation.

Kinda getting off topic here, though. This maybe would be more appropriate in the workshop forum. But maybe this'll help you avoid some of those issues.

Meanwhile, I notice that Kevin has jumped on the real issue in his normal prompt fashion, so thanks for that, K! Some of the weirdest issues crop up from supporting software on such wildly divergent platforms!
JustinThought is offline   Reply With Quote
Old 05-31-2018, 01:32 PM   #8
Tex2002ans
Guru
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 999
Karma: 5860817
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by KevinH View Post
I will push this change to master to prevent any crash.
Can't wait!

Thanks for hunting down the bug and the quick fix.

I wonder if there are any other related case-sensitive bugs lurking in there?

What if an external program created an EPUB that gets loaded into Sigil, and it has both Copyright.xhtml + copyright.xhtml?

I forget, do the EPUB specs specify filenames being case-sensitive?

Quote:
Originally Posted by JustinThought View Post
Kinda getting off topic here, though. This maybe would be more appropriate in the workshop forum. But maybe this'll help you avoid some of those issues.
This is also why I like discussing different workflows. We all have weird little quirks or ways we use the program that wasn't originally intended.

But it's how we all get better at making books and make Sigil better overall.

I'm pretty excited because I recently brought a completely new Sigil user aboard. And she's looking at the program with completely fresh eyes.

When she caused Sigil to crash because of this capitalization bug, I was thinking: "Eh? It's been stable for so long. What did you do wrong?"

Sometimes when we've been using the programs for so long, we get used to doing it way A or using workarounds XYZ, and become completely blind to way B.

Quote:
Originally Posted by KevinH View Post
Replacing multiple possibly linked in html can result in lost footnotes, orphan images, orphan multi-media. Using global rename on the old ePub in Sigil before merging should also work.
But that should be up to the user.

I imagine it being like a Save As prompt:

You get a popup: "That filename already exists. Are you sure you want to overwrite?" Yes.

Where the current functionality is like: "That filename already exists." And the only choice is to say "Yes, I know. Yes, I know" over and over and over again until it goes away.

Global Rename is also not the best of solutions. Imagine a book full of filenames like this (HTML articles pulled from a site):

- titlepage.html
- copyright.html
- The Guatemalan Economic Miracle and the Man Who Helped It Happen.html
- Adam Heydel, A Mises Student From Poland.html
- A Chinese Gentleman and the Conscience of a Generation.html
- [...]

They are already organized in a certain chapter order in the current EPUB.

Case A

You are trying to replace with alternate versions.

If you were able to just Add Existing + be able to overwrite, this would be no problem. And the chapter order stays completely in tact.

(You could also Skip All and retain current functionality.)

Case B (KevinH)

If you mass rename the files in the current EPUB, you completely lose the information of the filenames:

- titlepage.html
- copyright.html
- Chapter01.html
- Chapter02.html
- Chapter03.html

(or you can manually rename each file individually to TRY to keep a similar name [appending "-2" to the end]. The more files there are, the more time this takes.)

Now when you add the new files:

- titlepage.html
- copyright.html
- Chapter01.html
- Chapter02.html
- Chapter03.html
- A Chinese Gentleman and the Conscience of a Generation.html
- Adam Heydel, A Mises Student From Poland.html
- The Guatemalan Economic Miracle and the Man Who Helped It Happen.html

Now you have to drag/drop the new chapters into their old positions, and/or figure out "Chapter02.html" <-> "Adam Heydel, A Mises Student From Poland.html". Then delete the "Chapter02.html" file.

The more files there are, the more of a pain point this becomes.

Case C (JustinThought)

New EPUB. Insert new files.

I sometimes do this too, but the biggest disadvantage is you lose the order of the chapters.

When you add in files, it inserts them all alphabetically, so you might get something like this:

- A Chinese Gentleman and the Conscience of a Generation.html
- Adam Heydel, A Mises Student From Poland.html
- copyright.html
- The Guatemalan Economic Miracle and the Man Who Helped It Happen.html
- titlepage.html
- [...]

Now you have to manually move the chapters around again.

Case D/E

I know I know, this is getting in the weeds, but there are two other potential workarounds:
  • Just open up the EPUB as a ZIP and shove the new files in.
    • I've been known to do this sometimes. But as a non-technical/new-to-Sigil user? There's no way you want them doing this.
  • Create new EPUB, shove all new files in, copy/paste old content.opf into new content.opf. Hope everything goes according to plan. :P

ORRRRRRRRRRRRRRRR we could just go with the genius that is Case A.

Last edited by Tex2002ans; 05-31-2018 at 01:35 PM.
Tex2002ans is offline   Reply With Quote
Old 06-03-2018, 11:20 PM   #9
JustinThought
Zealot
JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.JustinThought ought to be getting tired of karma fortunes by now.
 
JustinThought's Avatar
 
Posts: 146
Karma: 3517858
Join Date: May 2016
Location: Monterrey, Mexico
Device: Samsung Tab-3 7"
Quote:
Originally Posted by Tex2002ans View Post
Can't wait!

Thanks for hunting down the bug and the quick fix.

//snip!//


This is also why I like discussing different workflows. We all have weird little quirks or ways we use the program that wasn't originally intended.

But it's how we all get better at making books and make Sigil better overall.

//snip!//
Oh, yeah, I'm with you all the way on that! That's the main reason I come here almost daily, is because I'm constantly open to reading how others make their work look better, or how to get along better with Sigil. But I'm always fearful of running afoul of a mod who might purse their lips and politely inform me that I've strayed outside the bounds of the topic. I'm a visitor here, so I try to always remove my shoes before entering.
JustinThought is offline   Reply With Quote
Old 06-04-2018, 10:39 AM   #10
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,994
Karma: 1922532
Join Date: Nov 2009
Device: many
Just pushed fix for crash to master. I will not add the capability to replace single or multiple existing html files at once due to issues with renaming when not an exact match but only a match due to case insensitive filesystems. Renaming even one of a set will/can break links to other html files, toc, etc, etc,

So the solution to wanting anything else is to:

1. keep a template epub with your template files in which all filenames in the template have a unique prefix.

Or

2. load epub to be merged first and rename conflicting files so that Sigil can properly handle updating and correcting all links before merging into first epub.

3. write an edit plugin that groks your template system and have it load the files and fix any broken links


BTW, this bug may still cause issues with similarly6 named multimedia or images as I do not yet have a case insensitive filesystem to check with (yet). My focus was on preventing the initial crash.
KevinH is offline   Reply With Quote
Old 06-04-2018, 11:34 AM   #11
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,994
Karma: 1922532
Join Date: Nov 2009
Device: many
BTW, just for the record uri's and url's have case insensitive schemes and host names but navigation info after that is recommended to be case sensitive.

Ebook readers and ebook reading software may decide to use either case-sensitive or case-insenstive file systems and there is no way for an epub to know which type of device it is stored on when opened.

Therefore any use of just upper or lower case or a mix of cases to distinguish between files names in an epub is a big mistake on the epub developer's part, as the epub's opf uri and all links are supposed to be case-sensitive.

So I can not just "replace" a "myimage.jpg" with "MyImage.jpg" as the opf manifest url will be incorrect, and img tag urls will be incorrect, etc. This is true on a case-senstiive filesystem as well as a case-insensitive filesystem since the uri's after the host are supposed to be case sensitive.

So although I prevented the reported crash with my last fix, trying to replace an myimage.jpg with a MyImage.jpg will fail in all cases.

The problem only gets worse with buik replacement of mixed case file names.

So again, the best way to handle this situation is to fix filenames inside Sigil before trying to merge two epubs as this is the only way to assure links/uris are properly updated.

Last edited by KevinH; 06-04-2018 at 12:34 PM.
KevinH is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug? No --search-replace processing in Windows TechnoCat Conversion 3 06-12-2017 11:28 AM
Open Video File Crash BetterRed Sigil 41 04-23-2016 08:21 PM
find replace bug? cybmole Sigil 14 11-07-2012 01:17 AM
Search and Replace - possible bug? PL_kolek Conversion 2 11-01-2012 06:56 AM
Find/Replace bug? bfollowell Sigil 14 05-19-2012 01:14 PM


All times are GMT -4. The time now is 03:13 AM.


MobileRead.com is a privately owned, operated and funded community.