Additions to LVM-BUGS-0.8final
Here is a list of additional bug fixes that appeared on the linux-lvm mailing list, but are not currently in the BUGS file on the LVM site.
Cheers, Andreas
------------------------------------------------------------------------------
Michael Marxmeier <[email protected]> writes:
<22> vg_check_name -- LEAVING with ret: 0
<22> lvm_remove_recursive -- CALLED with dir: /dev/Main_VG
This looks like a bug in lvm_remove_recursive() (tools/lib/...) A short look reveales the following suspicious code sequence around line 71:
if ( ( file_name = malloc ( strlen (dir) +
strlen (dir_ent->d_name) +
2)) == NULL) {
ret = -LVM_EREMOVE_RECURSIVE_MALLOC;
goto lvm_remove_recursive_end;
}
sprintf ( file_name, "%s/%s%c", dir, dir_ent->d_name,0);
AFAICS this could write a byte beyound file_name, depending on file name length (due to malloc alignment).
Try to replace the sprintf() with:
sprintf ( file_name, "%s/%s", dir, dir_ent->d_name);
or make the +2 a +3 in the malloc call.
-----------------------------------------------------------------------
Jan Niehusmann writes:
vgcfgbackup does not make the last backup copy:
--- 0.8final.orig/tools/lib/vg_cfgbackup.c Tue Feb 22 04:09:32 2000
--- 0.8final/tools/lib/vg_cfgbackup.c Tue May 23 17:02:35 2000
@@ -366,7 +366,7 @@
}
/* VGDA backup history */
- for (i = vg_max_backups; i > 1; i--) {
+ for (i = vg_max_backups; i >= 1; i--) {
sprintf ( vg_backup_path_old2, "%s/%s.conf.%d.old%c",
directory. vg_name, i, 0);
if ( opt_v > 0) printf ( "%s -- checking for \"%s\"\n",-----------------------------------------------------------------------
please change vgchange.c line 346 to line 354 that they looks like:
if ( ( ret = vg_check_online_all_pv ( vg, &pv_offl, &pv_incons)) < 0
&& ret != -LVM_EPV_READ_MD_DEVICE) {
if ( ret == -LVM_EPV_READ_PV_CREATE_NAME_FROM_KDEV_T) {
fprintf ( stderr, "%s -- ERROR: can't get name(s) of "
"physical volumes\n"
"%s -- Please check, if /proc "
"is mounted\n",
cmd, cmd);
} else {and test again.
-----------------------------------------------------------------------
The SGI xfs-2.4test1 tree has also an addition which adds some extra fields to /proc/partitions.
tools/lib/lvm_dir_cache.c Sat Jun 17 01:27:28 2000 renamed from tools/lib/lvm_dir_cache.c Tue Feb 22 03:09:32 2000 +3 -1
@@ -60,6 +60,7 @@ char minor[20] = { 0, }; char blocks[20] = { 0, }; char devname[30] = { 0, }; + char procline[127] ; static char *devdir[] = { "/dev/ida", "/dev/ide/hd",
@@ -85,7 +86,8 @@ if ( dir_cache == NULL) { if ( ( proc = fopen ( "/proc/partitions", "r")) != NULL) { while ( !feof ( proc)) { - fscanf ( proc, " %s %s %s %s\n", major, minor, blocks, devname); + fgets ( procline, 127, proc) ; + sscanf ( procline, " %s %s %s %s\n", major, minor, blocks,
devname);
if ( atoi ( major) > 0 && atoi ( major) != LVM_BLK_MAJOR) {
lvm_add_dir_cache ( "/dev", devname);
}-----------------------------------------------------------------------
HIBINO Kei reports access to an unused variable:
tools/vgremove.c Tue Jun 27 13:03:37 2000 renamed from tools/vgremove.c Mon Feb 21 19:09:33 2000 +1 -2
@@ -70,7 +70,6 @@ }; char *vg_name = NULL; vg_t *vg = NULL; - pv_t **pv = NULL; cmd = basename ( argv[0]);
@@ -195,7 +194,7 @@ cmd, vg_name); for ( p = 0; vg->pv[p] != NULL; p++) { if ( opt_v > 0) printf ( "%s -- initializing physical volume \"%s\"\n", - cmd, pv[p]->pv_name); + cmd, vg->pv[p]->pv_name); if ( ( ret = pv_setup_for_create ( vg->pv[p]->pv_name, vg->pv[p], vg->pv[p]->pv_size)) < 0) { fprintf ( stderr, "%s -- ERROR \"%s\" initializing physical "
Andreas Dilger escribi�:
Quoted 24 lines
Here is a list of additional bug fixes that appeared on the linux-lvm mailing list, but are not currently in the BUGS file on the LVM site.
Cheers, Andreas
------------------------------------------------------------------------------Michael Marxmeier <[email protected]> writes:
<22>
vg_check_name-- LEAVING with ret: 0
<22>lvm_remove_recursive-- CALLED with dir:/dev/Main_VGThis looks like a bug in
lvm_remove_recursive()(tools/lib/...) A short look reveales the following suspicious code sequence around line 71:if ( ( file_name = malloc ( strlen (dir) + strlen (dir_ent->d_name) + 2)) == NULL) { ret = -LVM_EREMOVE_RECURSIVE_MALLOC; goto lvm_remove_recursive_end; } sprintf ( file_name, "%s/%s%c", dir, dir_ent->d_name,0);
Quoted 9 lines
AFAICS this could write a byte beyound
file_name, depending on file name length (due to malloc alignment).Try to replace the
sprintf()with:sprintf (
file_name, "%s/%s", dir,dir_ent->d_name);or make the +2 a +3 in the malloc call.
[root@isiux /]# vgscan
vgscan -- reading all physical volumes (this may take a while...) vgscan -- found inactive volume group "isiux_dg"
vgscan -- ERROR "lvm_remouverecursive(): opendir" removing volume group directory and special files
vgscan -- found inactive volume group "root_dg"
vgscan -- ERROR "lvm_remouverecursive(): opendir" removing volume group directory and special files
vgscan -- ERROR "lvm_remouverecursive(): opendir" creating "/etc/lvmtab" and "/etc/lvmtab.d"
I change the code that you say , and cotinue the error
strlen (dir_ent->d_name) +
3)) == NULL) {
ret = -LVM_EREMOVE_RECURSIVE_MALLOC;
goto lvm_remove_recursive_end;
}
sprintf ( file_name, "%s/%s", dir, dir_ent->d_name, 0);
if ( lstat ( file_name, &sb) == 0) {And when compile it , it say that :
cc -c -pipe -Wall -O2 -D_GNU_SOURCE -DDEBUG -I/root/LVM/0.8final/tools/lib -I/root/LVM/0.8final/tools -o lvm_remove_recursive.o lvm_remove_recursive.c lvm_remove_recursive.c: In function `lvm_remove_recursive':
lvm_remove_recursive.c:51: warning: too many arguments for format cc -c -pipe -Wall -O2 -D_GNU_SOURCE -DDEBUG -I/root/LVM/0.8final/tools/lib -I/root/LVM/0.8final/tools -o lvm_show_filetype.o lvm_show_filetype.c cc -c -pipe -Wall -O2 -D_GNU_SOURCE -DDEBUG -I/root/LVM/0.8final/tools/lib -I/root/LVM/0.8final/tools -o lvm_show_size.o lvm_show_size.c
Quoted 6 lines · Falcon
Andreas Dilger escribi?:
Quoted 3 lines
Try to replace the
sprintf()with:sprintf (
file_name, "%s/%s", dir,dir_ent->d_name);sprintf ( file_name, "%s/%s", dir, dir_ent->d_name, 0);
^^^
Quoted 7 lines
And when compile it , it say that :
cc -c -pipe -Wall -O2 -D_GNU_SOURCE -DDEBUG -I/root/LVM/0.8final/tools/lib -I/root/LVM/0.8final/tools -o lvm_remove_recursive.o
lvm_remove_recursive.clvm_remove_recursive.c: In function `lvm_remove_recursive':
lvm_remove_recursive.c:51: warning: too many arguments for format
That's because you have an extra "0" at the end, which I don't have.
Cheers, Andreas
Signature · 3 lines
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert