Junio C Hamano <gitster@xxxxxxxxx> writes: I guess I didn't give an explicit conclusion in my message. >> - it's in POSIX, at least as far back as 2004 (I couldn't find an easy >> copy of the 2001 version). That doesn't prove there aren't >> problematic systems, of course, but it at least passes the bar of >> "not even in POSIX". > > Yeah, IIRC the list was written in response to a request for _some_ > guidance, so it largely came from in-house rules of my previous > life, back when I had to deal with various flavours of UNIXen. I strongly suspect that most of these historical curiosity systems died out or learned ${#posix}; I wouldn't at all be surprised if /bin/sh on Solaris back then was one of the motivating systems that led to the forbidding of the use of ${#parameter} in our in-house rules, but luckily, we have written it off as unsalvageable in this project ;-) It has been in POSIX long enough, and it is useful at times, so let's drop it from the list of guidelines (patch?). >> - it's not in check-non-portable-shell.pl. :) That doesn't mean >> CodingGuidelines is wrong, but we should probably reconcile them. > > That checker came much much later than the guidelines so it is not > surprising at all for it to be "buggy", in the sense that it does > not check everything the guidelines ask. Yes, we may need bugfixes > and there may be other bugs, too. This still gives us something to keep an eye on. -- >8 -- Subject: CodingGuidelines: allow ${#posix} == strlen($posix) The construct has been in POSIX for the past 10+ years, and we have used in t9xxx (subversion) series of the tests, so we know it is at least portable across systems that subversion Perl bindings have been ported to. Let's loosen the rule; luckily, the check-non-portable-shell script does not have any rule to find its use, so the only change needed is a removal of one paragraph from the documentation. Helped-by: Jeff King <peff@xxxxxxxx> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- Documentation/CodingGuidelines | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index ed4e443a3c..390ceece52 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -91,8 +91,6 @@ For shell scripts specifically (not exhaustive): - No shell arrays. - - No strlen ${#parameter}. - - No pattern replacement ${parameter/pattern/string}. - We use Arithmetic Expansion $(( ... )).