X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id D5489DC00DE for ; Wed, 6 Jan 2016 15:31:52 +0000 (UTC) Received: from zimbra13.linbit.com (zimbra13.linbit.com [212.69.166.240]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 4584EDC00B8 for ; Wed, 6 Jan 2016 15:31:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id 99EB246E2DB for ; Wed, 6 Jan 2016 16:31:48 +0100 (CET) Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id uYB_Q5A4j6ue for ; Wed, 6 Jan 2016 16:31:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id 7A4C746E2E4 for ; Wed, 6 Jan 2016 16:31:48 +0100 (CET) X-Virus-Scanned: amavisd-new at linbit.com Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id RLLvbW5cSFuO for ; Wed, 6 Jan 2016 16:31:48 +0100 (CET) Received: from localhost (chello213047144126.1.15.vie.surfer.at [213.47.144.126]) by zimbra13.linbit.com (Postfix) with ESMTPSA id 42A3546E2DB for ; Wed, 6 Jan 2016 16:31:48 +0100 (CET) Date: Wed, 6 Jan 2016 16:31:47 +0100 From: Roland Kammerer To: alpine-aports@lists.alpinelinux.org Subject: Re: [alpine-aports] [PATCH] testing/drbd9-grsec: fix prepare logic Message-ID: <20160106153146.GQ2985@rck.sh> References: <1452014736-21355-1-git-send-email-roland.kammerer@linbit.com> <20160106140906.6944fe93@ncopa-desktop.alpinelinux.org> X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <20160106140906.6944fe93@ncopa-desktop.alpinelinux.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Scanned: ClamAV using ClamSMTP --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jan 06, 2016 at 02:09:06PM +0100, Natanael Copa wrote: > On Tue, 5 Jan 2016 18:25:36 +0100 > Roland Kammerer wrote: > > > - We have to add additional ".." to the path we want to check. $PWD is > > already $srcdir. This bug was the only reason that it did not trigger > > futher bugs in the "true" case. > > - If we don't find an APKBUILD for the kernel flavor, error out > > - We are in a sub-shell, we do not have to protect $pkgname > > - We have to add "return 0", otherwise in the positive case where the > > last check succeeds, it sets the sub-shell return value to 1, which > > then triggers the failure path. > > --- > > testing/drbd9-grsec/APKBUILD | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/testing/drbd9-grsec/APKBUILD b/testing/drbd9-grsec/APKBUILD > > index b9922c0..258163c 100644 > > --- a/testing/drbd9-grsec/APKBUILD > > +++ b/testing/drbd9-grsec/APKBUILD > > @@ -33,14 +33,15 @@ _builddir=$srcdir/$_usname-$_usver > > prepare() { > > local i > > # verify the kernel version > > - (if [ -f ../../main/linux-${_flavor}/APKBUILD ]; then > > - _name=$pkgname > > - . ../../main/linux-${_flavor}/APKBUILD > > - pkgname=$_name > > + (if [ -f ../../../main/linux-${_flavor}/APKBUILD ]; then > > + . ../../../main/linux-${_flavor}/APKBUILD > > I think we want a "cd $startdir" instead > > > [ "$_kver" != "$pkgver" ] \ > > && die "please update _kver to $pkgver" > > [ "$_kpkgrel" != "$pkgrel" ] \ > > && die "please update _kpkgrel to $pkgrel" > > + return 0 > > + else > > + die "could not determine kernel flavor: linux-${_flavor}" > > fi) || return 1 > > > > maybe move the return 0 til right before the closing )? Both changes makes sense to me, new patch attached. Regards, rck --MGYHOYXEY6WxJCY8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-testing-drbd9-grsec-fix-prepare-logic.patch" >From 8f1a47632d467a7e56c5e270ca9d62157681a587 Mon Sep 17 00:00:00 2001 From: Roland Kammerer Date: Wed, 6 Jan 2016 16:10:34 +0100 Subject: [PATCH] testing/drbd9-grsec: fix prepare logic - $PWD is already at $srcdir => first cd to $startdir. - If we don't find an APKBUILD for the kernel flavor, error out. - We are in a sub-shell, we do not have to protect $pkgname. - Return 0 in case we did not "die", otherwise in the positive case where the last check succeeds, it sets the sub-shell return value to 1, which then triggers the failure path. --- testing/drbd9-grsec/APKBUILD | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/testing/drbd9-grsec/APKBUILD b/testing/drbd9-grsec/APKBUILD index b9922c0..6cf50f9 100644 --- a/testing/drbd9-grsec/APKBUILD +++ b/testing/drbd9-grsec/APKBUILD @@ -9,7 +9,7 @@ _kver=4.1.15 _kpkgrel=2 _usver=9.0.0 -_mypkgrel=0 +_mypkgrel=1 _kernelver=$_kver-r$_kpkgrel _abi_release=${_kver}-${_kpkgrel}-${_flavor} @@ -33,15 +33,17 @@ _builddir=$srcdir/$_usname-$_usver prepare() { local i # verify the kernel version - (if [ -f ../../main/linux-${_flavor}/APKBUILD ]; then - _name=$pkgname + (cd $startdir + if [ -f ../../main/linux-${_flavor}/APKBUILD ]; then . ../../main/linux-${_flavor}/APKBUILD - pkgname=$_name [ "$_kver" != "$pkgver" ] \ && die "please update _kver to $pkgver" [ "$_kpkgrel" != "$pkgrel" ] \ && die "please update _kpkgrel to $pkgrel" - fi) || return 1 + else + die "could not determine kernel flavor: linux-${_flavor}" + fi + return 0) || return 1 cd "$_builddir" -- 2.6.4 --MGYHOYXEY6WxJCY8-- --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---