Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2001 17:05:58 -0500 (EST)
From:      The Anarcat <anarcat@anarcat.dyndns.org>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        anarcat@anarcat.dyndns.org
Subject:   bin/33070: libdisk::Disk_Names() returns empty strings
Message-ID:  <20011221220558.8DEB020ACD@shall.anarcat.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         33070
>Category:       bin
>Synopsis:       libdisk::Disk_Names() returns empty strings
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 21 14:10:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     The Anarcat
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Nada, Inc.
>Environment:
System: FreeBSD shall.anarcat.dyndns.org 4.4-STABLE FreeBSD 4.4-STABLE #0: Fri Nov 16 12:57:38 EST 2001 anarcat@shall.anarcat.dyndns.org:/usr/obj/usr/src/sys/SHALL i386

>Description:

Some recent MFC broke Disk_Names() on -stable:

revision 1.50.2.13.2.1
date: 2001/09/18 15:16:21;  author: murray;  state: Exp;  lines: +2 -2
MFS: Don't use kern.disks sysctl.

     Makefile (rev 1.27.2.5)
     disk.c (rev 1.50.2.14)

The diff is:

ndex: disk.c
===================================================================
RCS file: /home/ncvs/src/lib/libdisk/disk.c,v
retrieving revision 1.50.2.13
retrieving revision 1.50.2.13.2.1
diff -u -r1.50.2.13 -r1.50.2.13.2.1
--- disk.c      28 Aug 2001 03:45:47 -0000      1.50.2.13
+++ disk.c      18 Sep 2001 15:16:21 -0000      1.50.2.13.2.1
@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.
  * Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/lib/libdisk/disk.c,v 1.50.2.13 2001/08/28 03:45:47
  nyan Exp $
+ * $FreeBSD: src/lib/libdisk/disk.c,v 1.50.2.13.2.1 2001/09/18 15:16:21
murray Exp $
  *
  */
 
@@ -499,7 +499,7 @@
 
     disks = malloc(sizeof *disks * (1 + MAX_NO_DISKS));
     memset(disks,0,sizeof *disks * (1 + MAX_NO_DISKS));
-#ifndef PC98
+#if !defined(PC98) && !defined(KERN_DISKS_BROKEN)
     error = sysctlbyname("kern.disks", NULL, &listsize, NULL, 0);
     if (!error) {
            disklist = (char *)malloc(listsize);

I do not understand why, but Disk_Names() returns a pointer to a list of
NULL strings. This is weird. 

It definitly breaks libh's libdisk.

>How-To-Repeat:

#include <iostream>
extern "C" {
#include <sys/types.h>
#include <libdisk.h>
}

int main() {

	char** names = ::Disk_Names();
	cerr << "n: " << names << endl;
	for (char **n = names; *n != NULL; n++) {
		cerr << "disk" << *n << endl;
	}
	
	return 1;

}

Simply returns with "n: 0x..."

gdb also gives us the same sad stuff.

>Fix:

Back out the change.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011221220558.8DEB020ACD>