git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Shell script cleanups/style changes?

From
David Kastrup <dak@gnu.org>
Date
Aug 2, 2007, 21:42 UTC
Message-ID
<857iodzk8n.fsf@lola.goethe.zz>
In-Reply-To
<7vsl71tyyq.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> David Kastrup <dak@gnu.org> writes:
>
>> Understood.  But using ${...#...} and ${...:+...} does not exactly
>> seem to be news in the git code base.  Even though we have the
>> claim that Solaris' sh won't deal with the former.
>
> I do not think we have trouble with ${parameter#word}.  Much less
> with ${parameter+word}; it has been in /bin/sh forever.

Basically this should mean that the proposed cleanups (apart from a forgotten shift I had to add) are tenable.

Given that another poster claimed that Solaris /bin/sh does not support ${parameter#word}, making the suggested changes to git-commit might actually be a good idea: ${parameter#word} is used in half a dozen other (likely less used) utilities in various other places. If this is an overlooked regression, we want to make it non-overlookable while we are still in testing, and git-commit would appear to be the perfect candidate for that...

Depending on the feedback, we can either replace _all_ uses everywhere, or accept it for good.

While I would think it perfectly understandable if you wanted to avoid making an infamous "breaks all of Solaris release", _if_ ${...#...} would indeed be fishy (and I somewhat doubt it), we are already there. I have this cleaned-up version of git-commit.sh on a computer I can't access right now. I'll post the patch tomorrow. Whether you want to apply it to git.git remains at your discretion. I would, however, strongly urge Solaris and potentially other POSIXly impaired users to aplly and test this patch: if it breaks (and it will do so pretty obviously, pretty much being unable to parse any option), then this is _quite_ alarming with regard to existing uses of ${...#...} and would need to get addressed _very_ soon.

Frankly, I doubt that this would have escaped notice so far, however.
-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Previous: Junio C Hamano
Message 42 of 42 in “Shell script cleanups/style changes?”
  1. David KastrupAug 2, 2007
  2. Robert SchieleAug 2, 2007
  3. David KastrupAug 2, 2007
  4. Robert SchieleAug 2, 2007
  5. Johannes SchindelinAug 2, 2007
  6. Robert SchieleAug 2, 2007
  7. Uwe Kleine-KönigAug 3, 2007
  8. Bradford SmithAug 2, 2007
  9. Sam RavnborgAug 2, 2007
  10. Junio C HamanoAug 2, 2007
  11. Nguyen Thai Ngoc DuyAug 2, 2007
  12. David KastrupAug 2, 2007
  13. Junio C HamanoAug 2, 2007
  14. David KastrupAug 2, 2007
  15. Junio C HamanoAug 2, 2007
  16. Junio C HamanoAug 2, 2007
  17. David KastrupAug 2, 2007
  18. Robert SchieleAug 2, 2007
  19. David KastrupAug 2, 2007
  20. Junio C HamanoAug 2, 2007
  21. David KastrupAug 2, 2007
  22. Junio C HamanoAug 3, 2007
  23. David KastrupAug 3, 2007
  24. Junio C HamanoAug 3, 2007
  25. David KastrupAug 3, 2007
  26. Junio C HamanoAug 3, 2007
  27. David KastrupAug 3, 2007
  28. David KastrupAug 3, 2007
  29. Robert SchieleAug 3, 2007
  30. David KastrupAug 3, 2007
  31. Robert SchieleAug 2, 2007
  32. David KastrupAug 2, 2007
  33. Robert SchieleAug 2, 2007
  34. David KastrupAug 2, 2007
  35. Robert SchieleAug 3, 2007
  36. David KastrupAug 3, 2007
  37. Junio C HamanoAug 3, 2007
  38. Robert SchieleAug 2, 2007
  39. Florian WeimerAug 4, 2007
  40. Robert SchieleAug 4, 2007
  41. Junio C HamanoAug 4, 2007
  42. David KastrupAug 2, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.