Hello,
on 2012-11-23 I already reported a problem with running libvirt on 32 Bit
Linuxes (libvirt 0.9.12 on Debian Squeeze in my case) on this ML:
[BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit
Due to multiple castings the initial -1 gets casted to (unsigned
int)4294967295, which failes to be cased to an (signed int) on read-back.
Thus the default storage pool is not launched:
2013-02-22 16:50:10.182+0000: 28550: info : libvirt version: 0.9.12
2013-02-22 16:50:10.182+0000: 28550: error : virStorageDefParsePerms:635 : XML error:
malformed owner element
This is caused by uid_t and gid_t being opaque types: their exact type ranges
from s32 to u32 to u64. (Solaris until 2007, Linux, Windows64)
The following patch series fixes several issues, which I found while
investigating the storage pool startup problem:
- mismatch between printf format and types
- implicit casts of -1 to uid_t and gid_t
- missing casts of uid_t and gid_t for printing
- virXPathLong() failing on +(2^32-1)
@Guido: for Debian only the 4th patch is relevant, which applies with some
re-indention.
Additional issues:
- UID and GID 4294967295 happens to be the same as -1, so hopefully nobody
uses it. Should this be documented somewhere?
- Some regression test?
Philipp Hahn (4):
util: Fix printf format for uid_t|gid_t
storage: Cast uid_t|gid_t to unsigned int
storage: cast -1 for uid_t|gid_t
storage: fix uid_t|gid_t handling on 32 bit Linux
src/conf/storage_conf.c | 82 ++++++++++++++++++++++++++++++++---------
src/storage/storage_backend.c | 22 ++++++-----
src/util/virutil.c | 10 ++---
3 files changed, 81 insertions(+), 33 deletions(-)
--
1.7.10.4