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

Re: [PATCH 3/4] ci/lib: use echo instead of printf to set up sections

From
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Date
Dec 7, 2024, 09:13 UTC
Message-ID
<Z1QRp8jFJPYdNmQk@ugly>
In-Reply-To
<20241206-pks-ci-section-fixes-v1-3-7ab1b69e3648@pks.im>
On Fri, Dec 06, 2024 at 12:10:15PM +0100, Patrick Steinhardt wrote:
>We use printf to set up sections with GitLab CI even though we could
>trivially use echo.
>

probably not a good idea, because the file is also included from plain sh scripts, which may invoke an `echo` that cannot deal with \escapes. at least potentially.

>This may cause problems in case the argument passed to `begin_group ()`
>or `end_group ()` contains formatting directives as we use them as part
>of the formatting string.
>
that can be fixed properly by using the %s expando.
>+++ b/ci/lib.sh
>-		printf "\e[0Ksection_start:$(date +%s):$(echo "$1" | tr ' ' _)[collapsed=true]\r\e[0K$1\n"
>+		echo "\e[0Ksection_start:$(date +%s):$(echo "$1" | tr ' ' _)[collapsed=true]\r\e[0K$1"
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 8 of 20 in “Random improvements to GitLab CI”
  1. 0/4 Random improvements to GitLab CIPatrick Steinhardt, Dec 6, 2024
  2. 2/4 ci/lib: remove duplicate trap to end "CI setup" groupPatrick Steinhardt, Dec 6, 2024
  3. 1/4 gitlab-ci: update macOS images to SonomaPatrick Steinhardt, Dec 6, 2024
  4. karthik nayakDec 6, 2024
  5. Patrick SteinhardtDec 6, 2024
  6. karthik nayakDec 7, 2024
  7. 3/4 ci/lib: use echo instead of printf to set up sectionsPatrick Steinhardt, Dec 6, 2024
  8. Oswald BuddenhagenDec 7, 2024
  9. Patrick SteinhardtDec 10, 2024
  10. 4/4 ci/lib: fix "CI setup" sections with GitLab CIPatrick Steinhardt, Dec 6, 2024
  11. karthik nayakDec 6, 2024
  12. karthik nayakDec 6, 2024
  13. Patrick SteinhardtDec 6, 2024
  14. 0/4 Random improvements to GitLab CIPatrick Steinhardt, Dec 10, 2024
  15. 1/4 gitlab-ci: update macOS images to SonomaPatrick Steinhardt, Dec 10, 2024
  16. 2/4 ci/lib: remove duplicate trap to end "CI setup" groupPatrick Steinhardt, Dec 10, 2024
  17. 3/4 ci/lib: do not interpret escape sequences in `group ()` argumentsPatrick Steinhardt, Dec 10, 2024
  18. Toon ClaesDec 11, 2024
  19. Patrick SteinhardtDec 12, 2024
  20. 4/4 ci/lib: fix "CI setup" sections with GitLab CIPatrick Steinhardt, Dec 10, 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.