All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Naohiro Aota <naota@elisp.net>,
	git@vger.kernel.org, tarmigan+git@gmail.com,
	David Barr <davidbarr@google.com>
Subject: Re: [PATCH] shell portability: Use sed instead of non-portable variable expansion
Date: Mon, 05 Sep 2011 01:22:04 -0700	[thread overview]
Message-ID: <7vaaajcsb7.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4E648031.6050607@viscovery.net> (Johannes Sixt's message of "Mon, 05 Sep 2011 09:54:25 +0200")

Johannes Sixt <j.sixt@viscovery.net> writes:

> Am 9/5/2011 9:09, schrieb Junio C Hamano:
>> By the way, t9010 uses ${#parameter} (strlen) which is bashism we forbid,
>> and it needs to be rewritten (David CC'ed).
>
> Actually, no. It is perfectly valid POSIX. So we would need this patch.
>
> --- 8< ---
> From: Johannes Sixt <j6t@kdbg.org>
> Subject: [PATCH] CodingGuidelines: ${#parameter} is POSIX and should be allowed
>
> See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---

I would prefer to play it safe at least for now, especially before 1.7.7
ships.

 Documentation/CodingGuidelines |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index fe1c1e5..594fb76 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -52,7 +52,7 @@ For shell scripts specifically (not exhaustive):
 
    - No shell arrays.
 
-   - No strlen ${#parameter}.
+   - No strlen ${#parameter} (even though it is in POSIX).
 
    - No pattern replacement ${parameter/pattern/string}.
 

  parent reply	other threads:[~2011-09-05  8:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-05  5:11 [PATCH] shell portability: Use sed instead of non-portable variable expansion Naohiro Aota
2011-09-05  7:03 ` Johannes Sixt
2011-09-05  7:15   ` Junio C Hamano
2011-09-05  7:35     ` Johannes Sixt
2011-09-05  7:45       ` Junio C Hamano
2011-09-05  8:16         ` Johannes Sixt
2011-09-05  8:21           ` Johannes Sixt
2011-09-05  7:55   ` Naohiro Aota
2011-09-05  7:09 ` Junio C Hamano
2011-09-05  7:54   ` Johannes Sixt
2011-09-05  8:11     ` Junio C Hamano
2011-09-05  8:22     ` Junio C Hamano [this message]
2011-09-06 19:09   ` [PATCH] Makefile: abort on shells that do not support ${parameter%word} expansion Brandon Casey
2011-09-06 19:32     ` Brandon Casey
2011-09-06 20:30       ` Brandon Casey
2011-09-06 20:01     ` Junio C Hamano
2011-09-06 20:09       ` Brandon Casey
2011-09-06 20:03     ` Junio C Hamano
2011-09-06 20:20       ` Brandon Casey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vaaajcsb7.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=naota@elisp.net \
    --cc=tarmigan+git@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.