wrong ebub filename created after conversion

Bug #661714 reported by Stano Sitar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ebook-tools (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: epub-utils

I have used lit2epub to convert following file ~/books/bolito.lit

$ lit2epub ~/books/bolito.lit

the resulting file is called ~/books/b.epubo.lit

It looks like there is slight omission in file /usr/bin/lit2epub on line 28

Lines 27 - 31 are following
if [ "x$2" = "x" ]; then
    EPUB=$(echo $1 | sed -e 's/.lit/.epub/')
else
    EPUB=$2
fi

Command
echo $1 | sed -e 's/.lit/.epub/'
replaces the first occurrence of 'AnyCaracterRepresentedByDot' followed by 'lit'
so, instead of replacig literal string '.lit' it replaces 'olit'

One of solutions might be
echo $1 | sed -e 's/[.]lit/.epub/'
making dot '.' a literal dot
This solution isn't perfect, because while it would correctly rename 'bolito.lit' to 'bolito.epub',
it will still fail to rename 'bolito(.lit)(ver2.0).lit', making it 'bolito(.epub)(ver2.0).lit', which is not what user expects ;-)

Perhaps a better solution would be
echo $1 | sed -e 's/[.]lit$/.epub/'
the dollar character after [.]lit is an anchor metacharacter that represents the end of the string.

Sorry for not submitting proper diff with suggested change, but I have never used diff, so this is more foolproof.

Thank you guys for great work!

Revision history for this message
Pino Toscano (pinotree) wrote :

This is fixed with ebook-tools >= 0.2.0, whose first version in Debian is 0.2.1-1.
Can you please close this bug?

Stano Sitar (sitarovci)
Changed in ebook-tools (Ubuntu):
status: New → Fix Released
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.