From owner-svn-ports-all@FreeBSD.ORG Fri Sep 21 06:55:21 2012 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D62B106564A; Fri, 21 Sep 2012 06:55:21 +0000 (UTC) (envelope-from poyopoyo@puripuri.plala.or.jp) Received: from msa04a.plala.or.jp (msa04.plala.or.jp [IPv6:2400:7800:0:5010::4]) by mx1.freebsd.org (Postfix) with ESMTP id E88608FC08; Fri, 21 Sep 2012 06:55:19 +0000 (UTC) Received: from i58-94-78-62.s02.a026.ap.plala.or.jp ([58.94.78.62]) by msa01b.plala.or.jp with ESMTP id <20120921065130.BTLR32022.msa01b.plala.or.jp@i58-94-78-62.s02.a026.ap.plala.or.jp>; Fri, 21 Sep 2012 15:51:30 +0900 Date: Fri, 21 Sep 2012 15:51:29 +0900 Message-ID: <868vc3rhqm.wl%poyopoyo@puripuri.plala.or.jp> From: poyopoyo@puripuri.plala.or.jp To: Beat Gaetzi In-Reply-To: <201209201951.q8KJpUNr085151@svn.freebsd.org> References: <201209201951.q8KJpUNr085151@svn.freebsd.org> Mail-Followup-To: Beat Gaetzi , ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org, poyopoyo@puripuri.plala.or.jp User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/24.2 (amd64-portbld-freebsd10.0) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-VirusScan: Outbound; msa01b; Fri, 21 Sep 2012 15:51:30 +0900 X-Mailman-Approved-At: Fri, 21 Sep 2012 07:24:02 +0000 Cc: svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org Subject: Re: svn commit: r304594 - head/Mk X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Sep 2012 06:55:21 -0000 At Thu, 20 Sep 2012 19:51:30 +0000 (UTC), Beat Gaetzi wrote: > - Make 'do-package' atomic while creating the pkg file [4] > Modified: head/Mk/bsd.port.mk > ============================================================================== > @@ -3911,11 +3905,15 @@ do-package: ${TMPPLIST} > fi; \ > fi; \ > fi > - @if ${PKG_CMD} -b ${PKGNAME} ${PKGFILE}; then \ > + @TMPPKGFILE=$$(mktemp -t pkg); \ > + trap "${RM} -f $${TMPPKGFILE} $${TMPPKGFILE}${PKG_SUFX}; exit 1" 1 2 3 5 10 13 15; \ > + if ${PKG_CMD} -b ${PKGNAME} $${TMPPKGFILE}; then \ > + ${MV} -f $${TMPPKGFILE}${PKG_SUFX} ${PKGFILE}; \ > if [ -d ${PACKAGES} ]; then \ > cd ${.CURDIR} && eval ${MAKE} package-links; \ > fi; \ > else \ > + ${RM} -f $${TMPPKGFILE}; \ > cd ${.CURDIR} && eval ${MAKE} delete-package; \ > exit 1; \ > fi This does not seem to atomic at all. Well being visible when PKG_SUFX is set. == # make package -C /usr/ports/ports-mgmt/portlint PKG_SUFX=.tgz ... | ===> Registering installation for portlint-2.13.12 | ===> Building package for portlint-2.13.12 | mv: rename /home/tmp/pkg.ENocPBwh.tgz to /home/packages/10/All/portlint-2.13.12.tgz: No such file or directory | *** [do-package] Error code 1 | | Stop in /usr/ports/ports-mgmt/portlint. # ls -l /home/tmp/pkg.ENocPBwh* -rw------- 1 root wheel 0 Sep 21 14:36 /home/tmp/pkg.ENocPBwh -rw-r--r-- 1 root wheel 32270 Sep 21 14:36 /home/tmp/pkg.ENocPBwh.tbz == (1) pkg_create creates package with default suffix *added* to given pkg-filename if pkg-filename does not have one of known suffixes which are now .tgz, .tbz and .txz. (2) TMPPKGFILE does not give PKG_SUFX to mktemp. This makes pkg_create *adding* known default suffix to given TMPPKGFILE, this time "pkg.ENocPBwh.tbz". (3-a) when PKG_SUFX is set and it was other than default suffix pkg_create knows, make package fails. (3-b) when PKG_SUFX is not set, it looks like make package successfully completes, but its operation is not atomic at all, because intended TMPPKGFILE did not used at all (see empty file above, "pkg.ENocPBwh".) (4) TMPPKGFILE is left on TMPDIR and not removed. An hour of effort make me giving up fixing this correctly -- are someone able to tell mktemp to use pkg.XXXXXXXX.tgz as template? I could not. :-) Anyway, this chunk of patch does not work as intended currently and breaks PKG_SUFX support badly. It would be nice to be backed out until someone makes this really work, PKG_SUFX compliant and being atomic. -- kuro