From cg2v@yeltsin.andrew.cmu.edu  Thu Aug 22 11:23:03 2002
Return-Path: <cg2v@yeltsin.andrew.cmu.edu>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 40D7B37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Aug 2002 11:23:03 -0700 (PDT)
Received: from yeltsin.andrew.cmu.edu (YELTSIN.andrew.cmu.edu [128.2.121.175])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7E1D843E84
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Aug 2002 11:23:02 -0700 (PDT)
	(envelope-from cg2v@yeltsin.andrew.cmu.edu)
Received: from yeltsin.andrew.cmu.edu (localhost [127.0.0.1])
	by yeltsin.andrew.cmu.edu (8.12.5/8.12.5) with ESMTP id g7MIMx21021284
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Aug 2002 14:22:59 -0400 (EDT)
	(envelope-from cg2v@yeltsin.andrew.cmu.edu)
Received: (from cg2v@localhost)
	by yeltsin.andrew.cmu.edu (8.12.5/8.12.5/Submit) id g7MIJsxH021252;
	Thu, 22 Aug 2002 14:19:54 -0400 (EDT)
Message-Id: <200208221819.g7MIJsxH021252@yeltsin.andrew.cmu.edu>
Date: Thu, 22 Aug 2002 14:19:54 -0400 (EDT)
From: Chaskiel Grundman <cg2v@andrew.cmu.edu>
Reply-To: Chaskiel Grundman <cg2v@andrew.cmu.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: make: $? not always set
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41908
>Category:       bin
>Synopsis:       make: $? not always set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 22 11:30:01 PDT 2002
>Closed-Date:    Wed Feb 25 07:39:38 PST 2004
>Last-Modified:  Wed Feb 25 07:39:38 PST 2004
>Originator:     Chaskiel Grundman
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD yeltsin.andrew.cmu.edu 4.6-STABLE FreeBSD 4.6-STABLE #0: Tue Aug 20 09:48:10 EDT 2002 cg2v@yeltsin.andrew.cmu.edu:/usr/obj/usr/src/sys/MODERN2940 i386


	
>Description:
	if an archive's internal timestamp and file modtime are different
	make considers targets dependent on the archive to be out of date,
	but does not put the archive in $?
>How-To-Repeat:
	
with this makefile in an empty directory:
all: test2.a
test2.a: test.a
        install -c $? $@

test.a: t1.o 
        ar crv $@ t1.o 
        ranlib $@

t1.c: Makefile
        touch t1.c

breakit:
        touch test.a

run the following sequence:
make; make breakit; make; make

The last command (and any successive make invocations) will fail, and make -dm
produces output like the following:

Examining Makefile...modified 13:58:35 Aug 22, 2002...up-to-date.
Examining t1.c...modified 13:58:37 Aug 22, 2002...up-to-date.
Examining t1.o...modified 13:58:37 Aug 22, 2002...up-to-date.
Examining test.a...modified 13:58:41 Aug 22, 2002...library.../ modified 13:58:37 Aug 22, 2002...up-to-date.
Examining test2.a...modified 13:58:43 Aug 22, 2002...library.../ modified 13:58:37 Aug 22, 2002...out-of-date.
install -c  test2.a
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...

In the peice of software I actually encountered this in, there is no "touch" 
involved, but somehow the 2 timestamps are a second apart.
>Fix:

	


>Release-Note:
>Audit-Trail:

From: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
To: freebsd-gnats-submit@FreeBSD.org, cg2v@andrew.cmu.edu
Cc:  
Subject: Re: bin/41908: make: $? not always set
Date: Wed, 18 Feb 2004 10:14:19 +0100

 I think you should use $> (.ALLSRC) instead of $?.
 From make.1:
 
 .OODATE   The list of sources for this target that were deemed
                        out-of-date; also known as `?'.
 
 test.a is not out of date, so it's not in OODATE for test2.a.
 
 Does this look like a good rationale?
 
 Cheers,
   Volker
 -- 
 http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME
 rage against the finite state machine 
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Wed Feb 18 08:47:48 PST 2004 
State-Changed-Why:  
Submitter has been asked if this workaround is acceptable. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41908 

From: Chaskiel M Grundman <cg2v@andrew.cmu.edu>
To: Volker Stolz <stolz@i2.informatik.rwth-aachen.de>,
	freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: bin/41908: make: $? not always set
Date: Wed, 18 Feb 2004 12:41:28 -0500

 --On Wednesday, February 18, 2004 10:14:19 +0100 Volker Stolz
 <stolz@i2.informatik.rwth-aachen.de> wrote:
 
 > .OODATE   The list of sources for this target that were deemed
 >                        out-of-date; also known as `?'.
 
 Given that definition for $?, I suppose that make's behavior is correct.
 You may close the bug if you wish.
 
 It's unfortunate that the meaning of $? differs from that used by Sun make
 and GNU Make.
 
 Sun's make.1 says:
      $?    The list of dependencies that are newer than the  tar-
            get.  
 
 make.info says:
 `$?'
      The names of all the prerequisites that are newer than the target,
      with spaces between them.  For prerequisites which are archive
      members, only the member named is used
 
 
 $> isn't a good workaround for me, as it's BSD specific. The software
 probably would have been using $^ (which seems similar to how you describe
 $>), except that $^ is GNU specific.
 
 
 
State-Changed-From-To: feedback->closed 
State-Changed-By: obraun 
State-Changed-When: Wed Feb 25 07:38:52 PST 2004 
State-Changed-Why:  
Submitter is happy. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41908 
>Unformatted:
