Re: dboostrap segfault with no CDROM drive

2002-02-21 Thread Eduard Bloch

#include 
Matt Kraai wrote on Thu Feb 21, 2002 um 10:00:11AM:
> > problem. It crashed in strlen (while parsing), as expected. The changes
> > in have_cdrom() will catch it up.
> 
> Great!  That's what I was hoping to hear.  Did you add a changelog
> entry and mark #134802 pending?

Not yet. Changelog entry is done, but closes tag is commented with _.
Someone has to test the new code with a) no cdrom drives and b) with a
real cdrom drive. I cannot, build system is broken because of utf8
transition, and not much time to spend on it.

Gruss/Regards,
Eduard.
-- 
Es kann aeusserst gefaehrlich sein, etwas ohne ausreichende
Vorbereitung aus der Sicht eines anderen Menschen zu betrachten.
=== Douglas Adams / Einmal Rupert und zurueck ===



msg15955/pgp0.pgp
Description: PGP signature


Re: dboostrap segfault with no CDROM drive

2002-02-21 Thread Matt Kraai

On Thu, Feb 21, 2002 at 06:39:02PM +0100, Eduard Bloch wrote:
> #include 
> Matt Kraai wrote on Thu Feb 21, 2002 um 08:58:28AM:
> > > The patch was not working correctly, I looked for spaces rather for
> > > tabs. This should work - untested for now.
> > 
> > I am wary of changing anything this close to release without
> > understanding the problem.  Why isn't there a backtrace?
> 
> I simulated this in a chroot, after loading cdrom modules but unloading
> ide-cd and ide-scsi, so the procfs file looked as in the described
> problem. It crashed in strlen (while parsing), as expected. The changes
> in have_cdrom() will catch it up.

Great!  That's what I was hoping to hear.  Did you add a changelog
entry and mark #134802 pending?

Matt



msg15953/pgp0.pgp
Description: PGP signature


Re: dboostrap segfault with no CDROM drive

2002-02-21 Thread Eduard Bloch

#include 
Matt Kraai wrote on Thu Feb 21, 2002 um 08:58:28AM:
> > The patch was not working correctly, I looked for spaces rather for
> > tabs. This should work - untested for now.
> 
> I am wary of changing anything this close to release without
> understanding the problem.  Why isn't there a backtrace?

I simulated this in a chroot, after loading cdrom modules but unloading
ide-cd and ide-scsi, so the procfs file looked as in the described
problem. It crashed in strlen (while parsing), as expected. The changes
in have_cdrom() will catch it up.

Gruss/Regards,
Eduard.
-- 
void o(char c){printf("%c",c);}int main(){int a,b=0;char ciph[]= "91.92.7999 "
"yb Ugvuzm Hvmwg. Arxilhlug ivzoob hfxph !!!\n";while(a=ciph[b++]){if((a>='A')
&&(a<='Z')){a+=13;if(a>'Z')a-=26;o('Z'-(a-'A'));}else if((a>='a')&&(a<='z')){o
('z'-(a-'a'));}else if((a>='0') && (a<='9')){o('9'-(a-'0'));}else o(a);}}



msg15952/pgp0.pgp
Description: PGP signature


Re: dboostrap segfault with no CDROM drive

2002-02-21 Thread Matt Kraai

On Thu, Feb 21, 2002 at 09:38:09AM +0100, Eduard Bloch wrote:
> #include 
> Eduard Bloch wrote on Thu Feb 21, 2002 um 08:35:57AM:
> > > FWIW I couldn't reproduce the segfault.  I used the same
> > > "/proc/sys/dev/cdrom/info" as in the bug report and got fine behavior.
> > 
> > Oh, I tried. Detach your cdrom drives and boot bf2.4. You get the
> > flashing screen syndrome. Reattached the driver - works. So I rebuilt
> > BFs, hacked root to remove duplicated libs and fit on the floppy.
> > Rebootet - same game. Works with an attached CD drive, crashes without
> > it. Looks like my patch would net help to solve the real problem,
> > whatever it is.
> 
> The patch was not working correctly, I looked for spaces rather for
> tabs. This should work - untested for now.

I am wary of changing anything this close to release without
understanding the problem.  Why isn't there a backtrace?

Matt



msg15949/pgp0.pgp
Description: PGP signature


Re: dboostrap segfault with no CDROM drive

2002-02-21 Thread Eduard Bloch

