public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: rindeal <dev.rindeal@gmail.com>
Cc: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] flag-o-matic.eclass: bugfix for get-flag()
Date: Sun, 15 May 2016 21:41:41 +0200	[thread overview]
Message-ID: <20160515214141.4dcc36f5.mgorny@gentoo.org> (raw)
In-Reply-To: <CANgLvuASukUCiFOMD5=SkiO7ZwSgkqrPK8fLrT2Ddb5rutXPZw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]

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> napisał(a):  
> >>+                      local f="${!i}"
> >>+                      if [ "${f#-${findflag#-}}" != "${f}" ] ; then  
> >
> > I know the original code sucked as well but could you replace this with more readable [[ ${f} == -${findflag#-}* ]] or alike (note: not tested).  
> 
> 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. == with wildcards) to do comparison rather than
limited shell-style stripping of variables.

> >>+                              printf "%s\n" "${f#-${findflag}=}"  
> >
> > It may be a good idea to add a short explanation why you can't use echo 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.

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

  reply	other threads:[~2016-05-15 19:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15 13:31 [gentoo-dev] [PATCH] flag-o-matic.eclass: bugfix for get-flag() Jan Chren
2016-05-15 15:59 ` Michał Górny
2016-05-15 19:35   ` rindeal
2016-05-15 19:41     ` Michał Górny [this message]
2016-05-15 20:19       ` rindeal
2016-05-15 23:23     ` Ulrich Mueller
2016-05-16 12:17       ` rindeal
2016-05-20  3:15         ` Mike Frysinger
2016-06-05 12:13         ` rindeal
2016-05-16  6:23     ` [gentoo-dev] " Ryan Hill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160515214141.4dcc36f5.mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=dev.rindeal@gmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox