[BUG] storage.xml: owner|group=-1 → 2^32-1 on 32 Bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

when you install and use libvirt in a 32 bit environment, the handling of 
owner and group in /etc/libvirt/storage/*.xml is broken: The initial -1 is 
printed as an "unsigned int" and is thus converted to +(2^32-1):
> # cat /etc/libvirt/storage/default.xml
> <!--
> WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
> OVERWRITTEN AND LOST. Changes to this xml configuration should be made
> using: virsh pool-edit default
> or other application using the libvirt API.
> -->
>
> <pool type='dir'>
>   <name>default</name>
>   <uuid>4e2670b8-9dc3-528e-6fc2-58268e99f44f</uuid>
>   <capacity unit='bytes'>0</capacity>
>   <allocation unit='bytes'>0</allocation>
>   <available unit='bytes'>0</available>
>   <source>
>   </source>
>   <target>
>     <path>/var/lib/libvirt/images</path>
>     <permissions>
>       <mode>0700</mode>
>       <owner>4294967295</owner>
>       <group>4294967295</group>
>     </permissions>
>   </target>
> </pool>

When you next restart libvirtd virStorageDefParsePerms() tries to parse that 
as an "signed int", which fails in virXPathLongBase() because of
> 182             if (*value != obj->floatval) {
> (gdb) print *value
> $11 = -2147483648
> (gdb) print obj->floatval
> $12 = 4294967295
> (gdb) print /x *value
> $13 = 0x80000000
> (gdb) print /x obj->floatval
> $14 = 0xffffffff

This then prints the following error messages:
> 2012-11-23 14:03:18.877+0000: 25536: error : virStorageDefParsePerms:613 :
> XML error: malformed owner element
> 2012-11-23 14:03:19.581+0000: > 25529: error : 
storagePoolSetAutostart:1056 : Failed to create symlink
> '/etc/libvirt/storage/autostart/default.xml' to '/etc/libvirt/storage/def

The change to print owner and group as %d instead of %u was introdeces in 
commit 37a10129:
> Update xml schemas according to libvirt source
...
> storage_conf: Print uid_t and gid_t as signed to storage pool XML.

Care to revert that change? Patch is attached.

Sincerely
Philipp
-- 
Philipp Hahn           Open Source Software Engineer      hahn@xxxxxxxxxxxxx
Univention GmbH        be open.                       fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7944555..b07a7aa 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1036,10 +1036,10 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def) {
         virBufferAddLit(&buf,"    <permissions>\n");
         virBufferAsprintf(&buf,"      <mode>0%o</mode>\n",
                           def->target.perms.mode);
-        virBufferAsprintf(&buf,"      <owner>%d</owner>\n",
-                          (int) def->target.perms.uid);
-        virBufferAsprintf(&buf,"      <group>%d</group>\n",
-                          (int) def->target.perms.gid);
+        virBufferAsprintf(&buf,"      <owner>%u</owner>\n",
+                          (unsigned int) def->target.perms.uid);
+        virBufferAsprintf(&buf,"      <group>%u</group>\n",
+                          (unsigned int) def->target.perms.gid);
 

Attachment: signature.asc
Description: This is a digitally signed message part.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]