Gentoo Archives: gentoo-dev

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: Re: Re: Re: [gentoo-commits] gentoo-x86 commit in dev-php5/onphp: ChangeLog onphp-0.10.6.ebuild onphp-0.10.4.ebuild onphp-0.10.3.ebuild
Date: Thu, 18 Oct 2007 02:24:28
Message-Id: ff6fbd$s0d$1@ger.gmane.org
In Reply to: Re: [gentoo-dev] Re: Re: Re: Re: [gentoo-commits] gentoo-x86 commit in dev-php5/onphp: ChangeLog onphp-0.10.6.ebuild onphp-0.10.4.ebuild onphp-0.10.3.ebuild by Roy Marples
1 Roy Marples wrote:
2 > On Wed, 2007-10-17 at 10:15 +0100, Steve Long wrote:
3 >> OK, that's all good, and you're _right_ for this case. I guess I was
4 >> trying to show an array being used since it came up before. For instance,
5 >> I often add to a global array with eg failed+=("$1"), which I might
6 >> display one-per-line to the user with: IFS=$'\n'; echo "${failed[*]}".
7 >> This is handy for tab separated data as well, if one uses IFS=$'\t' (also
8 >> affects read.)
9 >
10 > Or you could just echo to stderr (echo "failed $1" >&2)
11 >
12 Yeah I do that as well, but you know what users are like, we need info
13 repeated ;P
14 I actually echo the list after every package, but with no IFS setting so it
15 appears on one line. That's because the normal output is what I find useful
16 during emerge sessions, and as no-one's asked for any changes to it.
17
18 >> > I maybe wrong, but shouldn't you be using == inside [[ ]]?
19 >> >
20 >> No. == works, but = is considered better script style in #bash since it's
21 >> the same as standard [ and implies you know you're in shell, not C.
22 >
23 > No, you're in *bash*. Therein lies the difference.
24 >
25 Well it's still a shell. Certainly feels very different to C (and supports
26 all your finicky syntax ;)
27
28 >> I use
29 >> it since it's the script I see in front of me all the time, and it's
30 >> _less typing_. == is required in ((..)) (For the BASH additions, *and*
31 >> how to stay compatible see [1].)
32 >
33 > So == is sometimes required? Don't you find it confusing?
34 No, because the only time I use == is in ((..)) which is already vastly
35 different. And for a C coder, ((..)) is easy.
36
37 > As to staying compatible, you've already lost as you're just compatible
38 > with bash.
39 >
40 Er OK, but learning bash doesn't mean you can't also learn how to use sh for
41 the odd occasion when work demands it.
42
43 >> The thing is bashisms make my life easier: the code is clearer, and
44 >> easier to comprehend, write and maintain. While ebuilds aren't full-blown
45 >> applications, the same principles apply to the script, especially when so
46 >> few devs have to maintain so many ebuilds. IMO script that takes twice as
47 >> long to parse and write is a Bad Thing (tm): even if it only adds a
48 >> minute or two to the average quick fix, across the tree that adds up.
49 >
50 > Given how this started off, I would say that bash makes your life overly
51 > complex, not easier. But of course, that's my opinion.
52 >
53 I'm just discussing ease of writing and maintaining script. I don't see how
54 the context affects this?
55
56 >> So given that the Unix world, while still supporting POSIX as a base,
57 >> also has added other, newer standards, I don't see the benefit in not
58 >> using them.
59 >
60 > I agree, but as I've already demonstrated you don't have to use them
61 > just because they're there. If you have to tools, functions or whatever
62 > that do the same job and one is POSIX and one is not, which one would
63 > you pick? Would you be influenced in any way if the one that is not
64 > happens to be supplied by a favourite tool of yours, like say bash?
65 >
66 Heh, I only learnt bash in January. I've wanted to learn shellscripting for
67 *years*, and since Gentoo used bash, and I was told freenode #bash was the
68 place to learn it, I started using IRC for the first time in my life; so
69 I'm not a long-time bash user. It does form part of my thinking now, I'll
70 admit, but only because it gave me all the constructs I am used to in C,
71 and less so than awk, which I have used for much longer. [[ also has things
72 that make it more familiar to C coders (like && instead of -a, which some
73 old-time scripters [guess;] find annoying) so it makes sense that it would
74 allow == to ease the learning curve.
75
76 And the point still stands: there has been progress since Posix: many apps
77 use _GNU_SOURCE for instance, and I for one would be unhappy about a system
78 where I couldn't use _X_OPEN_SOURCE. So we're not talking about
79 a "Posix-or-not" choice; Posix is a *base* level, not an aspiration (any
80 longer.)
81
82 > I disagree that development would be any slower.
83 >
84 As you said, opinions. Some of the sh examples you have given are much
85 trickier to grok and write, in mine. As such, I believe that restricting
86 usage to the Shell Command Language base level of POSIX, would slow future
87 maintenance down.
88
89 >>
90 >> It's funny: there is actually a lot of emphasis given in #bash on
91 >> portability. People are routinely told not to rely on GNU command
92 >> options, and there is even occasional discussion of sh. It's just that
93 >> bash runs on so many platforms (including greycat's crusty HP-UX from
94 >> 1995) and has become a de-facto standard: if people use other shells,
95 >> those also typically support constructs like arrays, and usually add even
96 >> more, non-POSIX, stuff than bash.
97 >
98 > Consistency is wonderful yes? You're advising to rely on one GNU tool
99 > but shun others? hehehehe
100 >
101 No: like I said, that's the apparent consensus in #bash. I don't happen to
102 agree with it, since I think GNU tools can run pretty much anywhere, and
103 have no commercial or political downside. My point was that bash forms more
104 of a portable, next-gen standard than the whole GNU userland (and that
105 actually greycat would agree with your crusade against GNU tools ;) -- just
106 don't ever tell him you're a Gentoo dev, cos he *hates* Gentoo, hehe.)
107
108 Regards,
109 Steve.
110
111
112 --
113 gentoo-dev@g.o mailing list

Replies