From owner-svn-ports-all@FreeBSD.ORG Fri Sep 21 13:22:43 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 6BD861065672 for ; Fri, 21 Sep 2012 13:22:43 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4BABD8FC14 for ; Fri, 21 Sep 2012 13:22:43 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8LDMgV4070860 for ; Fri, 21 Sep 2012 13:22:42 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8LDMgs6070855 for svn-ports-all@freebsd.org; Fri, 21 Sep 2012 13:22:42 GMT (envelope-from bdrewery) Received: (qmail 93518 invoked from network); 21 Sep 2012 08:22:40 -0500 Received: from unknown (HELO ?10.10.0.115?) (freebsd@shatow.net@10.10.0.115) by sweb.xzibition.com with ESMTPA; 21 Sep 2012 08:22:40 -0500 Message-ID: <505C6A1D.4070206@FreeBSD.org> Date: Fri, 21 Sep 2012 08:22:37 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Beat Gaetzi , ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org, poyopoyo@puripuri.plala.or.jp, Baptiste Daroussin References: <201209201951.q8KJpUNr085151@svn.freebsd.org> <868vc3rhqm.wl%poyopoyo@puripuri.plala.or.jp> In-Reply-To: <868vc3rhqm.wl%poyopoyo@puripuri.plala.or.jp> X-Enigmail-Version: 1.4.4 OpenPGP: id=3C9B0CF9; url=http://www.shatow.net/bryan/bryan.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: 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 13:22:43 -0000 In my testing it was all working. I must have messed it up! I am going to back out for now and rewrite it. I will also try creating the tempfile in the PKGREPOSITORY, to keep it on the same filesystem :) Thank you for reporting this. Bryan On 9/21/2012 1:51 AM, poyopoyo@puripuri.plala.or.jp wrote: > 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. > -- Regards, Bryan Drewery bdrewery@freenode/EFNet