Your message dated Thu, 08 Sep 2005 02:32:05 -0700
with message-id <[EMAIL PROTECTED]>
and subject line Bug#326599: fixed in quik 2.1-7
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 4 Sep 2005 10:47:51 +0000
>From [EMAIL PROTECTED] Sun Sep 04 03:47:51 2005
Return-path: <[EMAIL PROTECTED]>
Received: from wproxy.gmail.com [64.233.184.195] 
        by spohr.debian.org with esmtp (Exim 3.36 1 (Debian))
        id 1EBs2Q-0001Ry-00; Sun, 04 Sep 2005 03:47:51 -0700
Received: by wproxy.gmail.com with SMTP id 57so571780wri
        for <[EMAIL PROTECTED]>; Sun, 04 Sep 2005 03:47:19 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        
h=received:date:from:to:subject:message-id:x-mailer:mime-version:content-type:content-transfer-encoding;
        
b=k8PTeEOq9EO2QLeSAbN1yyI4jKhPC1DnyzY5b4MhrtJ+o0b/yUafmC6IkPUjZ1omCuxHQuOkU0+6UicCWQCduEKDfWdvZEVJ6t3eKcM1hVw+9d76yVgkDpMOgzYwtx2YE/gQN4hybI3tvbr/3HfdsazDt/Qri3ZtQPHFgerFErQ=
Received: by 10.54.71.11 with SMTP id t11mr2946451wra;
        Sun, 04 Sep 2005 03:47:19 -0700 (PDT)
Received: from tertius.castalie.org ( [213.41.173.122])
        by mx.gmail.com with ESMTP id d75sm3490036wra.2005.09.04.03.47.18;
        Sun, 04 Sep 2005 03:47:19 -0700 (PDT)
