[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: formatting in gnupload
From: |
Ralf Wildenhues |
Subject: |
Re: formatting in gnupload |
Date: |
Sat, 30 Jun 2007 11:23:53 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello Karl,
* Karl Berry wrote on Fri, Jun 29, 2007 at 11:59:44PM CEST:
> It's a trivial point, but in gnupload in CVS, I see:
>
> for file;
> do
>
> Why the newline?
Actually it's not a trivial point at all. Quoting from the Autoconf
manual shell portability section (Limitations of Builtins):
| `for'
| To loop over positional arguments, use:
|
| for arg
| do
| echo "$arg"
| done
|
| You may _not_ leave the `do' on the same line as `for', since some
| shells improperly grok:
|
| for arg; do
| echo "$arg"
| done
This holds especially for "for" loops over positional arguments.
And yes, the code in gnupload has a bug here in that the semicolon
should not be there. Solaris 10 /bin/sh exposes this issue.
I'm applying the patch below to Automake and syncing to gnulib.
(Note the semicolon after "$to" isn't actually a problem, but it's not
necessary either, so I removed it.) Thanks for the report.
Cheers,
Ralf
2007-06-30 Ralf Wildenhues <address@hidden>
* lib/gnupload: Fix shell portability issues with for loops.
Report by Karl Berry.
Index: lib/gnupload
===================================================================
RCS file: /cvs/automake/automake/lib/gnupload,v
retrieving revision 1.10
diff -u -r1.10 gnupload
--- lib/gnupload 12 Nov 2006 09:49:50 -0000 1.10
+++ lib/gnupload 30 Jun 2007 09:17:41 -0000
@@ -1,9 +1,9 @@
#!/bin/sh
# Sign files and upload them.
-scriptversion=2006-11-12.11
+scriptversion=2007-06-30.12
-# Copyright (C) 2004, 2005, 2006 Free Software Foundation
+# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -102,7 +102,7 @@
# Make sure all files exist. We don't want to ask
# for the passphrase if the script will fail.
-for file;
+for file
do
if test ! -f $file; then
echo "$0: Cannot find \`$file'" 1>&2
@@ -127,16 +127,16 @@
stty echo
echo
-for file;
+for file
do
echo "Signing $file..."
rm -f $file.sig
echo $passphrase | $GPG --passphrase-fd 0 -ba -o $file.sig $file
done
-for dest in $to;
+for dest in $to
do
- for file;
+ for file
do
echo "Uploading $file to $dest..."
files="$file $file.sig"
- Re: formatting in gnupload,
Ralf Wildenhues <=