Re: better init.d/* : who carres ?

2005-11-12 Thread Thomas Bushnell BSG
David Weinehall [EMAIL PROTECTED] writes: On Sat, Aug 27, 2005 at 02:16:39PM -0700, Thomas Bushnell BSG wrote: David Weinehall [EMAIL PROTECTED] writes: And while dash is also optional, all *correctly* written /bin/sh scripts should work with dash too. That's incorrect. A correctly

Re: better init.d/* : who carres ?

2005-11-11 Thread David Weinehall
On Sat, Aug 27, 2005 at 02:16:39PM -0700, Thomas Bushnell BSG wrote: David Weinehall [EMAIL PROTECTED] writes: And while dash is also optional, all *correctly* written /bin/sh scripts should work with dash too. That's incorrect. A correctly written /bin/sh script is allowed to use

Re: better init.d/* : who carres ?

2005-11-11 Thread Adam Heath
On Fri, 11 Nov 2005, David Weinehall wrote: On Sat, Aug 27, 2005 at 02:16:39PM -0700, Thomas Bushnell BSG wrote: David Weinehall [EMAIL PROTECTED] writes: And while dash is also optional, all *correctly* written /bin/sh scripts should work with dash too. That's incorrect. A

Re: Re: Re: better init.d/* : who carres ?

2005-09-28 Thread Alfie Costa
Wed, 21 Sep 2005 09:32:41 +, Gerrit Pape wrote: On Wed, Sep 21, 2005 at 05:07:31AM -0400, Alfie Costa wrote: Russ Allbery [EMAIL PROTECTED] wrote: I find constructs like ${string#*=} particularly difficult to read, since they require that I remember what all the different punctuation

Re: better init.d/* : who carres ?

2005-09-28 Thread Jari Aalto
Alfie Costa [EMAIL PROTECTED] writes: | Wed, 21 Sep 2005 09:32:41 +, Gerrit Pape wrote: | | ...but try come up with a rule of thumb for '%%' (big suffix), '#' | (small prefix), etc.? Maybe the 'p' in percent is for Prefix -- but no, | the Prefix is the hash symbol; two signs are bigger

Re: better init.d/* : who carres ?

2005-09-28 Thread Adam D. Barratt
On Wed, 2005-09-28 at 23:56 +0300, Jari Aalto wrote: Alfie Costa [EMAIL PROTECTED] writes: | Wed, 21 Sep 2005 09:32:41 +, Gerrit Pape wrote: | | ...but try come up with a rule of thumb for '%%' (big suffix), '#' | (small prefix), etc.? Maybe the 'p' in percent is for Prefix -- but

Re: better init.d/* : who carres ?

2005-09-23 Thread Steve Greenland
On 21-Sep-05, 03:41 (CDT), Eduard Bloch [EMAIL PROTECTED] wrote: Conclusion: usage of many (even simple) external programs is evil, though it may improve readability for some people. Replacing setting /bin/sh link to dash instead of bash and having more than 100 init scripts I can assume the

Re: better init.d/* : who carres ?

2005-09-23 Thread Henrique de Moraes Holschuh
On Fri, 23 Sep 2005, Steve Greenland wrote: Evil seems a strong term. There are other issues that sheer execution speed, and for init scripts, like most things, readability and Let's not forget that using stuff from /usr in an early initscript, or in one that could work without /usr (e.g.

Re: better init.d/* : who carres ?

2005-09-21 Thread Lionel Elie Mamane
On Thu, Aug 25, 2005 at 10:41:10AM +0200, Marc Chantreux wrote: zsh provides some things i've never seen in bash, for example : - file globbing flags, so you can set case insensitivity, That's a thing bash has: shopt -s nocaseglob. For the rest... -- Lionel -- To UNSUBSCRIBE, email to

Re: better init.d/* : who carres ?

2005-09-21 Thread Eduard Bloch
#include hallo.h * Henrique de Moraes Holschuh [Thu, Aug 25 2005, 12:17:56PM]: Well, as long as you don't start using stuff that breaks often, or that loads a ton of crap dynamically, or (even worse) is in /usr instead of /bin or /sbin... Note that using dash is probably MUCH faster than

Re: Re: better init.d/* : who carres ?

2005-09-21 Thread Alfie Costa
Russ Allbery [EMAIL PROTECTED] wrote: I find constructs like ${string#*=} particularly difficult to read, since they require that I remember what all the different punctuation characters inside this sort of parameter expansion do. According to the bash manual, there are sixteen of them, and

Re: Re: better init.d/* : who carres ?

2005-09-21 Thread Gerrit Pape
On Wed, Sep 21, 2005 at 05:07:31AM -0400, Alfie Costa wrote: Russ Allbery [EMAIL PROTECTED] wrote: I find constructs like ${string#*=} particularly difficult to read, since they require that I remember what all the different punctuation characters inside this sort of parameter expansion do.

Re: better init.d/* : who carres ?

2005-09-11 Thread Anthony DeRobertis
Henrique de Moraes Holschuh wrote: No. They are not even supposed to be scripts at all, it is pretty ok to use binary initscripts (but most people don't, and it really helps for stuff like that to be easy to debug, and binary is anything but). Ummm, not it's not. In particular, you'd be

Re: better init.d/* : who carres ?

2005-09-11 Thread Petter Reinholdtsen
[Henrique de Moraes Holschuh] No. They are not even supposed to be scripts at all, it is pretty ok to use binary initscripts [Anthony DeRobertis] Ummm, not it's not. And to make sure the scripts start in the correct order, the init.d scripts should include dependency information, for example

Re: better init.d/* : who carres ?

2005-08-27 Thread David Weinehall
On Fri, Aug 26, 2005 at 10:19:06PM +0200, Adrian von Bidder wrote: On Wednesday 24 August 2005 17.15, Miquel van Smoorenburg wrote: Make sure you use only POSIX features when doing this. I think grep -o is a GNU extension, FreeBSD doesn't have it for example. Doesn't the 'only POSIX' apply

Re: better init.d/* : who carres ?

2005-08-27 Thread Thomas Bushnell BSG
David Weinehall [EMAIL PROTECTED] writes: And while dash is also optional, all *correctly* written /bin/sh scripts should work with dash too. That's incorrect. A correctly written /bin/sh script is allowed to use Debian programs (including, say, test) and expect to get the Debian versions.

Re: better init.d/* : who carres ?

2005-08-26 Thread Marc Chantreux
Henrique de Moraes Holschuh a écrit : Note that using dash is probably MUCH faster than perl. I don't know about zsh. it's not always true : it just depends on your problems and solutions : write a dash script to open a lot of pipes between grep,sed,awk and other filters to treat a lot of

Re: better init.d/* : who carres ?

2005-08-26 Thread Marc Chantreux
Henrique de Moraes Holschuh a écrit : Anyway, just make triple sure to never use anything from /usr in a script that otherwise only needs / to work. If you find anything like that, report it as a important (usually whatever it is starts after /usr is mounted) or grave (it starts befure /usr is

Re: better init.d/* : who carres ?

2005-08-26 Thread David Weinehall
On Thu, Aug 25, 2005 at 12:17:56PM -0300, Henrique de Moraes Holschuh wrote: On Thu, 25 Aug 2005, Marc Chantreux wrote: that is a point which surprise me : i understand the dash for a posix and lightweight attitude but why use bash as modern shell ? why not perl or zsh (which are both

Re: better init.d/* : who carres ?

2005-08-26 Thread Adrian von Bidder
On Wednesday 24 August 2005 17.15, Miquel van Smoorenburg wrote: Make sure you use only POSIX features when doing this. I think grep -o is a GNU extension, FreeBSD doesn't have it for example. Doesn't the 'only POSIX' apply to the shell code only? At least, shouldn't it be judged on a

Re: better init.d/* : who carres ?

2005-08-25 Thread Marc Chantreux
First of all, thank you all for your answers. i'll provide some documented, posix compliant, one piped patches as wishlist. Of course this would all be so much simpler if we could actually use the power of modern shells (post 1993) in init scripts - subprocesses wouldn't be required at

Re: better init.d/* : who carres ?

2005-08-25 Thread Andrew Porter
On Thu, 2005-08-25 at 09:35 +0200, Marc Chantreux wrote: that is a point which surprise me : i understand the dash for a posix and lightweight attitude but why use bash as modern shell ? why not perl or zsh (which are both more powerfull) ? bash is actually pretty good if you know how to

Re: better init.d/* : who carres ?

2005-08-25 Thread Marc Chantreux
Andrew Porter a écrit : bash is actually pretty good if you know how to use it (and most of the ksh93 comliant functions) - the problem is that most programmers don't. The ${} constructs add a lot of power and allow the programmer to be less reliant on external tools. zsh provides some things

Re: better init.d/* : who carres ?

2005-08-25 Thread Andrew Porter
On Thu, 2005-08-25 at 10:41 +0200, Marc Chantreux wrote: at least, i think zsh is better because it's almost 200k thinner: % ls -sh =zsh4 =bash 616K /bin/bash 456K /bin/zsh4 I acutally use ksh for all my shell scripts (bash hasn't quite made it yet IMHO) and that beats both - 636K /bin/ksh

Re: better init.d/* : who carres ?

2005-08-25 Thread Lars Wirzenius
to, 2005-08-25 kello 09:35 +0200, Marc Chantreux kirjoitti: that is a point which surprise me : i understand the dash for a posix and lightweight attitude but why use bash as modern shell ? why not perl or zsh (which are both more powerfull) ? I think it would be good for us to take pity on

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Wed, 24 Aug 2005, Marc Chantreux wrote: that are not bugs so i wonder if package maintainers where pleased if i reportbug those lines as wishlist. Why would they be displeased? Anyway, just make triple sure to never use anything from /usr in a script that otherwise only needs / to work.

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Wed, 24 Aug 2005, Peter Palfrader wrote: mysqld_get_param () { /usr/sbin/mysqld --print-defaults | sed -ne s/^.*--$1=\\([^ ]\\+\\).*\$/\\1/p } And harder to read. Making scripts more complex and harder to read for Huh? Anyone that has problem with that sed expression

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Wed, 24 Aug 2005, Andrew Porter wrote: Both require knowledge of a particular tools - one only one tool though. Once you have that knowledge I would suggest that the single command version is easier to read (though I personally would use awk). awk is in /usr, and I recall I got problems

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Wed, 24 Aug 2005, Mauro Calderara wrote: Aren't the init-scripts supposed to be posix-compilant? Often when No. They are not even supposed to be scripts at all, it is pretty ok to use binary initscripts (but most people don't, and it really helps for stuff like that to be easy to debug, and

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Thu, 25 Aug 2005, Marc Chantreux wrote: that is a point which surprise me : i understand the dash for a posix and lightweight attitude but why use bash as modern shell ? why not perl or zsh (which are both more powerfull) ? Well, as long as you don't start using stuff that breaks often,

Re: better init.d/* : who carres ?

2005-08-25 Thread Steinar H. Gunderson
On Thu, Aug 25, 2005 at 12:09:32PM -0300, Henrique de Moraes Holschuh wrote: mysqld_get_param () { /usr/sbin/mysqld --print-defaults | sed -ne s/^.*--$1=\\([^ ]\\+\\).*\$/\\1/p } And harder to read. Making scripts more complex and harder to read for Huh? Anyone that has problem

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Thu, 25 Aug 2005, Steinar H. Gunderson wrote: fluently. Are you saying that people who don't read the (IMHO rather arcane) sed regex syntax, having problems with such syntax, shouldn't touch I am saying that people who *can't* read the sed regex syntax, shouldn't touch Debian initscripts,

Re: better init.d/* : who carres ?

2005-08-25 Thread sean finney
On Thu, Aug 25, 2005 at 12:44:13PM -0300, Henrique de Moraes Holschuh wrote: On Thu, 25 Aug 2005, Steinar H. Gunderson wrote: fluently. Are you saying that people who don't read the (IMHO rather arcane) sed regex syntax, having problems with such syntax, shouldn't touch I am saying that

Re: better init.d/* : who carres ?

2005-08-25 Thread Henrique de Moraes Holschuh
On Thu, 25 Aug 2005, sean finney wrote: On Thu, Aug 25, 2005 at 12:44:13PM -0300, Henrique de Moraes Holschuh wrote: On Thu, 25 Aug 2005, Steinar H. Gunderson wrote: fluently. Are you saying that people who don't read the (IMHO rather arcane) sed regex syntax, having problems with

better init.d/* : who carres ?

2005-08-24 Thread Marc Chantreux
Hi all, there are a lot of things in /etc/init.d/*, and {pre,post}inst scripts that can be rewritten more efficiently ( i think ). for example, in /etc/init.d/mysqld mysqld_get_param() { /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \

Re: better init.d/* : who carres ?

2005-08-24 Thread Francesco P. Lovergine
On Wed, Aug 24, 2005 at 04:50:40PM +0200, Marc Chantreux wrote: that are not bugs so i wonder if package maintainers where pleased if i reportbug those lines as wishlist. Why not? a patch is a patch. -- Francesco P. Lovergine -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject

Re: better init.d/* : who carres ?

2005-08-24 Thread Ondrej Sury
that are not bugs so i wonder if package maintainers where pleased if i reportbug those lines as wishlist. If you submit patch as wishlist, then it's ok (at least for me). O. -- Ondrej Sury [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part

Re: better init.d/* : who carres ?

2005-08-24 Thread Miquel van Smoorenburg
In article [EMAIL PROTECTED], Marc Chantreux [EMAIL PROTECTED] wrote: there are a lot of things in /etc/init.d/*, and {pre,post}inst scripts that can be rewritten more efficiently ( i think ). for example, in /etc/init.d/mysqld mysqld_get_param() { /usr/sbin/mysqld --print-defaults \

Re: better init.d/* : who carres ?

2005-08-24 Thread Peter Palfrader
On Wed, 24 Aug 2005, Miquel van Smoorenburg wrote: for example, in /etc/init.d/mysqld mysqld_get_param() { /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \ | tail -n 1 \ | cut -d= -f2 } can be

Re: better init.d/* : who carres ?

2005-08-24 Thread Andrew Porter
On Wed, 2005-08-24 at 17:44 +0200, Peter Palfrader wrote: I could debate with you whether /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \ | tail -n 1 \ | cut -d= -f2 is harder to read than

Re: better init.d/* : who carres ?

2005-08-24 Thread sean finney
hi, On Wed, Aug 24, 2005 at 04:50:40PM +0200, Marc Chantreux wrote: for example, in /etc/init.d/mysqld mysqld_get_param() { /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \ | tail -n 1 \ | cut -d= -f2

Re: better init.d/* : who carres ?

2005-08-24 Thread sean finney
On Wed, Aug 24, 2005 at 05:22:32PM +0100, Andrew Porter wrote: /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \ | tail -n 1 \ | cut -d= -f2 is harder to read than /usr/sbin/mysqld

Re: better init.d/* : who carres ?

2005-08-24 Thread Humberto Massa Guimarães
** Peter Palfrader :: mysqld_get_param () { /usr/sbin/mysqld --print-defaults | sed -ne s/^.*--$1=\\([^ ]\\+\\).*\$/\\1/p } And harder to read. Making scripts more complex and harder to read for some dubious efficiency is not a good idea in my opinion. I respectfully

Re: better init.d/* : who carres ?

2005-08-24 Thread Russ Allbery
Marc Chantreux [EMAIL PROTECTED] writes: there are a lot of things in /etc/init.d/*, and {pre,post}inst scripts that can be rewritten more efficiently ( i think ). for example, in /etc/init.d/mysqld mysqld_get_param() { /usr/sbin/mysqld --print-defaults \ | tr \n

Re: better init.d/* : who carres ?

2005-08-24 Thread sean finney
On Wed, Aug 24, 2005 at 11:08:41PM +0200, Mauro Calderara wrote: Aren't the init-scripts supposed to be posix-compilant? Often when installing dash as /bin/sh this becomes a problem because even though dash is posix-compatible it tends to break init-scripts for me. Whether this is dash's fault

Re: better init.d/* : who carres ?

2005-08-24 Thread Mauro Calderara
On Aug 24, 2005, at 11:19 PM, sean finney wrote: On Wed, Aug 24, 2005 at 11:08:41PM +0200, Mauro Calderara wrote: Aren't the init-scripts supposed to be posix-compilant? Often when installing dash as /bin/sh this becomes a problem because even though dash is posix-compatible it tends to break

Re: better init.d/* : who carres ?

2005-08-24 Thread Mauro Calderara
On Aug 24, 2005, at 6:43 PM, sean finney wrote: On Wed, Aug 24, 2005 at 05:22:32PM +0100, Andrew Porter wrote: /usr/sbin/mysqld --print-defaults \ | tr \n \ | grep -- --$1 \ | tail -n 1 \ | cut -d= -f2 is harder to