Date: Sun, 4 Sep 2005 12:47:10 +0200
From: Simon Vallet <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Quik crashes handling spare md devices
Message-ID: <[EMAIL PROTECTED]>
X-Mailer: Sylpheed-Claws 1.0.4 (GTK+ 1.2.10; powerpc-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02

Package: quik
Version: 2.1-6
Tags: patch

quik-2.1-6 segfaults when a spare/faulty device is present in a RAID1
md mirror. The attached patch solves the problem

diff -Naur quik-2.1.orig/include/quik_md.h quik-2.1/include/quik_md.h
--- quik-2.1.orig/include/quik_md.h     2005-09-04 12:19:10.000000000 +0200
+++ quik-2.1/include/quik_md.h  2005-09-04 12:00:40.000000000 +0200
@@ -40,6 +40,14 @@
 
 /* From md_p.h */
 #define MD_SB_DISKS 27
+/*
+ * Device "operational" state bits
+ */
+#define MD_DISK_FAULTY          0 /* disk is faulty / operational */
+#define MD_DISK_ACTIVE          1 /* disk is running or spare disk */
+#define MD_DISK_SYNC            2 /* disk is in sync with the raid set */
+#define MD_DISK_REMOVED         3 /* disk is in sync with the raid set */
+
 #include <linux/raid/md_u.h>
 
 struct devmap {
@@ -62,7 +70,7 @@
 int add_dev(const char *, const struct stat *, int, struct FTW *);
 int digit_offset (const char *);
 
-//void fatal (const char *);
+/* void fatal (const char *); */
 
 typedef struct dev_info {
   char * bootdev;    /* Physical device, e.g. /dev/hda */
@@ -85,8 +93,8 @@
   int rlevel;
 } mdev_info_t;
 
-#define BOOTDEV(dev,i) ((dev)->devs[(i)]->bootdev)
-#define SPART(dev,i) ((dev)->devs[(i)]->spart)
+#define BOOTDEV(dev,i) (((dev)->devs[(i)]) ? (dev)->devs[(i)]->bootdev : NULL)
+#define SPART(dev,i) (((dev)->devs[(i)]) ? (dev)->devs[(i)]->spart : NULL)
 
 dev_info_t * new_dev_info (unsigned char);
 void free_dev_info (dev_info_t *);
diff -Naur quik-2.1.orig/quik/quik.c quik-2.1/quik/quik.c
--- quik-2.1.orig/quik/quik.c   2005-09-04 12:19:10.000000000 +0200
+++ quik-2.1/quik/quik.c        2005-09-04 12:06:37.000000000 +0200
@@ -129,15 +129,15 @@
     close(fd);
 
     for (i=0; i<devs->ndevs; i++) {
-      if (devs->devs[i]->bootdev) { /* Handle "missing" raid devices */
+      if (BOOTDEV(devs,i)) { /* Handle "missing" and spare raid devices */
        partno = part_from_dev(SPART(devs,i));
        if (partno == 0)
          fatal("Can't determine partition number for %s", SPART(devs,i));
        upart = 0;
        mp = (struct mac_partition *) buff;
        md = (struct mac_driver_desc *) buff;
-       if ((fd = open(devs->devs[i]->bootdev, O_RDONLY)) == -1)
-         fatal("Can't open %s", BOOTDEV(devs, i));
+       if ((fd = open(BOOTDEV(devs,i), O_RDONLY)) == -1)
+         fatal("Can't open %s", BOOTDEV(devs,i));
        if (read(fd, buff, sizeof (buff)) != sizeof (buff))
          fatal("Error reading %s (block 0)", BOOTDEV(devs, i));
        if (md->signature != MAC_DRIVER_MAGIC)
@@ -184,43 +184,46 @@
   off_t seek_offset;
 
   for (i=0; i<devs->ndevs; i++) {
-    if (devs->devs[i]->part_block == 0)
-      return;
-    if (verbose)
+    if (devs->devs[i]) {
+      if (devs->devs[i]->part_block == 0)
+       return;
+      if (verbose)
        printf("Making %s bootable (map entry %d)\n", 
               SPART(devs, i), 
               devs->devs[i]->part_block);
-    if (devs->devs[i]->first_bootable > 0 
-       && devs->devs[i]->first_bootable < devs->devs[i]->part_block)
-      fprintf(stderr, "Warning: prior partition (entry %d) is bootable\n",
-             devs->devs[i]->first_bootable);
-    if ((fd = open(BOOTDEV(devs,i), O_RDWR)) < 0)
+      if (devs->devs[i]->first_bootable > 0 
+         && devs->devs[i]->first_bootable < devs->devs[i]->part_block)
+       fprintf(stderr, "Warning: prior partition (entry %d) is bootable\n",
+               devs->devs[i]->first_bootable);
+      if ((fd = open(BOOTDEV(devs,i), O_RDWR)) < 0)
        fatal("Cannot open %s for writing\n", BOOTDEV(devs,i));
-    seek_offset = (off_t)devs->devs[i]->part_block * devs->devs[i]->secsize;
-    lseek(fd, seek_offset, 0);
-    if (read(fd, buff, sizeof(buff)) != sizeof(buff)) {
-      close(fd);
-      fatal("Error reading partition map entry %d from %s\n", 
-           devs->devs[i]->part_block,
-           BOOTDEV(devs,i));
-    }
-    mp = (struct mac_partition *) buff;
-    mp->status |= STATUS_BOOTABLE;
-    mp->boot_start = 0;
-    mp->boot_size = 1024;
-    mp->boot_load = FIRST_BASE;
-    mp->boot_load2 = 0;
-    mp->boot_entry = FIRST_BASE;
-    mp->boot_entry2 = 0;
-    strncpy(mp->processor, "PowerPC", sizeof(mp->processor));
-    if (lseek(fd, seek_offset, 0) < 0
-       || write(fd, buff, sizeof(buff)) != sizeof(buff)) {
-      close(fd);
-      fatal("Couldn't make %s%d bootable: write error\n", 
-           BOOTDEV(devs,i),
-           devs->devs[i]->part_block);
-    }
+      
+      seek_offset = (off_t)devs->devs[i]->part_block * devs->devs[i]->secsize;
+      lseek(fd, seek_offset, 0);
+      if (read(fd, buff, sizeof(buff)) != sizeof(buff)) {
+       close(fd);
+       fatal("Error reading partition map entry %d from %s\n", 
+             devs->devs[i]->part_block,
+             BOOTDEV(devs,i));
+      }
+      mp = (struct mac_partition *) buff;
+      mp->status |= STATUS_BOOTABLE;
+      mp->boot_start = 0;
+      mp->boot_size = 1024;
+      mp->boot_load = FIRST_BASE;
+      mp->boot_load2 = 0;
+      mp->boot_entry = FIRST_BASE;
+      mp->boot_entry2 = 0;
+      strncpy(mp->processor, "PowerPC", sizeof(mp->processor));
+      if (lseek(fd, seek_offset, 0) < 0
+         || write(fd, buff, sizeof(buff)) != sizeof(buff)) {
+       close(fd);
+       fatal("Couldn't make %s%d bootable: write error\n", 
+             BOOTDEV(devs,i),
+             devs->devs[i]->part_block);
+      }
     close(fd);
+    }
   }
 }
 
diff -Naur quik-2.1.orig/quik/quik_md.c quik-2.1/quik/quik_md.c
--- quik-2.1.orig/quik/quik_md.c        2005-09-04 12:19:10.000000000 +0200
+++ quik-2.1/quik/quik_md.c     2005-09-04 11:56:23.000000000 +0200
@@ -61,6 +61,7 @@
 
 /* From quik.c */
 void fatal(char *fmt,...)  __attribute__ ((noreturn));
+extern int verbose;
 
 mdev_info_t * md_get_info (const char * device)
 {
@@ -78,14 +79,14 @@
        fatal("Couldn't get array info for device %s\n", device);
       }
   
-      out = new_mdev_info(array.raid_disks);
+      out = new_mdev_info(array.nr_disks);
       out->rlevel = array.level;
 
       /* Not needed for the moment */
       c = map_num(pers, array.level);
 
       /* fprintf(stderr, "ARRAY %s level=%s num-devices=%d\n",
-        md_dev, c?c:"unknown", array.raid_disks); */
+        device, c?c:"unknown", array.nr_disks); */
   
       /* Get devices */
       for (d=0; d < MD_SB_DISKS; d++) {
@@ -94,11 +95,21 @@
        int o;
        disk.number = d;
        if (ioctl(mdev_fd, GET_DISK_INFO, &disk) < 0) { continue; }
+
        if (d > array.raid_disks &&
            disk.major == 0 &&
            disk.minor == 0) { continue; }
     
        if ((dv=map_dev(disk.major, disk.minor))) {
+         /* Ignore spare & faulty devices */
+         if (disk.state == 0 || (disk.state & (1<<MD_DISK_FAULTY))) {
+           if (verbose)
+             printf("Ignoring spare or faulty device %s\n", dv);
+           free_dev_info(out->devs[i]);
+           out->devs[i]=NULL;
+           continue;
+         }
+
          out->devs[i]->spart = (char *) malloc(strlen(dv)+1);
          strcpy(out->devs[i]->spart, dv);
          o = digit_offset(out->devs[i]->spart);

Simon

-- 
Simon Vallet
[EMAIL PROTECTED]

---------------------------------------
Received: (at 326599-close) by bugs.debian.org; 8 Sep 2005 09:38:47 +0000
>From [EMAIL PROTECTED] Thu Sep 08 02:38:47 2005
Return-path: <[EMAIL PROTECTED]>
Received: from katie by spohr.debian.org with local (Exim 3.36 1 (Debian))
        id 1EDIlJ-0005O0-00; Thu, 08 Sep 2005 02:32:05 -0700
From: Peter De Schrijver (p2) <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
X-Katie: $Revision: 1.56 $
Subject: Bug#326599: fixed in quik 2.1-7
Message-Id: <[EMAIL PROTECTED]>
Sender: Archive Administrator <[EMAIL PROTECTED]>
Date: Thu, 08 Sep 2005 02:32:05 -0700
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02

Source: quik
Source-Version: 2.1-7

We believe that the bug you reported is fixed in the latest version of
quik, which is due to be installed in the Debian FTP archive:

quik_2.1-7.diff.gz
  to pool/main/q/quik/quik_2.1-7.diff.gz
quik_2.1-7.dsc
  to pool/main/q/quik/quik_2.1-7.dsc
quik_2.1-7_powerpc.deb
  to pool/main/q/quik/quik_2.1-7_powerpc.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Peter De Schrijver (p2) <[EMAIL PROTECTED]> (supplier of updated quik package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun,  4 Sep 2005 20:59:37 +0200
Source: quik
Binary: quik
Architecture: source powerpc
Version: 2.1-7
Distribution: unstable
Urgency: low
Maintainer: Peter De Schrijver (p2) <[EMAIL PROTECTED]>
Changed-By: Peter De Schrijver (p2) <[EMAIL PROTECTED]>
Description: 
 quik       - Bootloader for PowerMac or CHRP systems
Closes: 326599
Changes: 
 quik (2.1-7) unstable; urgency=low
 .
   * Fixed bug in handling spare/faulty drives in a MD raid-1 config.
     Thanks to Simon Vallet. (Closes: #326599)
Files: 
 3cdc57088b450e10dd11c48ef9f307a2 658 base important quik_2.1-7.dsc
 1b3654d8a58f166c3525f25be997ec7d 47434 base important quik_2.1-7.diff.gz
 1dc207fdaf6f2dd87e583f6492a1db1c 51916 base important quik_2.1-7_powerpc.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFDH/6nKLKVw/RurbsRAuNzAKCoLnaFBUvO9z+eMuyUuJ8ab2CRcACfeoNJ
ajT58qb0cNnEJFYnBT1CEV0=
=7RID
-----END PGP SIGNATURE-----


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to