wip
wup
wip
configstore: use O_TRUNC when rewriting jenv file

Because thumper was determined not to write a temporary file then move it, we have to ensure that iff we rewrite the .jenv file, the contents of the existing file are truncated before writing to prevent future readers of the file seeing corrupt data at the end of the file.
Revert "wip"

This reverts commit 7ef024fb099177f16c75d22044bc94ee252ab8ae.
Revert "wup"

This reverts commit e56a4c0e4638bfbd1f5463a9708190c799c05d44.
Revert "wip"

This reverts commit 22b0fa3d7c305d869581e4e37e0a14670d348ddf.
Added test from thumper
Merge pull request #402 from davecheney/157-always-truncate-configstore

configstore: use O_TRUNC when rewriting jenv file

Fixes LP #1348458

Because thumper was determined not to write a temporary file then move it, we have to ensure that iff we rewrite the .jenv file, the contents of the existing file are truncated before writing to prevent future readers of the file seeing corrupt data at the end of the file.