FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 10-17-2010, 09:35 PM
Mike Frysinger
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

On Tuesday, October 12, 2010 16:09:06 Dirkjan Ochtman wrote:
> On Fri, Oct 1, 2010 at 15:07, Peter Volkov <pva@gentoo.org> wrote:
> >> if [[ -n $(ls /etc/openvpn/*/local.conf 2>/dev/null) ]] ; then
> >
> > I'd suggested [ -e /etc/openvpn/*/local.conf ] here, but probably there
> > are better alternatives. Also ${ROOT} is missed here.
>
> I've put ${ROOT} in, are there no better alternatives? I don't think
> anyone mentioned any.

please to convert to new eutils.eclassath_exists()
-mike
 
Old 10-17-2010, 11:06 PM
Amadeusz Żołnowski
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

Excerpts from Mike Frysinger's message of Sun Oct 17 23:33:57 +0200 2010:
> On Wednesday, October 13, 2010 19:08:55 Amadeusz Żołnowski wrote:
> > Excerpts from Mike Frysinger's message of Thu Oct 14 00:32:40 +0200 2010:
> > > On Wednesday, October 13, 2010 18:13:18 Amadeusz Żołnowski wrote:
> > > > Mike Frysinger's message of Wed Oct 13 23:46:43 +0200 2010:
> > > > > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > > > > > And why putting different tasks into one function?
> > > > >
> > > > > for the same reason we dont have separate test binaries: test_exist,
> > > > > test_file, test_dir, etc...
> > > > >
> > > > > it makes more sense in my mind to combine the functionality.
> > > >
> > > > So the only argument for having more complicated, less intuitive and
> > > > less readable function is the old 'test' program? Please, reconsider
> > > > my solution with more reason.
> > >
> > > we prioritize differently. i prefer unified code with options.
> >
> > In which part it's unified?
>
> the file checking & status accumulation. extending my code to add more
> options in the future is easier as well.

The name doesn't allow for any sensible extension. I'd advise to change
it to 'mtest' (which would stand for "multiple test") or something like
that and give up default behaviour. OK, and then your /options way/
starts to make sense. (Although status accumulation has still no benefit
here.)

Having such an 'mtest' we might use it in following way:

mtest -[oa] -[fredcw...] path1 path2 ... pathn

And stil we can do it simpler:

mtest() {
local f log_op=$1 test_op=$2; shift 2

case $log_op in
-a) for f; do
eval "[[ $test_op '$f' ]]" || return 1
done
return 0
;;
-o) for f; do
eval "[[ $test_op '$f' ]]" && return 0
done
return 1
;;
esac
return -1
}


– it's just a rough draft, proof of concept. You've already gone your
way…


> this thread is going nowhere. i believe my proposal is the way to go, and we
> arent arguing over anything of too much value (i.e. bike shedding). no one
> else has an opinion, so ive gone my route.


Cheers,
--
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5
 
Old 10-18-2010, 07:08 AM
Michał Górny
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

On Wed, 13 Oct 2010 17:46:43 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > And why putting different tasks into one function?
>
> for the same reason we dont have separate test binaries: test_exist,
> test_file, test_dir, etc...
>
> it makes more sense in my mind to combine the functionality.

And we finally reach the point where there is no reason to implement
a new function when it's supposed to be basically longer and more
unclear to use than:

[[ -f a || -f b || -f c ]]

--
Best regards,
Michał Górny
 
Old 10-18-2010, 06:06 PM
Mike Frysinger
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

On Monday, October 18, 2010 03:08:15 Michał Górny wrote:
> On Wed, 13 Oct 2010 17:46:43 -0400 Mike Frysinger wrote:
> > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > > And why putting different tasks into one function?
> >
> > for the same reason we dont have separate test binaries: test_exist,
> > test_file, test_dir, etc...
> >
> > it makes more sense in my mind to combine the functionality.
>
> And we finally reach the point where there is no reason to implement
> a new function when it's supposed to be basically longer and more
> unclear to use than:
>
> [[ -f a || -f b || -f c ]]

except that we're using globs, so our example isnt applicable.
[[ -f */a ]]
-mike
 
Old 10-18-2010, 06:25 PM
Mike Frysinger
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

On Monday, October 18, 2010 14:06:26 Mike Frysinger wrote:
> On Monday, October 18, 2010 03:08:15 Michał Górny wrote:
> > On Wed, 13 Oct 2010 17:46:43 -0400 Mike Frysinger wrote:
> > > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > > > And why putting different tasks into one function?
> > >
> > > for the same reason we dont have separate test binaries: test_exist,
> > > test_file, test_dir, etc...
> > >
> > > it makes more sense in my mind to combine the functionality.
> >
> > And we finally reach the point where there is no reason to implement
> > a new function when it's supposed to be basically longer and more
> > unclear to use than:
> >
> > [[ -f a || -f b || -f c ]]
>
> except that we're using globs, so our example isnt applicable.

err, "our" -> "your"
-mike
 
Old 10-19-2010, 04:03 AM
Michał Górny
 
Default gentoo-x86 commit in net-misc/openvpn: ChangeLog openvpn-2.1.3.ebuild

On Mon, 18 Oct 2010 14:06:26 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Monday, October 18, 2010 03:08:15 Michał Górny wrote:
> > On Wed, 13 Oct 2010 17:46:43 -0400 Mike Frysinger wrote:
> > > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > > > And why putting different tasks into one function?
> > >
> > > for the same reason we dont have separate test binaries:
> > > test_exist, test_file, test_dir, etc...
> > >
> > > it makes more sense in my mind to combine the functionality.
> >
> > And we finally reach the point where there is no reason to implement
> > a new function when it's supposed to be basically longer and more
> > unclear to use than:
> >
> > [[ -f a || -f b || -f c ]]
>
> except that we're using globs, so our example isnt applicable.
> [[ -f */a ]]

Ok. So, let's sum up what your function does with wildcards:

1) when passed a single wildcard, the OR and AND variants basically do
the same (unless one of the matched files disappears during the
check), so their co-existence is useless in that case.

2) When passed multiple wildcards (or a wildcard and filenames), these
variants indeed are both useful but the AND variant does unnecessary
amount of checking (checking each filename matched by each wildcard)
and is fragile to a single matched file disappearing during the runtime.

So, it's basically safer to use:

if path_exists -o a/* && path_exists -o b/*; then
...
fi

--
Best regards,
Michał Górny
 

Thread Tools




All times are GMT. The time now is 11:54 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org