Package: lvm2
Version: 2.02.06-4
Severity: normal
I have 4 volume groups on my system named vg0, sw1, sw2 and sw3.
When I use vgcfgbackup with a template filename like this, I get
errors:
yggdrasil:~# vgcfgbackup -f /tmp/vgbackup-%s
Volume group sw3 successfully backed up.
VGs must be backed up into different files. Use %s in filename for VG name.
VGs must be backed up into different files. Use %s in filename for VG name.
Volume group vg0 successfully backed up.
When I move the template character %s away from the end of the
template, it works:
yggdrasil:~# vgcfgbackup -f /tmp/vg-%s-backup
Volume group sw3 successfully backed up.
Volume group sw2 successfully backed up.
Volume group sw1 successfully backed up.
Volume group vg0 successfully backed up.
A quick look at the sourcecode shows the following in
lvm2-2.02.06/tools/vgcfgbackup.c starting in line 37:
if (*last_filename !strncmp(*last_filename, filename,
strlen(template))) {
log_error(VGs must be backed up into different files.
Use %%s in filename for VG name.);
dm_free(filename);
return NULL;
}
The error seems to be in the strlen(template) part. When I use
/tmp/vgbackup-%s as a template, it gets expanded to
/tmp/vgbackup-sw3
/tmp/vgbackup-sw2
/tmp/vgbackup-sw1
/tmp/vgbackup-vg0
The expanded strings are one character longer than the template
string. But because only the strlen(template) first characters are
compared, /tmp/vgbackup-sw is equal to /tmp/vgbackup-sw and the
error message appears.
Regards,
Christian
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Versions of packages lvm2 depends on:
ii debconf [debconf-2.0] 1.5.11Debian configuration management sy
ii libc6 2.3.6.ds1-13etch2 GNU C Library: Shared libraries
ii libdevmapper1.02 2:1.02.08-1 The Linux Kernel Device Mapper use
ii libncurses55.5-5 Shared libraries for terminal hand
ii libreadline5 5.2-2 GNU readline and history libraries
ii libselinux11.32-3SELinux shared libraries
ii libsepol1 1.14-2Security Enhanced Linux policy lib
ii lvm-common 1.5.20The Logical Volume Manager for Lin
lvm2 recommends no packages.
-- debconf information:
lvm2/snapshots:
--
Christian.Garbs.http://www.cgarbs.de
Wenns zu Silvester stuermt und schneit,
ist das neue Jahr nicht mehr weit.
signature.asc
Description: Digital signature