Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2001 16:55:26 -0500 (EST)
From:      Gunther Schadow <gunther@aurora.regenstrief.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/31304: fix crunchgen to work with more contrib-kind of sources
Message-ID:  <200110152155.f9FLtQi67462@aurora.regenstrief.org>

next in thread | raw e-mail | index | archive | help

>Number:         31304
>Category:       bin
>Synopsis:       fix crunchgen to work with more contrib-kind of sources
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 15 15:00:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Gunther Schadow
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
Regenstrief Institute
>Environment:
System: FreeBSD aurora.regenstrief.org 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Thu Sep 20 15:35:07 EST 2001 root@aurora.regenstrief.org:/usr/src/sys/compile/AURORA i386


	
>Description:
Crunchgen does not currently crunch all FreeBSD src programs.
This bug report contains a patch to make it crunch more of them.
For example, none of the bind-8 related programs can be crunched
without severe headache. Take for example usr.bin/dnsquery. There
is only a short Makefile that includes another Makefile via a
relative path:

.include "../../usr.sbin/named/Makefile.inc"

The problem is that when crunchgen extracts the make parameters,
it does not actually cd into "usr.bin/dnsquery" so that the 
relative path makes no sense. 

The attached patches fix this problem as follows:

- always cd into the srcdir when running the generated makefile
  extracting make variables

- in order for this to be done, change some occurrences of 
  p->srcdir to p->realsrcdir

The fix is minor thanks to someone having already provided for
p->realsrcdir! This fix should complete what was begun then.

Note: I'm not 100% sure this fix will not break certain 
crunchgen.conf logics that relied on the fact that the 
generated makefile for extracting make variables is run
in crunchgen.conf's directory instead of the srcdir.
However, I can see no rationale for why such logic needs
to be.

	
>How-To-Repeat:
	
>Fix:
*** crunchgen.c~        Sun Aug 19 05:41:57 2001
--- crunchgen.c Mon Oct 15 16:35:43 2001
***************
*** 631,638 ****
                snprintf(line, MAXLINELEN, "Using %s for %s", path, p->name);
                status(line);
        } else
!               if (p->srcdir)
!                       snprintf(path, sizeof(path), "%s/Makefile", p->srcdir);
        if (!p->objs && p->srcdir && is_nonempty_file(path))
                fillin_program_objs(p, path);
  
--- 631,639 ----
                snprintf(line, MAXLINELEN, "Using %s for %s", path, p->name);
                status(line);
        } else
!               if (p->realsrcdir)
!                       snprintf(path, sizeof(path), "%s/Makefile",
!                                p->realsrcdir);
        if (!p->objs && p->srcdir && is_nonempty_file(path))
                fillin_program_objs(p, path);
  
***************
*** 686,700 ****
        fprintf(f, ".endif\n");
        fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
  
!       fprintf(f, "crunchgen_objs:\n\t@make -f %s $(BUILDOPTS) $(%s_OPTS)",
!           tempfname, p->ident);
        for (s = p->buildopts; s != NULL; s = s->next)
                fprintf(f, " %s", s->str);
        fprintf(f, " loop\n");
  
        fclose(f);
  
!       snprintf(line, MAXLINELEN, "make -f %s crunchgen_objs 2>&1", tempfname);
        if ((f = popen(line, "r")) == NULL) {
                warn("submake pipe");
                goterror = 1;
--- 687,715 ----
        fprintf(f, ".endif\n");
        fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
  
!       fprintf(f, "crunchgen_objs:\n\t@");
! 
!       /* assure that we run this make file in the source directory */
!       if(p->realsrcdir) {
!         fprintf(f, "cd %s;", p->realsrcdir);
!       }
! 
!       fprintf(f, "make -f %s $(BUILDOPTS) $(%s_OPTS)", tempfname, p->ident);
        for (s = p->buildopts; s != NULL; s = s->next)
                fprintf(f, " %s", s->str);
        fprintf(f, " loop\n");
  
        fclose(f);
  
!       /* assure that we run this make file in the source directory */
!       if(p->srcdir) {
!         snprintf(line, MAXLINELEN, "cd %s ; make -f %s crunchgen_objs 2>&1", 
!                  p->srcdir, tempfname);
!       } 
!       else
!         snprintf(line, MAXLINELEN, "make -f %s crunchgen_objs 2>&1", 
!                  tempfname);
!         
        if ((f = popen(line, "r")) == NULL) {
                warn("submake pipe");
                goterror = 1;

	
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110152155.f9FLtQi67462>