[sword-devel] using encryption with current osis2mod (r2435 works for me)

Jonathan Marsden jmarsden at fastmail.fm
Sun Aug 23 19:28:55 MST 2009


Peter von Kaehne wrote:

> Ther appears to be a bug with the current osis2mod - using the
> encryption option nothing appears to happen. The results are identical
> with or without key
> 
> I tried revision 2400 and current svn head

It is always a helpful to specify the "steps to reproduce" when
reporting or confirming bugs, so that others can duplicate the issue, or
point out any possible concerns with the process you followed.

osis2mod r2400 from the current Ubuntu packages has this issue here.
However, osis2mod from svn r2435 (head) works as designed for me.

Here is how I tested on Ubuntu 9.04 Jaunty amd64:

I decided to use DM's KJV from
http://www.crosswire.org/~dmsmith/kjv2006/sword/kjvxml.zip as the test
text, since it is publically available and well known.  I created a
little shell script make-kjvfull.sh (enclosed below) which downloads the
kjvxml.zip file if necessary (using wget), and then turns the
kjvfull.xml file from inside it into a SWORD module (in raw .zip file
format).

Once I had created the script, I did:

  export MODULENAME=KJV1
  ./make-kjvfull.sh
  unzip -d ~/.sword/ $MODULENAME.zip
  diatheke -b $MODULENAME -k Jn 3:16

to verify that I have a sane newly created unciphered KJV1 module.
diatheke outputs:

  John 3:16:
  For God so loved the world, that he gave his only begotten Son, that
  whosoever believeth in him should not perish, but have everlasting
  life.

  (KJV1)

Looks good to me.  I ran BibleTime at this point, and verified it
displays fine in there, too.

Next I tried creating an enciphered equivalent KJV2 module:

  export MODULENAME=KJV2
  ./make-kjvfull.sh -c secret
  unzip -d ~/.sword/ $MODULENAME.zip
  diatheke -b $MODULENAME -k Jn 3:16

diatheke is unable to display John 3:16 from this one, outputting the
error message:

  ERROR: corrupt data during decompression.
  John 3:16:
  (KJV2)

Bibletime is similarly unable to work with this module.

Lastly I did

  echo "CipherKey=secret" >>~/.sword/mods.d/kjv2.conf

and then verified that both diatheke and Bibletime can indeed now use
the enciphered KJV2 module, because the unlock key is present in the
kjv2.conf file.

As far as I can see, at least on this platform, SWORD svn head is doing
enciphering as designed.  Could you document your own test process,
retest using a similar procedure to mine, and report your results, please?

Longer term, we should probably do something like this as an automated
osis2mod regression test.

Jonathan

Note: The line of make-kjvfull.sh starting with DistributionLicense=
ends with the word purpose -- it may get wrapped in this email.

#--------------------------------------------------------------------------


#!/bin/bash

# make-kjvfull.sh -- Creates SWORD module (.zip file) from kjvfull.xml

# Any supplied parameters are passed as options to osis2mod

# Uses $MODULENAME for the modfule name, if it exists,
# or creates a unique name if not.

#

# Author: Jonathan Marsden <jmarsden at fastmail.fm>

# Copyright: Copyright (C) 2009 Jonathan Marsden


TEMPDIR=`mktemp -dt`
[ -z "$MODULENAME" ] && MODULENAME=KJVfull-`date +%FT%H%M%S`
MODULENAMELC=`echo $MODULENAME |tr A-Z a-z`

# Grab or update the KJV sources from DM's site

wget -m -nH -nd http://www.crosswire.org/~dmsmith/kjv2006/sword/kjvxml.zip

# Unpack kjvfull.xml

(cd $TEMPDIR

# create module directory structure for module zipfile creation

mkdir -p mods.d/ modules/texts/ztext/$MODULENAMELC

# Do the work, using osis2mod -z and unzip

echo osis2mod `pwd`/modules/texts/ztext/$MODULENAMELC/ -z $@
unzip -p $OLDPWD/kjvxml.zip kjvfull.xml |osis2mod
`pwd`/modules/texts/ztext/$MODULENAMELC/ - -z $@

# Create minimal .conf file with version 0.<seconds since Unix epoch>

cat <<EOF >mods.d/${MODULENAMELC}.conf

[$MODULENAME]

DataPath=./modules/texts/ztext/$MODULENAMELC/

ModDrv=zText

Encoding=UTF-8

BlockType=BOOK

CompressType=ZIP

SourceType=OSIS

Lang=en

GlobalOptionFilter=OSISStrongs

GlobalOptionFilter=OSISMorph

GlobalOptionFilter=OSISFootnotes

GlobalOptionFilter=OSISHeadings

GlobalOptionFilter=OSISRedLetterWords

OSISqToTick=false

Feature=StrongsNumbers

MinimumVersion=1.5.9

SwordVersionDate=2006-10-09

Version=0.`date +%s`

Description=King James Version (1769) with Strongs Numbers and
Morphology
TextSource=bf.org, eBible.org, crosswire.org

LCSH=Bible. English.

DistributionLicense=General public license for distribution for any
purpose
EOF


# Zip things up (recursively)
zip -r ${OLDPWD}/${MODULENAME}.zip mods.d modules
)

# Delete temporary files

rm -r $TEMPDIR

#--------------------------------------------------------------------------



More information about the sword-devel mailing list