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

Re: [PATCH 11/12] t0610: fix non-portable variable assignment

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Apr 5, 2024, 09:14 UTC
Message-ID
<CAPig+cSb_cKXYaNCBpe9Uy_iGB_K2NXaw4d1hg5bPuVaCEWvjA@mail.gmail.com>
In-Reply-To
<c2c2747ff57f68ccad8b509af037e1fc4a524fa1.1712235356.git.ps@pks.im>
On Fri, Apr 5, 2024 at 3:51 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 6 quoted lines
> In `test_expect_perms()` we assign the output of a command to a variable
> declared via `local`. To assert that the command is actually successful
> we also chain it with `&&`. This construct is seemingly not portable and
> may fail with "local: 1: bad variable name".
>
> Split up the variable declaration and assignment to fix this.

Under what configuration, circumstances, conditions did you encounter this problem? I ask because this isn't the only such case in the test suite, as shown by:

    git grep -nP 'local ..*=\$\(..*&&' -- t

What makes this case distinct from the others? Including such information would improve the commit message and help future readers.

Show 11 quoted lines
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
> @@ -80,8 +80,9 @@ test_expect_success 'init: reinitializing reftable with files backend fails' '
>  test_expect_perms () {
>         local perms="$1"
>         local file="$2"
> -       local actual=$(ls -l "$file") &&
> +       local actual
>
> +       actual=$(ls -l "$file") &&
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 15 of 106 in “t: exercise Git/JGit reftable compatibility”
  1. 00/12 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 4, 2024
  2. 01/12 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 4, 2024
  3. 02/12 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 4, 2024
  4. 03/12 ci: allow skipping sudo on dockerized jobsPatrick Steinhardt, Apr 4, 2024
  5. 04/12 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 4, 2024
  6. 05/12 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 4, 2024
  7. 06/12 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 4, 2024
  8. 07/12 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 4, 2024
  9. 08/12 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 4, 2024
  10. Josh SteadmonApr 5, 2024
  11. Patrick SteinhardtApr 8, 2024
  12. 09/12 ci: install JGit dependencyPatrick Steinhardt, Apr 4, 2024
  13. 10/12 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 4, 2024
  14. 11/12 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 4, 2024
  15. Eric SunshineApr 5, 2024
  16. Patrick SteinhardtApr 5, 2024
  17. Junio C HamanoApr 5, 2024
  18. CodingGuidelines: quote assigned value with "local" and "export"Junio C Hamano, Apr 5, 2024
  19. Junio C HamanoApr 5, 2024
  20. Jeff KingApr 5, 2024
  21. Junio C HamanoApr 5, 2024
  22. Junio C HamanoApr 5, 2024
  23. Jeff KingApr 7, 2024
  24. Patrick SteinhardtApr 5, 2024
  25. 12/12 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 4, 2024
  26. Han-Wen NienhuysApr 4, 2024
  27. Patrick SteinhardtApr 5, 2024
  28. Han-Wen NienhuysApr 6, 2024
  29. Patrick SteinhardtApr 6, 2024
  30. Patrick SteinhardtApr 8, 2024
  31. Patrick SteinhardtApr 4, 2024
  32. 00/12 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 8, 2024
  33. 02/12 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 8, 2024
  34. 03/12 ci: allow skipping sudo on dockerized jobsPatrick Steinhardt, Apr 8, 2024
  35. Toon claesApr 10, 2024
  36. Junio C HamanoApr 10, 2024
  37. Patrick SteinhardtApr 11, 2024
  38. 04/12 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 8, 2024
  39. 05/12 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 8, 2024
  40. Justin ToblerApr 10, 2024
  41. Patrick SteinhardtApr 11, 2024
  42. 06/12 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 8, 2024
  43. 07/12 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 8, 2024
  44. 08/12 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 8, 2024
  45. 09/12 ci: install JGit dependencyPatrick Steinhardt, Apr 8, 2024
  46. 10/12 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 8, 2024
  47. 11/12 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 8, 2024
  48. Eric SunshineApr 8, 2024
  49. Patrick SteinhardtApr 8, 2024
  50. 12/12 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 8, 2024
  51. Eric SunshineApr 8, 2024
  52. Junio C HamanoApr 8, 2024
  53. Eric SunshineApr 8, 2024
  54. Eric SunshineApr 8, 2024
  55. Patrick SteinhardtApr 8, 2024
  56. Jeff KingApr 8, 2024
  57. Junio C HamanoApr 8, 2024
  58. Junio C HamanoApr 8, 2024
  59. Justin ToblerApr 10, 2024
  60. Patrick SteinhardtApr 11, 2024
  61. 01/12 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 8, 2024
  62. Junio C HamanoApr 9, 2024
  63. Patrick SteinhardtApr 9, 2024
  64. Junio C HamanoApr 9, 2024
  65. Patrick SteinhardtApr 9, 2024
  66. 0/2 t0610: fix umask testsPatrick Steinhardt, Apr 9, 2024
  67. 1/2 t0610: make `--shared=` tests reusablePatrick Steinhardt, Apr 9, 2024
  68. 2/2 t0610: execute git-pack-refs(1) with specified umaskPatrick Steinhardt, Apr 9, 2024
  69. Justin ToblerApr 10, 2024
  70. 00/13 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 11, 2024
  71. 01/13 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 11, 2024
  72. 02/13 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 11, 2024
  73. 03/13 ci: skip sudo when we are already rootPatrick Steinhardt, Apr 11, 2024
  74. 04/13 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 11, 2024
  75. 05/13 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 11, 2024
  76. 06/13 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 11, 2024
  77. 07/13 ci: fix setup of custom path for GitLab CIPatrick Steinhardt, Apr 11, 2024
  78. Eric SunshineApr 11, 2024
  79. Patrick SteinhardtApr 11, 2024
  80. 08/13 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 11, 2024
  81. 09/13 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 11, 2024
  82. 10/13 ci: install JGit dependencyPatrick Steinhardt, Apr 11, 2024
  83. 11/13 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 11, 2024
  84. 12/13 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 11, 2024
  85. 13/13 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 11, 2024
  86. 00/13 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 12, 2024
  87. 01/13 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 12, 2024
  88. 02/13 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 12, 2024
  89. 03/13 ci: skip sudo when we are already rootPatrick Steinhardt, Apr 12, 2024
  90. 04/13 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 12, 2024
  91. 05/13 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 12, 2024
  92. 06/13 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 12, 2024
  93. 07/13 ci: fix setup of custom path for GitLab CIPatrick Steinhardt, Apr 12, 2024
  94. 08/13 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 12, 2024
  95. 09/13 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 12, 2024
  96. 10/13 ci: install JGit dependencyPatrick Steinhardt, Apr 12, 2024
  97. 11/13 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 12, 2024
  98. 12/13 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 12, 2024
  99. 13/13 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 12, 2024
  100. Justin ToblerMay 3, 2024
  101. Patrick SteinhardtMay 3, 2024
  102. Patrick SteinhardtMay 3, 2024
  103. Justin ToblerMay 3, 2024
  104. Patrick SteinhardtMay 3, 2024
  105. Justin ToblerMay 4, 2024
  106. Patrick SteinhardtMay 6, 2024

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.