From owner-freebsd-bugs Mon Oct 15 15: 0: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5ED8637B408 for ; Mon, 15 Oct 2001 15:00:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9FM01i59789; Mon, 15 Oct 2001 15:00:01 -0700 (PDT) (envelope-from gnats) Received: from aurora.regenstrief.org (aurora.regenstrief.org [134.68.31.122]) by hub.freebsd.org (Postfix) with ESMTP id ACB0837B409 for ; Mon, 15 Oct 2001 14:55:01 -0700 (PDT) Received: (from gunther@localhost) by aurora.regenstrief.org (8.11.6/8.9.3) id f9FLtQi67462; Mon, 15 Oct 2001 16:55:26 -0500 (EST) (envelope-from gunther) Message-Id: <200110152155.f9FLtQi67462@aurora.regenstrief.org> Date: Mon, 15 Oct 2001 16:55:26 -0500 (EST) From: Gunther Schadow Reply-To: Gunther Schadow To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/31304: fix crunchgen to work with more contrib-kind of sources Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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