All of lore.kernel.org
 help / color / mirror / Atom feed
* [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
@ 2012-01-22  7:52 Thomas Goirand
  2012-01-22 12:23 ` Mark Alan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thomas Goirand @ 2012-01-22  7:52 UTC (permalink / raw)
  To: mlmmj

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

Hi,

src/mlmmj-make-ml.sh.in declares it uses sh and not bash, but it has
bashism which may fail if dash is the default implementation for sh
(which is the case now in both Debian and Ubuntu).

Please apply the attached patch which removes bashism in
src/mlmmj-make-ml.sh.in. I've been carrying this patch for too long, and
I'd like to have it removed from the debian/patches folder for the next
release of MLMMJ.

Thanks,

Thomas Goirand (zigo)

[-- Attachment #2: 06_fix_bashisms_mlmmj-make-ml.diff --]
[-- Type: text/x-diff, Size: 598 bytes --]

From: <dan@icarus.sumodave.com>
Subject: Remove bashisms from make-mlmmj-ml script.
Forwarded: no
diff -urNad a/src/mlmmj-make-ml.sh.in b/src/mlmmj-make-ml.sh.in
--- a/src/mlmmj-make-ml.sh.in	2008-10-30 21:01:13.000000000 +0000
+++ b/src/mlmmj-make-ml.sh.in	2010-01-04 20:44:42.000000000 +0000
@@ -21,7 +21,7 @@
 do
 case "$Option" in 
 	h )
-	echo -e "$USAGE"
+	echo "$USAGE"
 	exit 0
 	;;
 	z )
@@ -42,7 +42,8 @@
 	CHOWN="$OPTARG"
 	;;
 	* )
-	echo -e "$0: invalid option\nTry $0 -h for more information."
+	echo "$0: invalid option"
+	echo "Try $0 -h for more information."
 	exit 1
 esac
 done

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
  2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
@ 2012-01-22 12:23 ` Mark Alan
  2012-01-22 13:27 ` Ben Schmidt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Alan @ 2012-01-22 12:23 UTC (permalink / raw)
  To: mlmmj

On Sun, 22 Jan 2012 15:52:20 +0800, Thomas Goirand <thomas@goirand.fr>
wrote:

> -	echo -e "$0: invalid option\nTry $0 -h for more information."
> +	echo "$0: invalid option"
> +	echo "Try $0 -h for more information."

Better yet, use a single command:
-	echo -e "$0: invalid option\nTry $0 -h for more information."
+	printf "$0: invalid option\nTry $0 -h for more information.\n"


M.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
  2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
  2012-01-22 12:23 ` Mark Alan
@ 2012-01-22 13:27 ` Ben Schmidt
  2012-01-22 13:36 ` Yuri D'Elia
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Schmidt @ 2012-01-22 13:27 UTC (permalink / raw)
  To: mlmmj

On 22/01/12 11:23 PM, Mark Alan wrote:
> On Sun, 22 Jan 2012 15:52:20 +0800, Thomas Goirand<thomas@goirand.fr>
> wrote:
>
>> -	echo -e "$0: invalid option\nTry $0 -h for more information."
>> +	echo "$0: invalid option"
>> +	echo "Try $0 -h for more information."
>
> Better yet, use a single command:
> -	echo -e "$0: invalid option\nTry $0 -h for more information."
> +	printf "$0: invalid option\nTry $0 -h for more information.\n"

Are you sure this is sh compatible?

I wonder if the echo version is perhaps more readable, and thus
preferable anyway, rather than single-command wizardry. What do you
think?

Ben.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
  2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
  2012-01-22 12:23 ` Mark Alan
  2012-01-22 13:27 ` Ben Schmidt
@ 2012-01-22 13:36 ` Yuri D'Elia
  2012-01-22 18:56 ` Thomas Goirand
  2012-01-23  0:18 ` Ben Schmidt
  4 siblings, 0 replies; 6+ messages in thread
From: Yuri D'Elia @ 2012-01-22 13:36 UTC (permalink / raw)
  To: mlmmj

On 22.01.2012 14:27, Ben Schmidt wrote:
> Are you sure this is sh compatible?

Yes, printf is a standard posix utility and actually less susceptible 
to the echo builtin in various shells.

> I wonder if the echo version is perhaps more readable, and thus
> preferable anyway, rather than single-command wizardry. What do you
> think?

I would prefer two echos myself.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
  2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
                   ` (2 preceding siblings ...)
  2012-01-22 13:36 ` Yuri D'Elia
@ 2012-01-22 18:56 ` Thomas Goirand
  2012-01-23  0:18 ` Ben Schmidt
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Goirand @ 2012-01-22 18:56 UTC (permalink / raw)
  To: mlmmj

On 01/22/2012 09:27 PM, Ben Schmidt wrote:
> On 22/01/12 11:23 PM, Mark Alan wrote:
>> On Sun, 22 Jan 2012 15:52:20 +0800, Thomas Goirand<thomas@goirand.fr>
>> wrote:
>>
>>> -    echo -e "$0: invalid option\nTry $0 -h for more information."
>>> +    echo "$0: invalid option"
>>> +    echo "Try $0 -h for more information."
>>
>> Better yet, use a single command:
>> -    echo -e "$0: invalid option\nTry $0 -h for more information."
>> +    printf "$0: invalid option\nTry $0 -h for more information.\n"
> 
> Are you sure this is sh compatible?

The Debian "checkbashisms" script doesn't report any error with it.

> I wonder if the echo version is perhaps more readable, and thus
> preferable anyway, rather than single-command wizardry. What do you
> think?

I agree.

Thomas


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in
  2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
                   ` (3 preceding siblings ...)
  2012-01-22 18:56 ` Thomas Goirand
@ 2012-01-23  0:18 ` Ben Schmidt
  4 siblings, 0 replies; 6+ messages in thread
From: Ben Schmidt @ 2012-01-23  0:18 UTC (permalink / raw)
  To: mlmmj

>>> Better yet, use a single command:
>>> -    echo -e "$0: invalid option\nTry $0 -h for more information."
>>> +    printf "$0: invalid option\nTry $0 -h for more information.\n"
>>
>> Are you sure this is sh compatible?
>
> The Debian "checkbashisms" script doesn't report any error with it.

Thanks to you and everyone else who confirmed this for me. It is greatly
appreciated.

>> I wonder if the echo version is perhaps more readable, and thus
>> preferable anyway, rather than single-command wizardry. What do you
>> think?
>
> I agree.

I think the majority has this view.

I'm pushing the change out now.

Ben.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-23  0:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22  7:52 [mlmmj] [patch] Remove bashism from src/mlmmj-make-ml.sh.in Thomas Goirand
2012-01-22 12:23 ` Mark Alan
2012-01-22 13:27 ` Ben Schmidt
2012-01-22 13:36 ` Yuri D'Elia
2012-01-22 18:56 ` Thomas Goirand
2012-01-23  0:18 ` Ben Schmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.