#include 
Eduard Bloch wrote on Thu Feb 21, 2002 um 08:35:57AM:
> > FWIW I couldn't reproduce the segfault.  I used the same
> > "/proc/sys/dev/cdrom/info" as in the bug report and got fine behavior.
> 
> Oh, I tried. Detach your cdrom drives and boot bf2.4. You get the
> flashing screen syndrome. Reattached the driver - works. So I rebuilt
> BFs, hacked root to remove duplicated libs and fit on the floppy.
> Rebootet - same game. Works with an attached CD drive, crashes without
> it. Looks like my patch would net help to solve the real problem,
> whatever it is.

The patch was not working correctly, I looked for spaces rather for
tabs. This should work - untested for now.


-- 
Du hast recht, und er hat auch recht. Dein Argument ist, als ob Du
sagst, Krankenhäuser werden abgeschafft, die Apotheken sind doch voller
Medikamente und jeder kann sich für ein paar Mark bedienen;-).
 (Hannes Birnbacher in de.comm.software.newsreader)


diff -u -r1.132 choose_medium.c
--- choose_medium.c 2002/02/07 04:00:25 1.132
+++ choose_medium.c 2002/02/21 08:36:09
@@ -664,44 +664,6 @@
 }
 
 
-/*
- * "/proc/sys/dev/cdrom/info", on bittersweet, contains:
- * 8<->8
- * CD-ROM information, Id: cdrom.c 2.56 1999/09/09
- *
- * drive name: sr0 hdd
- * drive speed:6   4
- * drive # of slots:   1   0
- * Can close tray: 1   1
- * Can open tray:  1   1
- * Can lock tray:  1   1
- * Can change speed:   1   1
- * Can select disk:0   0
- * Can read multisession:  1   1
- * Can read MCN:   1   1
- * Reports media changed:  1   1
- * Can play audio: 1   1
- *
- *
- * 8<->8
- *
- * Note that there are actually tab characters in the file; I've
- * untabified so it stays lined up in this comment.  I have verified
- * that this file does not exist on a machine with no CDROM attached.
- * - karlheg 2000.03.20
- * Linux bittersweet 2.2.14 #9 Fri Mar 17 00:50:19 PST 2000 i586 unknown
- */
-
-int
-have_cdrom ()
-{
-struct stat statbuf;
-int status;
-if ((status = stat("/proc/sys/dev/cdrom/info", &statbuf)) == 0)
-   return 1;
-return 0;
-}
-
 static
 char *
 get_cd_type_description (const char *dev)
