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

t0008 test fails with ksh

From
Armin Kunaschik <megabreit@googlemail.com>
Date
May 12, 2016, 17:53 UTC
Message-ID
<CALR6jEjWjJA0X2qXsxqObqc_yxrgX87LYf8cmJ0MmJFF6PkmTQ@mail.gmail.com>
Hello,

in t0008 I see tests fails with not ok 374 - --stdin -v # # expect_from_stdin <expected-verbose && # test_check_ignore "-v --stdin" <stdin # [....] not ok 381 - --stdin from subdirectory # # expect_from_stdin <expected-default && # ( # cd a && # test_check_ignore "--stdin" <../stdin # ) # not ok 382 - --stdin from subdirectory with -v # # expect_from_stdin <expected-verbose && # ( # cd a && # test_check_ignore "--stdin -v" <../stdin # ) # not ok 383 - --stdin from subdirectory with -v -n # # expect_from_stdin <expected-all && # ( # cd a && # test_check_ignore "--stdin -v -n" <../stdin # ) #

The reason seems that the snippet
cat <<-EOF >expected-all
        .gitignore:1:one        ../one
        ::      ../not-ignored
        .gitignore:1:one        one
        ::      not-ignored
        a/b/.gitignore:8:!on*   b/on
        a/b/.gitignore:8:!on*   b/one
        a/b/.gitignore:8:!on*   b/one one
        a/b/.gitignore:8:!on*   b/one two
        a/b/.gitignore:8:!on*   "b/one\"three"
        a/b/.gitignore:9:!two   b/two
        ::      b/not-ignored
        a/.gitignore:1:two*     b/twooo
        $global_excludes:2:!globaltwo   ../globaltwo
        $global_excludes:2:!globaltwo   globaltwo
        $global_excludes:2:!globaltwo   b/globaltwo
        $global_excludes:2:!globaltwo   ../b/globaltwo
        ::      c/not-ignored
EOF
behaves differently in bash and in ksh.
        a/b/.gitignore:8:!on*   "b/one\"three" comes out unmodified
with bash but with ksh it becomes
        a/b/.gitignore:8:!on*   "b/one"three"
I'm not sure what shell is "wrong" here, but when I modify the line to
        a/b/.gitignore:8:!on*   "b/one\\"three"
both shells generate the "right" output:
        a/b/.gitignore:8:!on*   "b/one\"three"
>From what I've learned I'd expect the double backslash to be the

"right" way to escape one backslash. Do you agree or am I wrong?

This snippet appears twice in this test, generates expected-all and expected-verbose.

Armin
Next: Jeff King
Message 1 of 4 in “t0008 test fails with ksh”
  1. Armin KunaschikMay 12, 2016
  2. Jeff KingMay 12, 2016
  3. Junio C HamanoMay 20, 2016
  4. Jeff KingMay 22, 2016

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.