NetBSD Problem Report #46827

From www@NetBSD.org  Thu Aug 23 11:47:46 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 3DECF63B882
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 23 Aug 2012 11:47:46 +0000 (UTC)
Message-Id: <20120823114745.8D9D763B85F@www.NetBSD.org>
Date: Thu, 23 Aug 2012 11:47:45 +0000 (UTC)
From: rftmhmd@gmail.com
Reply-To: rftmhmd@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Cannot build the kernel, even Generic.
X-Send-Pr-Version: www-1.0

>Number:         46827
>Category:       toolchain
>Synopsis:       Cannot build the kernel, even Generic.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 23 11:50:00 +0000 2012
>Closed-Date:    Wed Nov 05 05:30:19 +0000 2014
>Last-Modified:  Wed Nov 05 05:30:19 +0000 2014
>Originator:     RIfat Mahmud
>Release:        5.1 source cd ISO
>Organization:
>Environment:
Linux rifat-K40IJ 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:41:14 UTC 2012 i686 i686 i386 GNU/Linux

>Description:
I downloaded the NetBSD source, ran './build.sh -m i386 tools', as my plan is to run the NetBSD on QEMU and Virtualbox. Build log is huge, it is quite impossible for me to find out any unfinished build, but I think building tools is successful, because it ends without any error.
Then I tried '..../nbconfig .../GENERIC', it says, cannot configure GENERIC. I tried new './build.sh -m i386 kernel=GENERIC', it shows error, and ends with it: http://pastebin.com/9hsmR1qd

