Bug 39745 - Xconfigurator --kickstart fails to read video memory size
Summary: Xconfigurator --kickstart fails to read video memory size
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: Xconfigurator
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mike A. Harris
QA Contact: David Lawrence
URL:
Whiteboard:
: 53598 64695 65487 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-09 00:17 UTC by Fred Feirtag
Modified: 2007-04-18 16:33 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-01-10 15:23:51 UTC
Embargoed:


Attachments (Terms of Use)

Description Fred Feirtag 2001-05-09 00:17:56 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.3-diskless i686)

Description of problem:
Xconfigurator --kickstart fails for cards that report:
(--) ATI(0): 8192 kB of SDRAM (1:1) detected.
because it's looking for the last colon in the line (strrchr)

How reproducible:
Always

Steps to Reproduce:
1.Use any video card that reports as in the description
2.run Xconfigurator --kickstart
3."Fatal error: Invalid amount of video memory." will appear
	

Actual Results:  --kickstart function failed with above error

Expected Results:  an /etc/X11/XF86Config-4 file to be created

Additional info:

Since Xconfigurator.c (version 4.9.29) searches for
"kB of S[DG]RAM", it seems safer to key off this string
and work backwards, rather than look at colons, at all.
Here is patch:
--- Xconfigurator.c     Fri Apr 27 09:48:33 2001
+++ Xconfigurator.c.fixed       Tue May  8 17:04:51 2001
@@ -3173,9 +3173,9 @@
        char *s, *t, *e;
        int vram;
 
-       s = strrchr(buf, ':');
-       for (s=s+1; *s && !isdigit(*s); s++);
-       for (t=s; *t && isdigit(*t); t++);
+       s = strstr(buf, " kB");
+       for (s--; *(s-1) && isdigit(*(s-1)); s--);
+       for (t=s+1; *t && isdigit(*t); t++);
        *t = '\0';
        vram = strtol(s, &e, 10);

Comment 1 Fred Feirtag 2001-05-11 01:34:06 UTC
The patch I previously entered works, but the following patch
is more correct.  Overall, even if the problem of having X report
with an unexpected colon character is not widespread among all
possible video cards, the search pattern used in processing the "kB"
of video memory string should EXACTLY match the search of the prior
grep--anything else would seem to introduce unnecessary risk.

The card I have with X reporting:
(--) ATI(0): 8192 kB of SDRAM (1:1) detected.
is (lspci)
01:00.0 VGA compatible controller: ATI Technologies Inc 3D Rage Pro AGP 1X/2X
(rev 5c)

Revised suggested patch:
--- Xconfigurator.c     Thu May 10 19:20:14 2001
+++ Xconfigurator.c.fixed       Thu May 10 19:20:04 2001
@@ -3170,13 +3170,15 @@
 
     f = fopen(tfilenm3, "r");
     if (fgets(buf, 8192, f)) {
-       char *s, *t, *e;
+       char *s, *e;
        int vram;
 
-       s = strrchr(buf, ':');
-       for (s=s+1; *s && !isdigit(*s); s++);
-       for (t=s; *t && isdigit(*t); t++);
-       *t = '\0';
+       /* locate sentinal, as found in prior grep */
+       s = strstr(buf, "kB of S");
+       /* enter null byte(s) after size string to make it ASCIZ */
+        for (; *(s-1) && ! isdigit(*(s-1)); s--, *s = '\0');
+       /* locate the beginning of the size string */
+       for (; *(s-1) && isdigit(*(s-1)); s--);
        vram = strtol(s, &e, 10);
 
        if (e != s && *e == 0 && vram > 0) {



Comment 2 Mike A. Harris 2001-05-22 09:27:09 UTC
Hmm, thanks for bringing this to our attention, and doubly so for the patch!
I will fix this matter next time I am digging into Xconfigurator.

Thanks, again!

Comment 3 Mike A. Harris 2002-05-30 22:13:50 UTC
*** Bug 53598 has been marked as a duplicate of this bug. ***

Comment 4 Mike A. Harris 2003-04-20 17:04:31 UTC
*** Bug 65487 has been marked as a duplicate of this bug. ***

Comment 5 Mike A. Harris 2003-04-20 17:04:50 UTC
*** Bug 64695 has been marked as a duplicate of this bug. ***

Comment 6 Mike A. Harris 2003-04-20 17:06:35 UTC
Bug #64695 has an alternative patch attached also:

http://bugzilla.redhat.com/bugzilla/attachment.cgi?id=70164&action=view

Comment 7 Mike A. Harris 2004-01-10 15:23:51 UTC
Xconfigurator never ended up getting any erratum, and is now no
longer supported, as all versions of Red Hat Linux which shipped
with Xconfigurator are discontinued at the end of December 2003.

Since Red Hat Linux 8.0 however, we have replaced Xconfigurator
with a new tool "redhat-config-xfree86", which will be renamed
soon to "system-config-x" or something similar, so this problem
is solved in our current OS releases due to Xconfigurator's
obsolescence now.

Closing as CURRENTRELEASE.



Note You need to log in before you can comment on or make changes to this bug.