public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: slong@rathaus.eclipse.co.uk
Subject: Re: [gentoo-dev] Re: [PATCH systemd.eclass] Introduce systemd_install_serviced().
Date: Tue, 10 Sep 2013 18:36:09 +0200	[thread overview]
Message-ID: <20130910183609.6063f7a3@gentoo.org> (raw)
In-Reply-To: <20130910105731.GA19688@rathaus.eclipse.co.uk>

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

Dnia 2013-09-10, o godz. 11:57:31
"Steven J. Long" <slong@rathaus.eclipse.co.uk> napisał(a):

> Michał Górny wrote:
> > +systemd_install_serviced() {
> > +	debug-print-function ${FUNCNAME} "${@}"
> > +
> > +	local src=${1}
> > +	local service=${2}
> > +
> > +	if [[ ! ${service} ]]; then
> > +		[[ ${src} == *.conf ]] || die "Source file needs .conf suffix"
> 
> I would hoist this check to before the if.

Any suffix is allowed if ${service} is provided. Specific naming is
required only for service guessing.

> > +		service=${src##*/}
> > +		service=${service%.conf}
> > +	fi
> > +	# avoid potentially common mistake
> > +	[[ ${service} != *.d ]] || die "Service must not have .d suffix"
> 
> Double-negative reads badly:
> 
>   [[ $service = *.d ]] && die "$FUNCNAME: Service must not have .d suffix"

I agree.

> > Nope. 'insinto' sets INSDESTTREE. Due to lack of proper scoping
> > support in bash, we need to localize this variable to restore previous
> > 'insinto' scope after leaving the function.
> 
> Actually the only reason you are able to do that, is *because* bash has proper
> scoping support.

Proper scoping support would actually either disallow something like
this or disallow something designed as 'insinto'. The 'local' in bash
in the worst thing you could expect.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

  reply	other threads:[~2013-09-10 16:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 11:12 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_install_serviced() Michał Górny
2013-09-08 15:14 ` Gilles Dartiguelongue
2013-09-08 15:40   ` Pacho Ramos
2013-09-08 15:46   ` Michał Górny
2013-09-08 21:29     ` Alexis Ballier
2013-09-10 10:57 ` [gentoo-dev] " Steven J. Long
2013-09-10 16:36   ` Michał Górny [this message]
2013-09-10 17:28     ` Mike Gilbert
2013-09-12 11:48 ` [gentoo-dev] " Michał Górny

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=20130910183609.6063f7a3@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=slong@rathaus.eclipse.co.uk \
    /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