On Tue, 2 Aug 2011, Ritesh Raj Sarraf wrote:
> On 08/02/2011 03:18 PM, Cristian Ionescu-Idbohrn wrote:
> > Sad :(
> > I suppose you know:
> >
> >     # dpkg-reconfigure dash
> >
> > provides a mekanism to choose the default shell, but you seem to be
> > choosing to ignore that.
> Debian defaults to dash.

Yes.

> With dash, I end up covering most of the users setup.

Yes.  But really...  What is there to win by tying the scripts to
either dash, bash or whatever, instead of making the said scripts
portable, when the effort to do so is so small?

> Don't get me wrong. Time is limited. That's why I asked for your help.

I don't think you need my help to 'exit 0' instead of 'return 0'.
That's a no-brainer.  As I said in a previous post, I don't think it
makes much sense to use either at the end of the script.

You may want some help to make the scripts POSIX complient, consistent
and efficient.  That's what I can offer help with, if you're interested.

> In the past, I've spent too much time in bash vs dash (mawk vs gawk)
> compatibility issues.

Right.  Here is one simple example of what I've been talking about
and, in a way, a compatibility non-issue:

,---- [ usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon ]
| while ( true ) ; do
|       sleep $INTERVAL
|
|       /usr/sbin/laptop_mode auto
| done
`----

Now, what is the point with forking a subshell '( true )' just to
execute the (built in most shells) command 'true', when the command
':' is guaranteed built in all POSIX complient shells?

-while ( true ) ; do
+while :; do

This command:

        /usr/sbin/laptop_mode auto

can fail (indefinitely) both in a number of known places:

usr/sbin/laptop_mode:250:           exit 1
usr/sbin/laptop_mode:533:           exit 1
usr/sbin/laptop_mode:538:           exit 1
usr/sbin/laptop_mode:561:                     exit 1 ;;

and also not yet known places, I presume.  The exit status after
execution is not validated.


Cheers,

-- 
Cristian



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to