I have libbsd-dev, libncurses-dev, pmake, etc. installed(As mentioned in ../compat/README

>How-To-Repeat:
Have a machine of my kind. I'm running Linux Mint 13 Maya on ASUS K40IJ Laptop, 2 GB RAM, CPU Pentium T4300.gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Extract all the sources in /home/'User'/Documents/NetBSD.

Run './build.sh -m i386 tools' or './build.sh -m i386 -O obj tools'

Should end without error.

Then run '/build.sh -m i386 kernel=GENERIC'

It'll not end successfully and gives this error(involving libcompat):http://pastebin.com/9hsmR1qd

I reproduced this around 15 time.
>Fix:

>Release-Note:

>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Thu, 23 Aug 2012 08:00:39 -0400

 On Aug 23, 11:50am, rftmhmd@gmail.com (rftmhmd@gmail.com) wrote:
 -- Subject: toolchain/46827: Cannot build the kernel, even Generic.

 | Then run '/build.sh -m i386 kernel=GENERIC'
 | 

 Looks like a buffer overflow bug in "ar". 

 Can you apply this patch to src/gnu/dist/binutils/binutils?

 --- arsup.c     2009/11/07 17:58:34     1.2
 +++ arsup.c     2012/08/23 11:58:53
 @@ -157,7 +157,7 @@
    char *name;
    int t;
  {
 -  char *tname = (char *) xmalloc (strlen (name) + 10);
 +  char *tname = (char *) xmalloc (4096);
    const char *bname = lbasename (name);
    real_name = name;

 christos

From: Rifat Mahmud <rftmhmd@gmail.com>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Thu, 23 Aug 2012 18:55:32 +0600

 --047d7b621e40f49ee604c7ee5f9f
 Content-Type: text/plain; charset=ISO-8859-1

 Applied the patch, still same error.

 On Thu, Aug 23, 2012 at 6:05 PM, Christos Zoulas <christos@zoulas.com>wrote:

 > The following reply was made to PR toolchain/46827; it has been noted by
 > GNATS.
 >
 > From: christos@zoulas.com (Christos Zoulas)
 > To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
 >         gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 > Cc:
 > Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 > Date: Thu, 23 Aug 2012 08:00:39 -0400
 >
 >  On Aug 23, 11:50am, rftmhmd@gmail.com (rftmhmd@gmail.com) wrote:
 >  -- Subject: toolchain/46827: Cannot build the kernel, even Generic.
 >
 >  | Then run '/build.sh -m i386 kernel=GENERIC'
 >  |
 >
 >  Looks like a buffer overflow bug in "ar".
 >
 >  Can you apply this patch to src/gnu/dist/binutils/binutils?
 >
 >  --- arsup.c     2009/11/07 17:58:34     1.2
 >  +++ arsup.c     2012/08/23 11:58:53
 >  @@ -157,7 +157,7 @@
 >     char *name;
 >     int t;
 >   {
 >  -  char *tname = (char *) xmalloc (strlen (name) + 10);
 >  +  char *tname = (char *) xmalloc (4096);
 >     const char *bname = lbasename (name);
 >     real_name = name;
 >
 >  christos
 >
 >

 --047d7b621e40f49ee604c7ee5f9f
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable

 Applied the patch, still same error.<br><br><div class=3D"gmail_quote">On T=
 hu, Aug 23, 2012 at 6:05 PM, Christos Zoulas <span dir=3D"ltr">&lt;<a href=
 =3D"mailto:christos@zoulas.com" target=3D"_blank">christos@zoulas.com</a>&g=
 t;</span> wrote:<br>
 <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
 x #ccc solid;padding-left:1ex">The following reply was made to PR toolchain=
 /46827; it has been noted by GNATS.<br>
 <br>
 From: <a href=3D"mailto:christos@zoulas.com">christos@zoulas.com</a> (Chris=
 tos Zoulas)<br>
 To: gnats-bugs@NetBSD.org, <a href=3D"mailto:toolchain-manager@netbsd.org">=
 toolchain-manager@netbsd.org</a>,<br>
 =A0 =A0 =A0 =A0 <a href=3D"mailto:gnats-admin@netbsd.org">gnats-admin@netbs=
 d.org</a>, <a href=3D"mailto:netbsd-bugs@netbsd.org">netbsd-bugs@netbsd.org=
 </a><br>
 Cc:<br>
 Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.<br>
 Date: Thu, 23 Aug 2012 08:00:39 -0400<br>
 <br>
 =A0On Aug 23, 11:50am, <a href=3D"mailto:rftmhmd@gmail.com">rftmhmd@gmail.c=
 om</a> (<a href=3D"mailto:rftmhmd@gmail.com">rftmhmd@gmail.com</a>) wrote:<=
 br>
 =A0-- Subject: toolchain/46827: Cannot build the kernel, even Generic.<br>
 <br>
 =A0| Then run &#39;/build.sh -m i386 kernel=3DGENERIC&#39;<br>
 =A0|<br>
 <br>
 =A0Looks like a buffer overflow bug in &quot;ar&quot;.<br>
 <br>
 =A0Can you apply this patch to src/gnu/dist/binutils/binutils?<br>
 <br>
 =A0--- arsup.c =A0 =A0 2009/11/07 17:58:34 =A0 =A0 1.2<br>
 =A0+++ arsup.c =A0 =A0 2012/08/23 11:58:53<br>
 =A0@@ -157,7 +157,7 @@<br>
 =A0 =A0 char *name;<br>
 =A0 =A0 int t;<br>
 =A0 {<br>
 =A0- =A0char *tname =3D (char *) xmalloc (strlen (name) + 10);<br>
 =A0+ =A0char *tname =3D (char *) xmalloc (4096);<br>
 =A0 =A0 const char *bname =3D lbasename (name);<br>
 =A0 =A0 real_name =3D name;<br>
 <br>
 =A0christos<br>
 <br>
 </blockquote></div><br>

 --047d7b621e40f49ee604c7ee5f9f--

From: christos@zoulas.com (Christos Zoulas)
To: Rifat Mahmud <rftmhmd@gmail.com>, gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Thu, 23 Aug 2012 09:30:06 -0400

 On Aug 23,  6:55pm, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

 | Applied the patch, still same error.

 Must be a different sprintf(). Can you run the failing ar command in
 the debugger (gdb) and print a stack trace.

 I am trying to find out which functions are in:

 /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804de56]
 /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804fef0]
 /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x8056fbb]
 /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804aee5]
 /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804bfb1]
 /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7214d3]

 Alternatively run nm in your unstripped ar binary and see which function is
 around 0x804de56.

 christos

