Subject: Re: xsrc/15443: XFree86 3.3.6 does not compile
To: <>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 01/31/2002 11:25:14
[somewhat snipped...]
> 
> Attempting to compile XFree86 3.3.6 using the source contained in
> xsrc.tar.gz from ftp.netbsd.org will fail on NetBSD-current versions
> when the version number contains two letters, as is the case currently
> with NetBSD 1.5ZA.
 
> The problem occurs when the version string returned by "uname -r"
> includes two or more letters.  The macro DEFAULT_OS_TEENY_REV_FROB
> only looks at the first such letter to determine a "teeny revision
> number", and hence this number never gets incremented past 26.  (The
> numbering starts with "A" = 1.)
 
> The Imakefile in programs/Xserver/hw/xfree86/common contains the following
> check which fails because the OSTeenyVersion is not greater than 26:
> 
> #     if (OSMajorVersion == 1 && OSMinorVersion > 5) || \
> (OSMajorVersion == 1 && OSMinorVersion == 5 && OSTeenyVersion > 26)
>          ARCH_USB = /usr/lib/libusbhid_pic.a
> #     else
>          ARCH_USB = /usr/lib/libusb_pic.a
> #     endif
> 
> Since libusbhid_pic became available in NetBSD-1.5ZA imake should realize
> set the value for OSTeenyVersion to 27 but does not. The following is
> a patch for XFree86 3.3.6 that solves this problem:
> 
> Index: imakemdep.h
> ===================================================================
> RCS file: /cvsroot/xsrc/xc/config/imake/imakemdep.h,v
> retrieving revision 1.10
> diff -u -r1.10 imakemdep.h
> --- imakemdep.h 2001/10/08 23:24:59     1.10
> +++ imakemdep.h 2002/01/24 13:51:54
> @@ -719,10 +719,15 @@
>  # define DEFAULT_OS_TEENY_REV   "r %*d.%*d%[A-Z]"
>  # define DEFAULT_OS_TEENY_REV_FROB(buf, size)                          \
>      do {                                                               \
> -       if (*(buf) >= 'A' && *(buf) <= 'Z') /* sanity check */          \
> -               snprintf((buf), (size), "%d", *(buf) - 'A' + 1);        \
> +       char *p;                                                        \
> +       int i;                                                          \
> +       i = 0;                                                          \
> +       for (p=(buf); *p && *p >= 'A' && *p <= 'Z' ; p++)               \
> +         i += *p - 'A' + 1;                                            \
> +       if (*p)                                                         \
> +         *(buf) = '\0';                                                \
>         else                                                            \
> -           *(buf) = '\0';                                              \
> +         snprintf((buf), (size), "%d", i);                             \
>      } while (0)
>  # define DEFAULT_OS_NAME        "smr %[^\n]"
>  # define DEFAULT_OS_NAME_FROB(buf, size)                               \
> 
> This fix in this patch needs to be implemented in the same file for
> XFree86 4.2 as well. The file for XFree86 4.2 is newer than the one
> for XFree86 3.3.6 so the above fix will have to be manually added.

I don't think this is the correct fix.
Version 1.5AZ would be give the same TEENY_REV as 1.5ZA and they are
cleary different!

Maybe it would be better to change the > 26 to >= 26.  I suspect the
1.5Zx releases are just the 'last' 1.5 ones.  All a cunning ploy to
avoid calling things 1.6 before it is anything like stable.

	David