@@ -755,7 +717,7 @@
 
 /* Should be guaranteed on entry that the cd_info file exists - use have_cdrom() 
*/
 /*  I get a warning here about assignment makes pointer from integer without 
a cast.  Why?? */
-if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) == NULL) {
+if (have_cdrom() && (cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) == NULL) {
return; /* ¿ Shouldn't happen if I can stat it, right ? */
 }
 
Index: reboot_system.c
===
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/reboot_system.c,v
retrieving revision 1.24
diff -u -r1.24 reboot_system.c
--- reboot_system.c 2001/12/21 07:54:45 1.24
+++ reboot_system.c 2002/02/21 08:36:09
@@ -33,7 +33,7 @@
   char *p_line,*line = NULL;
   size_t line_size = 0;
   char bootmagic='\0';
-  if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL)
+  if (have_cdrom() && (cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL)
   {
 /* successfull, continuing */
 
Index: util.c
===
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/util.c,v
retrieving revision 1.69
diff -u -r1.69 util.c
--- util.c  2002/02/10 19:30:14 1.69
+++ util.c  2002/02/21 08:36:09
@@ -1115,5 +1115,52 @@
 }
 
 
+/*
+ * "/proc/sys/dev/cdrom/info", on bittersweet, contains:
+ * 8<->8
+ * CD-ROM information, Id: cdrom.c 2.56 1999/09/09
+ *
+ * drive name: sr0 hdd
+ * drive speed:6   4
+ * drive # of slots:   1   0
+ * Can close tray: 1   1
+ * Can open tray:  1   1
+ * Can lock tray:  1   1
+ * Can change speed:   1   1
+ * Can select disk:0   0
+ * Can read multisession:  1   1
+ * Can read MCN:   1   1
+ * Reports media changed:  1   1
+ * Can play audio: 1   1
+ *
+ *
+ * 8<->8
+ *
+ * Note that there are actually tab characters in the file; I've
+ * untabified so it stays lined up in this comment.  I have verified
+ * that this file does not exist on a machine with no CDROM attached.
+ * - karlheg 2000.03.20
+ * Linux bittersweet 2.2.14 #9 Fri Mar 17 00:50:19 PST 2000 i586 unknown
+ */
 
+int
+have_cdrom ()
+{
+FILE *cd_info;
+char *line = NULL;
+size_t line_size = 0;
+if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL) {
+   /* Read the file and build a list of availabl

Re: dboostrap segfault with no CDROM drive

2002-02-20 Thread Eduard Bloch

#include 
David Kimdon wrote on Wed Feb 20, 2002 um 08:31:02PM:
> > Where does dbootstrap currently segfault?
> 
> FWIW I couldn't reproduce the segfault.  I used the same
> "/proc/sys/dev/cdrom/info" as in the bug report and got fine behavior.

Oh, I tried. Detach your cdrom drives and boot bf2.4. You get the
flashing screen syndrome. Reattached the driver - works. So I rebuilt
BFs, hacked root to remove duplicated libs and fit on the floppy.
Rebootet - same game. Works with an attached CD drive, crashes without
it. Looks like my patch would net help to solve the real problem,
whatever it is.

Gruss/Regards,
Eduard.
-- 
Diagnose? Erklärungen? Reproduzierbare Lösungen? Sowas wollen nur
Leute, die von EDV nichts verstehen.


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




Re: dboostrap segfault with no CDROM drive

2002-02-20 Thread David Kimdon

Wed, Feb 20, 2002 at 03:48:53PM -0800 wrote:
> On Wed, Feb 20, 2002 at 11:18:03PM +0100, Eduard Bloch wrote:
> > David Kimdon wrote on Tue Feb 19, 2002 um 08:33:42PM:
> > > There is a note in choose_medium.c that indicates we are assuming this
> > > file ("/proc/sys/dev/cdrom/info") will not exist if there is no cdrom
> > > present.  It appears as though we are wrong. I'll take a look at how
> > > to deal with this more gracefully than SIGSEGV.
> > 
> > Okay, I rewrote have_cdrom(), moving it to util.c and made other parts
> > that used the procfs file to trough have_cdrom first. Please test the
> > attached patch. I currently cannot because of the UTF8 trouble, and no
> > time to look how to fix it.
> 
> Where does dbootstrap currently segfault?

FWIW I couldn't reproduce the segfault.  I used the same
"/proc/sys/dev/cdrom/info" as in the bug report and got fine behavior.


-David


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




Re: dboostrap segfault with no CDROM drive

2002-02-20 Thread Matt Kraai

On Wed, Feb 20, 2002 at 11:18:03PM +0100, Eduard Bloch wrote:
> David Kimdon wrote on Tue Feb 19, 2002 um 08:33:42PM:
> > There is a note in choose_medium.c that indicates we are assuming this
> > file ("/proc/sys/dev/cdrom/info") will not exist if there is no cdrom
> > present.  It appears as though we are wrong. I'll take a look at how
> > to deal with this more gracefully than SIGSEGV.
> 
> Okay, I rewrote have_cdrom(), moving it to util.c and made other parts
> that used the procfs file to trough have_cdrom first. Please test the
> attached patch. I currently cannot because of the UTF8 trouble, and no
> time to look how to fix it.

Where does dbootstrap currently segfault?

Matt



msg15923/pgp0.pgp
Description: PGP signature


Re: dboostrap segfault with no CDROM drive

2002-02-20 Thread Eduard Bloch

#include 
David Kimdon wrote on Tue Feb 19, 2002 um 08:33:42PM:
> There is a note in choose_medium.c that indicates we are assuming this
> file ("/proc/sys/dev/cdrom/info") will not exist if there is no cdrom
> present.  It appears as though we are wrong. I'll take a look at how
> to deal with this more gracefully than SIGSEGV.

Okay, I rewrote have_cdrom(), moving it to util.c and made other parts
that used the procfs file to trough have_cdrom first. Please test the
attached patch. I currently cannot because of the UTF8 trouble, and no
time to look how to fix it.

Gruss/Regards,
Eduard.
-- 
"Perfection is reached, not when is nothing more to add, but when
there is nothing more to take away."  -- Antoine de Sainte Exupery.


RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/choose_medium.c,v
retrieving revision 1.132
diff -u -r1.132 choose_medium.c
--- choose_medium.c 2002/02/07 04:00:25 1.132
+++ choose_medium.c 2002/02/20 22:12:55
@@ -664,44 +664,6 @@
 }
 
 
-/*
- * "/proc/sys/dev/cdrom/info", on bittersweet, contains:
- * 8<->8
- * CD-ROM information, Id: cdrom.c 2.56 1999/09/09
- *
- * drive name: sr0 hdd
- * drive speed:6   4
- * drive # of slots:   1   0
- * Can close tray: 1   1
- * Can open tray:  1   1
- * Can lock tray:  1   1
- * Can change speed:   1   1
- * Can select disk:0   0
- * Can read multisession:  1   1
- * Can read MCN:   1   1
- * Reports media changed:  1   1
- * Can play audio: 1   1
- *
- *
- * 8<->8
- *
- * Note that there are actually tab characters in the file; I've
- * untabified so it stays lined up in this comment.  I have verified
- * that this file does not exist on a machine with no CDROM attached.
- * - karlheg 2000.03.20
- * Linux bittersweet 2.2.14 #9 Fri Mar 17 00:50:19 PST 2000 i586 unknown
- */
-
-int
-have_cdrom ()
-{
-struct stat statbuf;
-int status;
-if ((status = stat("/proc/sys/dev/cdrom/info", &statbuf)) == 0)
-   return 1;
-return 0;
-}
-
 static
 char *
 get_cd_type_description (const char *dev)
@@ -755,7 +717,7 @@
 
 /* Should be guaranteed on entry that the cd_info file exists - use have_cdrom() 
*/
 /*  I get a warning here about assignment makes pointer from integer without 
a cast.  Why?? */
-if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) == NULL) {
+if (have_cdrom() && (cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) == NULL) {
return; /* ¿ Shouldn't happen if I can stat it, right ? */
 }
 
Index: reboot_system.c
===
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/reboot_system.c,v
retrieving revision 1.24
diff -u -r1.24 reboot_system.c
--- reboot_system.c 2001/12/21 07:54:45 1.24
+++ reboot_system.c 2002/02/20 22:12:55
@@ -33,7 +33,7 @@
   char *p_line,*line = NULL;
   size_t line_size = 0;
   char bootmagic='\0';
-  if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL)
+  if (have_cdrom() && (cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL)
   {
 /* successfull, continuing */
 
Index: util.c
===
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/util.c,v
retrieving revision 1.69
diff -u -r1.69 util.c
--- util.c  2002/02/10 19:30:14 1.69
+++ util.c  2002/02/20 22:12:59
@@ -1115,5 +1115,52 @@
 }
 
 
+/*
+ * "/proc/sys/dev/cdrom/info", on bittersweet, contains:
+ * 8<->8
+ * CD-ROM information, Id: cdrom.c 2.56 1999/09/09
+ *
+ * drive name: sr0 hdd
+ * drive speed:6   4
+ * drive # of slots:   1   0
+ * Can close tray: 1   1
+ * Can open tray:  1   1
+ * Can lock tray:  1   1
+ * Can change speed:   1   1
+ * Can select disk:0   0
+ * Can read multisession:  1   1
+ * Can read MCN:   1   1
+ * Reports media changed:  1   1
+ * Can play audio: 1   1
+ *
+ *
+ * 8<->8
+ *
+ * Note that there are actually tab characters in the file; I've
+ * untabified so it stays lined up in this comment.  I have verified
+ * that this file does not exist on a machine with no CDROM attached.
+ * - karlheg 2000.03.20
+ * Linux bittersweet 2.2.14 #9 Fri Mar 17 00:50:19 PST 2000 i586 unknown
+ */
 
+int
+have_cdrom ()
+{
+FILE *cd_info;
+char *line = NULL;
+size_t line_size = 0;
+if ((cd_info = fopen ("/proc/sys/dev/cdrom/info", "r")) != NULL) {
+   /* Read the file and build a list of available CD devices. */
+   getline (&line, &line_size, cd_info);
+   getline (&line, &line_size, cd_info);
+   getlin

Re: dboostrap segfault with no CDROM drive

2002-02-19 Thread Eduard Bloch

#include 
David Kimdon wrote on Tue Feb 19, 2002 um 08:33:42PM:
> There is a note in choose_medium.c that indicates we are assuming this
> file ("/proc/sys/dev/cdrom/info") will not exist if there is no cdrom
> present.  It appears as though we are wrong. I'll take a look at how
> to deal with this more gracefully than SIGSEGV.

Argh. This does also affect bf2.4 on i386, and maybe the
user-warning-on-bootable-cdrom routine which used the same code.

Gruss/Regards,
Eduard.
-- 
 The three Rs of Microsoft support: Retry, Reboot, Reinstall.


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




Re: dboostrap segfault with no CDROM drive

2002-02-19 Thread David Kimdon

There is a note in choose_medium.c that indicates we are assuming this
file ("/proc/sys/dev/cdrom/info") will not exist if there is no cdrom
present.  It appears as though we are wrong. I'll take a look at how
to deal with this more gracefully than SIGSEGV.

-David

Tue, Feb 19, 2002 at 07:54:35PM +0100 wrote:
> Hi,
> 
> Sorry, I haven't found dbootstrap in the BTS, and it's late.
> I try to install debian 3.0 on a non standard mipsel target (IDT r4k based).
> There's net and IDE support, no floppy. My custom kernel is already working 
> fine.
> Actually, I've downloaded the bf-pre3.0.20cvs20020217 root.bin,
> dd'ed to a temporary partition, and booted with "root=/dev/hdc2".
> 
> Well, the problem is with dbootstrap. It segs fault if there's no cdrom
> drive attached to the IDE chain. Following is a strace of dbootstrap
> illustrating the problem. The bug seems to lie with the content of
> /proc/sys/dev/cdrom/info.
> 
> 
> open("/proc/sys/kernel/osrelease", O_RDONLY) = 3
> fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
> 0x2aac4000
> read(3, "2.4.17-mips\n", 1024)  = 12
> close(3)= 0
> munmap(0x2aac4000, 4096)= 0
> open("/proc/cpuinfo", O_RDONLY) = 3
> fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
> 0x2aac4000
> read(3, "system type\t\t: IDT Homelink\nproc"..., 1024) = 249
> close(3)= 0
> munmap(0x2aac4000, 4096)= 0
> open("/proc/sys/dev/cdrom/info", O_RDONLY) = 3
> fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
> 0x2aac4000
> read(3, "CD-ROM information, Id: cdrom.c "..., 1024) = 343
> --- SIGSEGV (Segmentation fault) ---
> +++ killed by SIGSEGV +++
> # cat /proc/sys/dev/cdrom/info
> CD-ROM information, Id: cdrom.c 3.12 2000/10/18
> 
> drive name:
> drive speed:
> drive # of slots:
> Can close tray:
> Can open tray:
> Can lock tray:
> Can change speed:
> Can select disk:
> Can read multisession:
> Can read MCN:
> Reports media changed:
> Can play audio:
> Can write CD-R:
> Can write CD-RW:
> Can read DVD:
> Can write DVD-R:
> Can write DVD-RAM:
> 
> 
> # 
> 
> Now, if I plug an old crappy CDROM drive along to my hdc HD,
> dbootstrap works fine. Here's the content of the troublesome proc file,
> in the event it helps in fixing dbootstrap source code.
> 
> 
> # cat /proc/sys/dev/cdrom/info
> CD-ROM information, Id: cdrom.c 3.12 2000/10/18
>  
>  drive name: hdd
>  drive speed:9
>  drive # of slots:   1
>  Can close tray: 0
>  Can open tray:  1
>  Can lock tray:  1
>  Can change speed:   1
>  Can select disk:0
>  Can read multisession:  1
>  Can read MCN:   1
>  Reports media changed:  1
>  Can play audio: 1
>  Can write CD-R: 0
>  Can write CD-RW:0
>  Can read DVD:   0
>  Can write DVD-R:0
>  Can write DVD-RAM:  0
>   
>
> # uname -a
> Linux 10.0.0.4 2.4.17-mips #156 mar fiv 19 13:15:35 CET 2002 mips unknown
> 
> 
> 
> 
> Cheers,
>  Stephane
> 
> PS: I'm not subscribed to the list.
> 
> 
> -- 
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 
> 


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




Re: dboostrap segfault with no CDROM drive

2002-02-19 Thread Florian Lohoff

On Tue, Feb 19, 2002 at 07:54:35PM +0100, Stephane Fillod wrote:
> read(3, "CD-ROM information, Id: cdrom.c "..., 1024) = 343
> --- SIGSEGV (Segmentation fault) ---
> +++ killed by SIGSEGV +++
> # cat /proc/sys/dev/cdrom/info
> CD-ROM information, Id: cdrom.c 3.12 2000/10/18
> 
> drive name:
> drive speed:

I guess this does not happen on other archs ? Did anyone verify ? So
i suspect the compilers fault :)

Did you try building dbootstrap with debugging symbols and try to debug
it with gdb ?

Flo
-- 
Florian Lohoff  [EMAIL PROTECTED] +49-5201-669912
Nine nineth on september the 9th  Welcome to the new billenium



msg15886/pgp0.pgp
Description: PGP signature