~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[alpine-aports] [PATCH] testing/drbd9-grsec: fix prepare logic

Details
Message ID
<1452014736-21355-1-git-send-email-roland.kammerer@linbit.com>
Sender timestamp
1452014736
DKIM signature
missing
Download raw message
Patch: +5 -4
- 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
		[ "$_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


-- 
2.6.4



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20160106140906.6944fe93@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1452014736-21355-1-git-send-email-roland.kammerer@linbit.com> (view parent)
Sender timestamp
1452085746
DKIM signature
missing
Download raw message
On Tue,  5 Jan 2016 18:25:36 +0100
Roland Kammerer <roland.kammerer@linbit.com> 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 )?
  
-nc


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Details
Message ID
<20160106153146.GQ2985@rck.sh>
In-Reply-To
<20160106140906.6944fe93@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1452094307
DKIM signature
missing
Download raw message
On Wed, Jan 06, 2016 at 02:09:06PM +0100, Natanael Copa wrote:
> On Tue,  5 Jan 2016 18:25:36 +0100
> Roland Kammerer <roland.kammerer@linbit.com> 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
Reply to thread Export thread (mbox)