Subject: Re: dial in on NetBSD-current
To: Bert Driehuis <uunet!indy.knoware.nl!driehuis@uunet.UU.NET>
From: Dennis D. Sherod <dds@irvine.dg.com>
List: current-users
Date: 03/01/1994 08:12:46
>In message <m0pbKyT-00014BC@fiuggi.irvine.dg.com>, "Dennis D. Sherod" writes:
>>
>>Maybe more to the point, however, is:
>>
>>Why doesn't ar(1) handle a long list of objects (more than about 60) without
>>complaining about too many files open.  Shouldn't ar open each object file in
>>turn, perform the requested operation, and then close the file before going on
>>the next .o on the command line?
>>
>>-- Dennis Sherod, dds@irvine.dg.com, Voice +1 714 724-3951, FAX +1 714 724-395
>>6
>
>This is a bug in ar.  I fixed it a while back (0.8?), and even sent in a bug
>report, but I think it got dropped (or my email failed for some reason).
>
>Anyhow,  I just looked through ar once again and it seems that it is still
>there, in replace.c:
>
[stuff deleted]
>
>I think this is the same bug... It's been awhile, and I don't recall for 
>sure, but it sure looks wrong.  It only occurs when you are using the
>replace flag, and you have lots of objects that are *not* newer than those
>in the archive.
>
>Bob.

Yep, this fixed the problem.  Here's the simple patch.

*** /usr/src/usr.bin/ar/replace.c.orig	Thu Dec 16 23:04:43 1993
--- /usr/src/usr.bin/ar/replace.c	Tue Mar  1 08:03:47 1994
***************
*** 108,115 ****
  				goto useold;
  			}
  			(void)fstat(sfd, &sb);
! 			if (options & AR_U && sb.st_mtime <= chdr.date)
  				goto useold;
  
  			if (options & AR_V)
  			     (void)printf("r - %s\n", file);
--- 108,117 ----
  				goto useold;
  			}
  			(void)fstat(sfd, &sb);
! 			if (options & AR_U && sb.st_mtime <= chdr.date) {
! 				close(sfd);
  				goto useold;
+ 			}
  
  			if (options & AR_V)
  			     (void)printf("r - %s\n", file);

NOTE for Chris:

Is there anything else that needs to be done to get this in "current"?

------------------------------------------------------------------------------