Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Oct 1995 07:02:28 +0000 (GMT)
From:      Adam David <adam@veda.is>
To:        asami@cs.berkeley.edu (Satoshi Asami)
Cc:        CVS-commiters@freefall.freebsd.org, ports@freebsd.org
Subject:   bug in make(1) or bsd.port.mk
Message-ID:  <199510200702.HAA04566@veda.is>
In-Reply-To: <199510200606.XAA03199@silvia.HIP.Berkeley.EDU> from "Satoshi Asami" at Oct 19, 95 11:06:50 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Currently, ports with more than one PATCHFILES defined do not build the list
of distribution patchfiles correctly when calculating checksums. I think that
the bug is actually in make(1) but it probably makes better sense to ship a
bsd.port.mk that avoids the bug. Appended below is a fix for bsd.port.mk
which should also continue to work correctly whenever this behaviour changes
in make.

Description of bug in make:
In a :S substitution in a variable, the ^ and $ anchors only apply to the first
word of multi-word variables, although the manpage is clear that they are meant
to apply to each word in the variable. The 'g' flag erronuously applies to the
whole variable instead of each individual word in the variable, and this can
be used to work around the bug.

In the patch below, I have also made a change in wording from "distributed"
to "distribution". Patches are additions to a distribution and from a
distribution site, and not conceptually distributed over an area although
they might come from various locations. The actual fix is the following
change, in the two places where it occurs:

- 	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \
+ 	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|g}; do \

For consideration as a vital bugfix.

Adam

===============

*** bsd.port.mk.old	Fri Oct 20 06:12:54 1995
--- bsd.port.mk	Fri Oct 20 06:31:03 1995
***************
*** 19,25 ****
  # MASTER_SITES	- Primary location(s) for distribution files if not found
  #				  locally (default:
  #				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles)
! # PATCH_SITES	- Primary location(s) for distributed patch files
  #				  (see PATCHFILES below) if not found locally (default:
  #				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles)
  #
--- 19,25 ----
  # MASTER_SITES	- Primary location(s) for distribution files if not found
  #				  locally (default:
  #				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles)
! # PATCH_SITES	- Primary location(s) for distribution patch files
  #				  (see PATCHFILES below) if not found locally (default:
  #				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles)
  #
***************
*** 50,56 ****
  # DISTNAME		- Name of port or distribution.
  # DISTFILES		- Name(s) of archive file(s) containing distribution
  #				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
! # PATCHFILES	- Name(s) of additional files that contain distributed
  #				  patches (default: none).  make will look for them at
  #				  PATCH_SITES (see above).  They will automatically be
  #				  uncompressed before patching if the names end with
--- 50,56 ----
  # DISTNAME		- Name of port or distribution.
  # DISTFILES		- Name(s) of archive file(s) containing distribution
  #				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}).
! # PATCHFILES	- Name(s) of additional files that contain distribution
  #				  patches (default: none).  make will look for them at
  #				  PATCH_SITES (see above).  They will automatically be
  #				  uncompressed before patching if the names end with
***************
*** 529,539 ****
  .if !target(do-patch)
  do-patch:
  .if defined(PATCHFILES)
! 	@${ECHO_MSG} "===>  Applying distributed patches for ${PKGNAME}"
  .if defined(PATCH_DEBUG)
  	@(cd ${PATCHDIST}; \
  	  for i in ${PATCHFILES}; do \
! 		${ECHO_MSG} "===>   Applying distributed patch $$i" ; \
  		case $$i in \
  			*.Z|*.gz) \
  				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
--- 529,539 ----
  .if !target(do-patch)
  do-patch:
  .if defined(PATCHFILES)
! 	@${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
  .if defined(PATCH_DEBUG)
  	@(cd ${PATCHDIST}; \
  	  for i in ${PATCHFILES}; do \
! 		${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
  		case $$i in \
  			*.Z|*.gz) \
  				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
***************
*** 905,911 ****
  	@if [ ! -d ${FILESDIR} ]; then /bin/mkdir -p ${FILESDIR}; fi
  	@if [ -f ${MD5_FILE} ]; then /bin/rm -f ${MD5_FILE}; fi
  	@(cd ${DISTDIR}; \
! 	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \
  		${MD5} $$file >> ${MD5_FILE}; \
  	 done)
  .endif
--- 905,911 ----
  	@if [ ! -d ${FILESDIR} ]; then /bin/mkdir -p ${FILESDIR}; fi
  	@if [ -f ${MD5_FILE} ]; then /bin/rm -f ${MD5_FILE}; fi
  	@(cd ${DISTDIR}; \
! 	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|g}; do \
  		${MD5} $$file >> ${MD5_FILE}; \
  	 done)
  .endif
***************
*** 916,922 ****
  		${ECHO_MSG} ">> No MD5 checksum file."; \
  	else \
  		(cd ${DISTDIR}; OK=""; \
! 		  for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \
  			CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
  			CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
  			if [ "$$CKSUM2" = "" ]; then \
--- 916,922 ----
  		${ECHO_MSG} ">> No MD5 checksum file."; \
  	else \
  		(cd ${DISTDIR}; OK=""; \
! 		  for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|g}; do \
  			CKSUM=`${MD5} $$file | awk '{print $$4}'`; \
  			CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \
  			if [ "$$CKSUM2" = "" ]; then \




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