From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-dev+bounces-75677-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3929313825A for <garchives@archives.gentoo.org>; Sun, 15 May 2016 20:20:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B2A3A141A2; Sun, 15 May 2016 20:19:53 +0000 (UTC) Received: from mail-vk0-f66.google.com (mail-vk0-f66.google.com [209.85.213.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A2C1721C028 for <gentoo-dev@lists.gentoo.org>; Sun, 15 May 2016 20:19:52 +0000 (UTC) Received: by mail-vk0-f66.google.com with SMTP id s184so18339715vkb.0 for <gentoo-dev@lists.gentoo.org>; Sun, 15 May 2016 13:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=wWekbydmd+HAwhX0+yp13ZNb+Zqa3R/oVQnokOOoJmc=; b=xMyt/kL1kMD500saXuwatfrXxh8xRUXmIpfHmf8YfJMo+ImsY9wmUnNev3+WgAWMbb uDZmLLtg4PXacN67/AnUmDqCsC7oPjPZuvc4JjPojIXDwwFMC8HPWti4/3q+9JvV+vAr 6nFl+RWFmc3RnxrFjTq05yUjdqQ+ysKQHjUZ0/zJO8V9xFmGD9g4DhgCMPfWaUkrACAe 7cXsliclukEOCprDnqq7ZyHIVKHnBcQS2KY3xoN8kUEJFlezrRcRGNwo8gwpo948B/iu 7250M+bCGiN+mJWwGJ0NiYP5y46yt/V44EycT3KzxurtIpYugkpPmxaCHIagV4EbXNaa LQgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=wWekbydmd+HAwhX0+yp13ZNb+Zqa3R/oVQnokOOoJmc=; b=QBvkxNYBmfQLNT2B9Mzz+LqnN1RfiDhU9ICrATV31MYw0IT+aPvt3f9m//FJ2gtc94 MyWu1wnfDm8MKuHgqUjixyZQASaVBqKYTt3iha1vmucXx0muqp2yFbDEGOtlMqAo+e1k kTTJc7RTK3+WYtUGMKWoEzm0SZGfzmvoS0cmlVs7+E4fDs9AxrXszyCKGc4JDnZeFHHg ElyWPG22435VtS09Ebb2oyUUQMlGktvYfDbQIlcysEu5sdY6erI63kCPbMwbOdsvSxGU jj7NJACBJv6H8TC7E3Gp5m/D80+J1xiXbqJJ7ii/gGDqRRSs3IDm6WpKolMIujo8YOKz NibA== X-Gm-Message-State: AOPr4FXPg0oHiPhKMHoNBtlqu1j8gghY4reQQTQkY63tmtWoNC6ZiKUq41Z6Z8KyqT9fQqOD3dbb6SkRiaqRag== X-Received: by 10.159.40.231 with SMTP id d94mr1521372uad.62.1463343591607; Sun, 15 May 2016 13:19:51 -0700 (PDT) Precedence: bulk List-Post: <mailto:gentoo-dev@lists.gentoo.org> List-Help: <mailto:gentoo-dev+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org> X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Sender: mr.jan.chren@gmail.com Received: by 10.159.33.4 with HTTP; Sun, 15 May 2016 13:19:12 -0700 (PDT) In-Reply-To: <20160515214141.4dcc36f5.mgorny@gentoo.org> References: <1463319089-18877-1-git-send-email-dev.rindeal@gmail.com> <65DB30FD-2B31-45B6-B34D-021544C0E9D6@gentoo.org> <CANgLvuASukUCiFOMD5=SkiO7ZwSgkqrPK8fLrT2Ddb5rutXPZw@mail.gmail.com> <20160515214141.4dcc36f5.mgorny@gentoo.org> From: rindeal <dev.rindeal@gmail.com> Date: Sun, 15 May 2016 22:19:12 +0200 X-Google-Sender-Auth: UepZCGLPO92COJcEubPwjnkOf4o Message-ID: <CANgLvuDn_QmeVwRRk9K8owVorfyScSiJUnm29P3i0qbq8ZnnWg@mail.gmail.com> Subject: Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: bugfix for get-flag() To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= <mgorny@gentoo.org> Cc: rindeal <dev.rindeal@gmail.com>, gentoo-dev@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: d8ec2d0c-c1ac-4d21-a3ab-8345d2f87952 X-Archives-Hash: 7664bf036ebbb6e0aa6178910ec50412 > On Sun, 15 May 2016 21:35:41 +0200 > rindeal <dev.rindeal@gmail.com> wrote: > >> > Dnia 15 maja 2016 15:31:29 CEST, Jan Chren <dev.rindeal@gmail.com> nap= isa=C5=82(a): >> >>+ local f=3D"${!i}" >> >>+ if [ "${f#-${findflag#-}}" !=3D "${f}" ] ; then >> > >> > I know the original code sucked as well but could you replace this wit= h more readable [[ ${f} =3D=3D -${findflag#-}* ]] or alike (note: not teste= d). >> >> This is just as buggy as my original implementation, I've reworked it >> and thanks to the tests I hope it's now correct. > > It is still unreadable. The point is, we use bash here, so please use > bash features (i.e. =3D=3D with wildcards) to do comparison rather than > limited shell-style stripping of variables. The thing is that "=3D=3D with wildcards" cannot be used, because a) it's too greedy and b) the wildcards in ${pattern} won't expand. > >> >>+ printf "%s\n" "${f#-${findflag}=3D}" >> > >> > It may be a good idea to add a short explanation why you can't use ech= o here, as a comment. >> >> I've just copied what was there before, `echo` in bash is notoriously >> wild, but with this simple string I guess it's ok, so done. > > I meant you should add a comment that you can't use echo because flags > like '-n' or '-e' would confuse it :-P. Ok, I've fixed it and added tests for such edge cases.