From: Rifat Mahmud <rftmhmd@gmail.com>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, 
	netbsd-bugs@netbsd.org
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Thu, 23 Aug 2012 23:54:47 +0600

 Here it is:

 http://pastebin.com/rcbUvCwF

 On 8/23/12, Christos Zoulas <christos@zoulas.com> wrote:
 > The following reply was made to PR toolchain/46827; it has been noted by
 > GNATS.
 >
 > From: christos@zoulas.com (Christos Zoulas)
 > To: Rifat Mahmud <rftmhmd@gmail.com>, gnats-bugs@netbsd.org
 > Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
 > 	netbsd-bugs@netbsd.org
 > Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 > Date: Thu, 23 Aug 2012 09:30:06 -0400
 >
 >  On Aug 23,  6:55pm, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 >  -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 >
 >  | Applied the patch, still same error.
 >
 >  Must be a different sprintf(). Can you run the failing ar command in
 >  the debugger (gdb) and print a stack trace.
 >
 >  I am trying to find out which functions are in:
 >
 > /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804de56]
 > /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804fef0]
 > /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x8056fbb]
 > /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804aee5]
 > /home/rifat/Documents/Net/usr/src/tooldir.Linux-3.2.0-23-generic-i686/bin/i386--netbsdelf-ar[0x804bfb1]
 >  /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7214d3]
 >
 >  Alternatively run nm in your unstripped ar binary and see which function
 > is
 >  around 0x804de56.
 >
 >  christos
 >
 >

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Thu, 23 Aug 2012 23:56:57 +0000

 not sent to the database address (gnats-bugs)

    ------

 From: Rifat Mahmud <rftmhmd@gmail.com>
 To: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
 	netbsd-bugs@netbsd.org, rftmhmd@gmail.com
 Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 Date: Fri, 24 Aug 2012 01:14:38 +0600

 I think, the problem might be about version conflict GNU coreutils,
 binutils and gcc in Linux and NetBSD. NetBSD codes might not be compatible
 with latest utilities in Linux, the tool building commands show many
 warnings about versions of bison etc.

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 08:08:55 +0100

 On Thu, Aug 23, 2012 at 11:50:01AM +0000, rftmhmd@gmail.com wrote:
 > >Synopsis:       Cannot build the kernel, even Generic.
 ...
 > Then run '/build.sh -m i386 kernel=GENERIC'
 > 
 > It'll not end successfully and gives this error(involving libcompat):http://pastebin.com/9hsmR1qd
 > 
 > I reproduced this around 15 time.

 Does it fail if you rerun the command outside of the build system?
 (The full command line is in the debug info.)
 Debugging will be easier if it does.
 Try reducing the number of input files on the command line - the
 bug might be caused by one specific file, or by the number of files.

 Run 'ulimit -c unlimited' in the shell before running the command
 so that the 'abort' generates a core dump.

 run 'gdb full_path_to_ar core_file' then 'bt' to get a back trace.
 The arguments to sprintf() are likely to be useful - the format
 string might identify the faulting call, and the associated
 arguments why it goes wrong.

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Rifat Mahmud <rftmhmd@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 14:18:05 +0600

 --047d7b603c129107ec04c7fe9dc6
 Content-Type: text/plain; charset=ISO-8859-1

 > Does it fail if you rerun the command outside of the build system?
 Yes. That's how I debugged it. I gave the the backtrace result in the 7th
 mail. Here it is again.

 On Fri, Aug 24, 2012 at 1:20 PM, David Laight <david@l8s.co.uk> wrote:

 > The following reply was made to PR toolchain/46827; it has been noted by
 > GNATS.
 >
 > From: David Laight <david@l8s.co.uk>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 > Date: Fri, 24 Aug 2012 08:08:55 +0100
 >
 >  On Thu, Aug 23, 2012 at 11:50:01AM +0000, rftmhmd@gmail.com wrote:
 >  > >Synopsis:       Cannot build the kernel, even Generic.
 >  ...
 >  > Then run '/build.sh -m i386 kernel=GENERIC'
 >  >
 >  > It'll not end successfully and gives this error(involving libcompat):
 > http://pastebin.com/9hsmR1qd
 >  >
 >  > I reproduced this around 15 time.
 >
 >  Does it fail if you rerun the command outside of the build system?
 >  (The full command line is in the debug info.)
 >  Debugging will be easier if it does.
 >  Try reducing the number of input files on the command line - the
 >  bug might be caused by one specific file, or by the number of files.
 >
 >  Run 'ulimit -c unlimited' in the shell before running the command
 >  so that the 'abort' generates a core dump.
 >
 >  run 'gdb full_path_to_ar core_file' then 'bt' to get a back trace.
 >  The arguments to sprintf() are likely to be useful - the format
 >  string might identify the faulting call, and the associated
 >  arguments why it goes wrong.
 >
 >         David
 >
 >  --
 >  David Laight: david@l8s.co.uk
 >
 >

 --047d7b603c129107ec04c7fe9dc6
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable

 <span style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:1=
 3px;background-color:rgb(255,255,255)">&gt; Does it fail if you rerun the c=
 ommand outside of the build system?</span><br>Yes. That&#39;s how I debugge=
 d it. I gave the the backtrace result in the 7th mail. Here it is again.<di=
 v>
 <br><div class=3D"gmail_quote">On Fri, Aug 24, 2012 at 1:20 PM, David Laigh=
 t <span dir=3D"ltr">&lt;<a href=3D"mailto:david@l8s.co.uk" target=3D"_blank=
 ">david@l8s.co.uk</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote=
 " style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 <div class=3D"im">The following reply was made to PR toolchain/46827; it ha=
 s been noted by GNATS.<br>
 <br>
 </div>From: David Laight &lt;<a href=3D"mailto:david@l8s.co.uk">david@l8s.c=
 o.uk</a>&gt;<br>
 To: gnats-bugs@NetBSD.org<br>
 <div class=3D"im">Cc:<br>
 Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.<br>
 </div>Date: Fri, 24 Aug 2012 08:08:55 +0100<br>
 <br>
 =A0On Thu, Aug 23, 2012 at 11:50:01AM +0000, <a href=3D"mailto:rftmhmd@gmai=
 l.com">rftmhmd@gmail.com</a> wrote:<br>
 =A0&gt; &gt;Synopsis: =A0 =A0 =A0 Cannot build the kernel, even Generic.<br=
 >
 =A0...<br>
 <div class=3D"im">=A0&gt; Then run &#39;/build.sh -m i386 kernel=3DGENERIC&=
 #39;<br>
 =A0&gt;<br>
 </div>=A0&gt; It&#39;ll not end successfully and gives this error(involving=
  libcompat):<a href=3D"http://pastebin.com/9hsmR1qd" target=3D"_blank">http=
 ://pastebin.com/9hsmR1qd</a><br>
 =A0&gt;<br>
 =A0&gt; I reproduced this around 15 time.<br>
 <br>
 =A0Does it fail if you rerun the command outside of the build system?<br>
 =A0(The full command line is in the debug info.)<br>
 =A0Debugging will be easier if it does.<br>
 =A0Try reducing the number of input files on the command line - the<br>
 =A0bug might be caused by one specific file, or by the number of files.<br>
 <br>
 =A0Run &#39;ulimit -c unlimited&#39; in the shell before running the comman=
 d<br>
 =A0so that the &#39;abort&#39; generates a core dump.<br>
 <br>
 =A0run &#39;gdb full_path_to_ar core_file&#39; then &#39;bt&#39; to get a b=
 ack trace.<br>
 =A0The arguments to sprintf() are likely to be useful - the format<br>
 =A0string might identify the faulting call, and the associated<br>
 =A0arguments why it goes wrong.<br>
 <br>
 =A0 =A0 =A0 =A0 David<br>
 <br>
 =A0--<br>
 =A0David Laight: <a href=3D"mailto:david@l8s.co.uk">david@l8s.co.uk</a><br>
 <br>
 </blockquote></div><br></div>

 --047d7b603c129107ec04c7fe9dc6--

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, rftmhmd@gmail.com
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 06:37:06 -0400

 On Aug 24,  7:20am, david@l8s.co.uk (David Laight) wrote:
 -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

 Try this:

 christos

 --- archive.c	2009/11/07 17:58:17	1.9
 +++ archive.c	2012/08/24 10:36:04
 @@ -1325,7 +1325,7 @@
    struct ar_hdr *hdr;
    char *temp, *temp1;
    bfd_size_type amt;
 -  char tmpbuf[11];
 +  char tmpbuf[1024];

    if (member && (member->flags & BFD_IN_MEMORY) != 0)
      {
 @@ -1365,7 +1365,8 @@
    strncpy (hdr->ar_fmag, ARFMAG, 2);

    /* Goddamned sprintf doesn't permit MAXIMUM field lengths.  */
 -  sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
 +  sprintf (tmpbuf, "%-12ld", (long) status.st_mtime);
 +  memcpy(hdr->ar_date, tmpbuf, sizeof(hdr->ar_date));
  #ifdef HPUX_LARGE_AR_IDS
    /* HP has a very "special" way to handle UID/GID's with numeric values
       > 99999.  */
 @@ -1373,7 +1374,10 @@
      hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
    else
  #endif
 -    sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
 +  {
 +  sprintf (tmpbuf, "%ld", (long) status.st_uid);
 +  memcpy(hdr->ar_uid, tmpbuf, sizeof(hdr->ar_uid));
 +  }
  #ifdef HPUX_LARGE_AR_IDS
    /* HP has a very "special" way to handle UID/GID's with numeric values
       > 99999.  */
 @@ -1381,8 +1385,12 @@
      hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid);
    else
  #endif
 -  sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
 -  sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
 +  {
 +  sprintf (tmpbuf, "%ld", (long) status.st_gid);
 +  memcpy(hdr->ar_gid, tmpbuf, sizeof(hdr->ar_gid));
 +  }
 +  sprintf (tmpbuf, "%-8o", (unsigned int) status.st_mode);
 +  memcpy(hdr->ar_mode, tmpbuf, sizeof(hdr->ar_mode));
    sprintf (tmpbuf, "%-10ld", (long) status.st_size);
    memcpy(hdr->ar_size, tmpbuf, sizeof(hdr->ar_size));
    /* Correct for a lossage in sprintf whereby it null-terminates.  I cannot

From: Rifat Mahmud <rftmhmd@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 21:54:44 +0600

 --047d7b33daf4a9e6a304c804fe10
 Content-Type: text/plain; charset=ISO-8859-1

 In what folder should I apply the patch?

 On Fri, Aug 24, 2012 at 4:40 PM, Christos Zoulas <christos@zoulas.com>wrote:

 > The following reply was made to PR toolchain/46827; it has been noted by
 > GNATS.
 >
 > From: christos@zoulas.com (Christos Zoulas)
 > To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
 >         gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, rftmhmd@gmail.com
 > Cc:
 > Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 > Date: Fri, 24 Aug 2012 06:37:06 -0400
 >
 >  On Aug 24,  7:20am, david@l8s.co.uk (David Laight) wrote:
 >  -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 >
 >  Try this:
 >
 >  christos
 >
 >  --- archive.c  2009/11/07 17:58:17     1.9
 >  +++ archive.c  2012/08/24 10:36:04
 >  @@ -1325,7 +1325,7 @@
 >     struct ar_hdr *hdr;
 >     char *temp, *temp1;
 >     bfd_size_type amt;
 >  -  char tmpbuf[11];
 >  +  char tmpbuf[1024];
 >
 >     if (member && (member->flags & BFD_IN_MEMORY) != 0)
 >       {
 >  @@ -1365,7 +1365,8 @@
 >     strncpy (hdr->ar_fmag, ARFMAG, 2);
 >
 >     /* Goddamned sprintf doesn't permit MAXIMUM field lengths.  */
 >  -  sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime);
 >  +  sprintf (tmpbuf, "%-12ld", (long) status.st_mtime);
 >  +  memcpy(hdr->ar_date, tmpbuf, sizeof(hdr->ar_date));
 >   #ifdef HPUX_LARGE_AR_IDS
 >     /* HP has a very "special" way to handle UID/GID's with numeric values
 >        > 99999.  */
 >  @@ -1373,7 +1374,10 @@
 >       hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid);
 >     else
 >   #endif
 >  -    sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid);
 >  +  {
 >  +  sprintf (tmpbuf, "%ld", (long) status.st_uid);
 >  +  memcpy(hdr->ar_uid, tmpbuf, sizeof(hdr->ar_uid));
 >  +  }
 >   #ifdef HPUX_LARGE_AR_IDS
 >     /* HP has a very "special" way to handle UID/GID's with numeric values
 >        > 99999.  */
 >  @@ -1381,8 +1385,12 @@
 >       hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid);
 >     else
 >   #endif
 >  -  sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid);
 >  -  sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode);
 >  +  {
 >  +  sprintf (tmpbuf, "%ld", (long) status.st_gid);
 >  +  memcpy(hdr->ar_gid, tmpbuf, sizeof(hdr->ar_gid));
 >  +  }
 >  +  sprintf (tmpbuf, "%-8o", (unsigned int) status.st_mode);
 >  +  memcpy(hdr->ar_mode, tmpbuf, sizeof(hdr->ar_mode));
 >     sprintf (tmpbuf, "%-10ld", (long) status.st_size);
 >     memcpy(hdr->ar_size, tmpbuf, sizeof(hdr->ar_size));
 >     /* Correct for a lossage in sprintf whereby it null-terminates.  I
 > cannot
 >
 >

 --047d7b33daf4a9e6a304c804fe10
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable

 In what folder should I apply the patch?<br><br><div class=3D"gmail_quote">=
 On Fri, Aug 24, 2012 at 4:40 PM, Christos Zoulas <span dir=3D"ltr">&lt;<a h=
 ref=3D"mailto:christos@zoulas.com" target=3D"_blank">christos@zoulas.com</a=
 >&gt;</span> wrote:<br>
 <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
 x #ccc solid;padding-left:1ex"><div class=3D"im">The following reply was ma=
 de to PR toolchain/46827; it has been noted by GNATS.<br>
 <br>
 </div><div class=3D"im">From: <a href=3D"mailto:christos@zoulas.com">christ=
 os@zoulas.com</a> (Christos Zoulas)<br>
 To: gnats-bugs@NetBSD.org, <a href=3D"mailto:toolchain-manager@netbsd.org">=
 toolchain-manager@netbsd.org</a>,<br>
 </div>=A0 =A0 =A0 =A0 <a href=3D"mailto:gnats-admin@netbsd.org">gnats-admin=
 @netbsd.org</a>, <a href=3D"mailto:netbsd-bugs@netbsd.org">netbsd-bugs@netb=
 sd.org</a>, <a href=3D"mailto:rftmhmd@gmail.com">rftmhmd@gmail.com</a><br>
 Cc:<br>
 <div class=3D"im">Subject: Re: toolchain/46827: Cannot build the kernel, ev=
 en Generic.<br>
 </div>Date: Fri, 24 Aug 2012 06:37:06 -0400<br>
 <div class=3D"HOEnZb"><div class=3D"h5"><br>
 =A0On Aug 24, =A07:20am, <a href=3D"mailto:david@l8s.co.uk">david@l8s.co.uk=
 </a> (David Laight) wrote:<br>
 =A0-- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.<=
 br>
 <br>
 =A0Try this:<br>
 <br>
 =A0christos<br>
 <br>
 =A0--- archive.c =A02009/11/07 17:58:17 =A0 =A0 1.9<br>
 =A0+++ archive.c =A02012/08/24 10:36:04<br>
 =A0@@ -1325,7 +1325,7 @@<br>
 =A0 =A0 struct ar_hdr *hdr;<br>
 =A0 =A0 char *temp, *temp1;<br>
 =A0 =A0 bfd_size_type amt;<br>
 =A0- =A0char tmpbuf[11];<br>
 =A0+ =A0char tmpbuf[1024];<br>
 <br>
 =A0 =A0 if (member &amp;&amp; (member-&gt;flags &amp; BFD_IN_MEMORY) !=3D 0=
 )<br>
 =A0 =A0 =A0 {<br>
 =A0@@ -1365,7 +1365,8 @@<br>
 =A0 =A0 strncpy (hdr-&gt;ar_fmag, ARFMAG, 2);<br>
 <br>
 =A0 =A0 /* Goddamned sprintf doesn&#39;t permit MAXIMUM field lengths. =A0*=
 /<br>
 =A0- =A0sprintf ((hdr-&gt;ar_date), &quot;%-12ld&quot;, (long) status.st_mt=
 ime);<br>
 =A0+ =A0sprintf (tmpbuf, &quot;%-12ld&quot;, (long) status.st_mtime);<br>
 =A0+ =A0memcpy(hdr-&gt;ar_date, tmpbuf, sizeof(hdr-&gt;ar_date));<br>
 =A0 #ifdef HPUX_LARGE_AR_IDS<br>
 =A0 =A0 /* HP has a very &quot;special&quot; way to handle UID/GID&#39;s wi=
 th numeric values<br>
 =A0 =A0 =A0 =A0&gt; 99999. =A0*/<br>
 =A0@@ -1373,7 +1374,10 @@<br>
 =A0 =A0 =A0 hpux_uid_gid_encode (hdr-&gt;ar_gid, (long) status.st_uid);<br>
 =A0 =A0 else<br>
 =A0 #endif<br>
 =A0- =A0 =A0sprintf ((hdr-&gt;ar_uid), &quot;%ld&quot;, (long) status.st_ui=
 d);<br>
 =A0+ =A0{<br>
 =A0+ =A0sprintf (tmpbuf, &quot;%ld&quot;, (long) status.st_uid);<br>
 =A0+ =A0memcpy(hdr-&gt;ar_uid, tmpbuf, sizeof(hdr-&gt;ar_uid));<br>
 =A0+ =A0}<br>
 =A0 #ifdef HPUX_LARGE_AR_IDS<br>
 =A0 =A0 /* HP has a very &quot;special&quot; way to handle UID/GID&#39;s wi=
 th numeric values<br>
 =A0 =A0 =A0 =A0&gt; 99999. =A0*/<br>
 =A0@@ -1381,8 +1385,12 @@<br>
 =A0 =A0 =A0 hpux_uid_gid_encode (hdr-&gt;ar_uid, (long) status.st_gid);<br>
 =A0 =A0 else<br>
 =A0 #endif<br>
 =A0- =A0sprintf ((hdr-&gt;ar_gid), &quot;%ld&quot;, (long) status.st_gid);<=
 br>
 =A0- =A0sprintf ((hdr-&gt;ar_mode), &quot;%-8o&quot;, (unsigned int) status=
 .st_mode);<br>
 =A0+ =A0{<br>
 =A0+ =A0sprintf (tmpbuf, &quot;%ld&quot;, (long) status.st_gid);<br>
 =A0+ =A0memcpy(hdr-&gt;ar_gid, tmpbuf, sizeof(hdr-&gt;ar_gid));<br>
 =A0+ =A0}<br>
 =A0+ =A0sprintf (tmpbuf, &quot;%-8o&quot;, (unsigned int) status.st_mode);<=
 br>
 =A0+ =A0memcpy(hdr-&gt;ar_mode, tmpbuf, sizeof(hdr-&gt;ar_mode));<br>
 =A0 =A0 sprintf (tmpbuf, &quot;%-10ld&quot;, (long) status.st_size);<br>
 =A0 =A0 memcpy(hdr-&gt;ar_size, tmpbuf, sizeof(hdr-&gt;ar_size));<br>
 =A0 =A0 /* Correct for a lossage in sprintf whereby it null-terminates. =A0=
 I cannot<br>
 <br>
 </div></div></blockquote></div><br>

 --047d7b33daf4a9e6a304c804fe10--

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, rftmhmd@gmail.com
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 13:36:03 -0400

 On Aug 24,  3:55pm, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

 | The following reply was made to PR toolchain/46827; it has been noted by GNATS.
 | 

 /usr/src/gnu/dist/binutils/bfd??

 christos

From: Rifat Mahmud <rftmhmd@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Sat, 25 Aug 2012 00:49:34 +0600

 --047d7b33daf4e2cb2104c8076fb0
 Content-Type: text/plain; charset=ISO-8859-1

 Thanks! The kernel is compiled.

 I'm yet to build the userland and X. If I found any bug there should I
 report it here, or make a new PR?

 On Fri, Aug 24, 2012 at 11:40 PM, Christos Zoulas <christos@zoulas.com>wrote:

 > The following reply was made to PR toolchain/46827; it has been noted by
 > GNATS.
 >
 > From: christos@zoulas.com (Christos Zoulas)
 > To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
 >         gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, rftmhmd@gmail.com
 > Cc:
 > Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 > Date: Fri, 24 Aug 2012 13:36:03 -0400
 >
 >  On Aug 24,  3:55pm, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 >  -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 >
 >  | The following reply was made to PR toolchain/46827; it has been noted
 > by GNATS.
 >  |
 >
 >  /usr/src/gnu/dist/binutils/bfd??
 >
 >  christos
 >
 >

 --047d7b33daf4e2cb2104c8076fb0
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable

 Thanks! The kernel is compiled.=A0<br><br>I&#39;m yet to build the userland=
  and X. If I found any bug there should I report it here, or make a new PR?=
 <br><br><div class=3D"gmail_quote">On Fri, Aug 24, 2012 at 11:40 PM, Christ=
 os Zoulas <span dir=3D"ltr">&lt;<a href=3D"mailto:christos@zoulas.com" targ=
 et=3D"_blank">christos@zoulas.com</a>&gt;</span> wrote:<br>
 <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
 x #ccc solid;padding-left:1ex"><div class=3D"im">The following reply was ma=
 de to PR toolchain/46827; it has been noted by GNATS.<br>
 <br>
 </div><div class=3D"im">From: <a href=3D"mailto:christos@zoulas.com">christ=
 os@zoulas.com</a> (Christos Zoulas)<br>
 To: gnats-bugs@NetBSD.org, <a href=3D"mailto:toolchain-manager@netbsd.org">=
 toolchain-manager@netbsd.org</a>,<br>
 =A0 =A0 =A0 =A0 <a href=3D"mailto:gnats-admin@netbsd.org">gnats-admin@netbs=
 d.org</a>, <a href=3D"mailto:netbsd-bugs@netbsd.org">netbsd-bugs@netbsd.org=
 </a>, <a href=3D"mailto:rftmhmd@gmail.com">rftmhmd@gmail.com</a><br>
 Cc:<br>
 </div><div class=3D"im">Subject: Re: toolchain/46827: Cannot build the kern=
 el, even Generic.<br>
 </div>Date: Fri, 24 Aug 2012 13:36:03 -0400<br>
 <div class=3D"HOEnZb"><div class=3D"h5"><br>
 =A0On Aug 24, =A03:55pm, <a href=3D"mailto:rftmhmd@gmail.com">rftmhmd@gmail=
 .com</a> (Rifat Mahmud) wrote:<br>
 =A0-- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.<=
 br>
 <br>
 =A0| The following reply was made to PR toolchain/46827; it has been noted =
 by GNATS.<br>
 =A0|<br>
 <br>
 =A0/usr/src/gnu/dist/binutils/bfd??<br>
 <br>
 =A0christos<br>
 <br>
 </div></div></blockquote></div><br>

 --047d7b33daf4e2cb2104c8076fb0--

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, rftmhmd@gmail.com
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Fri, 24 Aug 2012 23:18:35 -0400

 On Aug 24,  6:50pm, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

 |  Thanks! The kernel is compiled.

 Great.

 |  I'm yet to build the userland and X. If I found any bug there should I
 |  report it here, or make a new PR?

 Please make a new PR.

 Thanks,

 christos

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
Date: Sat, 25 Aug 2012 18:32:46 +0000

 (not sent to gnats-bugs)

    ------

 From: Christos Zoulas <christos@zoulas.com>
 To: Rifat Mahmud <rftmhmd@gmail.com>, toolchain-manager@netbsd.org,
 	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.
 Date: Sat, 25 Aug 2012 09:15:59 -0400

 On Aug 24,  1:14am, rftmhmd@gmail.com (Rifat Mahmud) wrote:
 -- Subject: Re: toolchain/46827: Cannot build the kernel, even Generic.

 | I think, the problem might be about version conflict GNU coreutils,
 | binutils and gcc in Linux and NetBSD. NetBSD codes might not be compatible
 | with latest utilities in Linux, the tool building commands show many
 | warnings about versions of bison etc.

 Partially. The problem is that the NetBSD-5 binutils are too old and
 they have buffer overflow bugs that are caught by SSP in newer versions
 of Linux.

 christos

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 01 Oct 2012 00:43:58 +0000
State-Changed-Why:
A fix has been committed and also applied to the netbsd-5 branch; please
try it.


State-Changed-From-To: feedback->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Wed, 05 Nov 2014 05:30:19 +0000
State-Changed-Why:
feedback timeout


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.