{"thread":{"id":"39884","subject":"[PATCH 1/2] Modify tr expression so that xpg4/tr handles it on Solaris","startedAt":"2015-07-18T15:21:17Z","lastAt":"2015-07-19T03:45:11Z","messageCount":3,"participants":["Ben Walton","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"266330","messageId":"1437232877-27897-1-git-send-email-bdwalton@gmail.com","threadId":"39884","inReplyTo":null,"subject":"[PATCH 1/2] Modify tr expression so that xpg4/tr handles it on Solaris","fromName":"Ben Walton","fromEmail":"bdwalton@gmail.com","sentAt":"2015-07-18T15:21:17Z","receivedAt":"2015-07-18T15:21:17Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"It seems that xpg4/tr mishandles some strings involving [ not followed\nby a character class:\n% echo '[::1]' | /usr/xpg4/bin/tr -d '[]'\n[::1\n\n% echo '[::1]' | /usr/xpg4/bin/tr -d '['\nusr/xpg4/bin/tr: Bad string.\n\nThis was breaking two tests. To fix the issue, use the octal\nrepresentations of [ and ] instead.\n\nSigned-off-by: Ben Walton <bdwalton@gmail.com>\n---\n t/t5500-fetch-pack.sh |    2 +-\n t/t5601-clone.sh      |    8 ++++----\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\nindex 3a9b775..5bc4da9 100755\n--- a/t/t5500-fetch-pack.sh\n+++ b/t/t5500-fetch-pack.sh\n@@ -547,7 +547,7 @@ check_prot_host_port_path () {\n \t\t*ssh*)\n \t\tpp=ssh\n \t\tuah=userandhost\n-\t\tehost=$(echo $3 | tr -d \"[]\")\n+\t\tehost=$(echo $3 | tr -d \"\\133\\135\")\n \t\tdiagport=\"Diag: port=$4\"\n \t\t;;\n \t\t*)\ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nindex bfdaf75..fa6be3c 100755\n--- a/t/t5601-clone.sh\n+++ b/t/t5601-clone.sh\n@@ -445,7 +445,7 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '\n #IPv6\n for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:\n do\n-\tehost=$(echo $tuah | sed -e \"s/1]:/1]/ \"| tr -d \"[]\")\n+\tehost=$(echo $tuah | sed -e \"s/1]:/1]/ \" | tr -d \"\\133\\135\")\n \ttest_expect_success \"clone ssh://$tuah/home/user/repo\" \"\n \t  test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo\n \t\"\n@@ -454,7 +454,7 @@ done\n #IPv6 from home directory\n for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]\n do\n-\teuah=$(echo $tuah | tr -d \"[]\")\n+\teuah=$(echo $tuah | tr -d \"\\133\\135\")\n \ttest_expect_success \"clone ssh://$tuah/~repo\" \"\n \t  test_clone_url ssh://$tuah/~repo $euah '~repo'\n \t\"\n@@ -463,7 +463,7 @@ done\n #IPv6 with port number\n for tuah in [::1] user@[::1] [user@::1]\n do\n-\teuah=$(echo $tuah | tr -d \"[]\")\n+\teuah=$(echo $tuah | tr -d \"\\133\\135\")\n \ttest_expect_success \"clone ssh://$tuah:22/home/user/repo\" \"\n \t  test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo\n \t\"\n@@ -472,7 +472,7 @@ done\n #IPv6 from home directory with port number\n for tuah in [::1] user@[::1] [user@::1]\n do\n-\teuah=$(echo $tuah | tr -d \"[]\")\n+\teuah=$(echo $tuah | tr -d \"\\133\\135\")\n \ttest_expect_success \"clone ssh://$tuah:22/~repo\" \"\n \t  test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'\n \t\"\n-- \n1.7.10.4\n"},{"id":"266364","messageId":"CAPig+cQYROsp4nsEj1cJ=W+BtxO5iQ0_UHUaJHScpN7iQBpi6A@mail.gmail.com","threadId":"39884","inReplyTo":"1437232877-27897-1-git-send-email-bdwalton@gmail.com","subject":"Re: [PATCH 1/2] Modify tr expression so that xpg4/tr handles it on Solaris","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-19T03:31:53Z","receivedAt":"2015-07-19T03:31:53Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Jul 18, 2015 at 11:21 AM, Ben Walton <bdwalton@gmail.com> wrote:\n> It seems that xpg4/tr mishandles some strings involving [ not followed\n> by a character class:\n> % echo '[::1]' | /usr/xpg4/bin/tr -d '[]'\n> [::1\n>\n> % echo '[::1]' | /usr/xpg4/bin/tr -d '['\n> usr/xpg4/bin/tr: Bad string.\n\nI suppose that \"tr -d ']['\" also gives a \"Bad string.\" error?\n\n> This was breaking two tests. To fix the issue, use the octal\n> representations of [ and ] instead.\n>\n> Signed-off-by: Ben Walton <bdwalton@gmail.com>\n> ---\n>  t/t5500-fetch-pack.sh |    2 +-\n>  t/t5601-clone.sh      |    8 ++++----\n>  2 files changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\n> index 3a9b775..5bc4da9 100755\n> --- a/t/t5500-fetch-pack.sh\n> +++ b/t/t5500-fetch-pack.sh\n> @@ -547,7 +547,7 @@ check_prot_host_port_path () {\n>                 *ssh*)\n>                 pp=ssh\n>                 uah=userandhost\n> -               ehost=$(echo $3 | tr -d \"[]\")\n> +               ehost=$(echo $3 | tr -d \"\\133\\135\")\n\nThese octal values are somewhat opaque. To make this more\nself-documenting, would it make sense instead to define a global\nvariable named 'brackets' or 'squarebrackets' (or something) and then\nreference that variable in each of the 'tr' commands?\n\n    brackets='\\133\\135'\n    ...\n    ehost=$(echo $3 | tr -d $brackets)\n\n>                 diagport=\"Diag: port=$4\"\n>                 ;;\n>                 *)\n> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\n> index bfdaf75..fa6be3c 100755\n> --- a/t/t5601-clone.sh\n> +++ b/t/t5601-clone.sh\n> @@ -445,7 +445,7 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '\n>  #IPv6\n>  for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:\n>  do\n> -       ehost=$(echo $tuah | sed -e \"s/1]:/1]/ \"| tr -d \"[]\")\n> +       ehost=$(echo $tuah | sed -e \"s/1]:/1]/ \" | tr -d \"\\133\\135\")\n>         test_expect_success \"clone ssh://$tuah/home/user/repo\" \"\n>           test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo\n>         \"\n> @@ -454,7 +454,7 @@ done\n>  #IPv6 from home directory\n>  for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]\n>  do\n> -       euah=$(echo $tuah | tr -d \"[]\")\n> +       euah=$(echo $tuah | tr -d \"\\133\\135\")\n>         test_expect_success \"clone ssh://$tuah/~repo\" \"\n>           test_clone_url ssh://$tuah/~repo $euah '~repo'\n>         \"\n> @@ -463,7 +463,7 @@ done\n>  #IPv6 with port number\n>  for tuah in [::1] user@[::1] [user@::1]\n>  do\n> -       euah=$(echo $tuah | tr -d \"[]\")\n> +       euah=$(echo $tuah | tr -d \"\\133\\135\")\n>         test_expect_success \"clone ssh://$tuah:22/home/user/repo\" \"\n>           test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo\n>         \"\n> @@ -472,7 +472,7 @@ done\n>  #IPv6 from home directory with port number\n>  for tuah in [::1] user@[::1] [user@::1]\n>  do\n> -       euah=$(echo $tuah | tr -d \"[]\")\n> +       euah=$(echo $tuah | tr -d \"\\133\\135\")\n>         test_expect_success \"clone ssh://$tuah:22/~repo\" \"\n>           test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'\n>         \"\n> --\n> 1.7.10.4\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"266366","messageId":"CAPig+cQ7E5+0aZ09Bhv+j_wmBkOq9kbqUyqxTn=qVV8+j7Mbrw@mail.gmail.com","threadId":"39884","inReplyTo":"CAPig+cQYROsp4nsEj1cJ=W+BtxO5iQ0_UHUaJHScpN7iQBpi6A@mail.gmail.com","subject":"Re: [PATCH 1/2] Modify tr expression so that xpg4/tr handles it on Solaris","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-19T03:45:11Z","receivedAt":"2015-07-19T03:45:11Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Jul 18, 2015 at 11:31 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Sat, Jul 18, 2015 at 11:21 AM, Ben Walton <bdwalton@gmail.com> wrote:\n>> It seems that xpg4/tr mishandles some strings involving [ not followed\n>> by a character class:\n>> % echo '[::1]' | /usr/xpg4/bin/tr -d '[]'\n>> [::1\n>>\n>> % echo '[::1]' | /usr/xpg4/bin/tr -d '['\n>> usr/xpg4/bin/tr: Bad string.\n>>\n>> This was breaking two tests. To fix the issue, use the octal\n>> representations of [ and ] instead.\n>>\n>> Signed-off-by: Ben Walton <bdwalton@gmail.com>\n>> ---\n>> -               ehost=$(echo $3 | tr -d \"[]\")\n>> +               ehost=$(echo $3 | tr -d \"\\133\\135\")\n>\n> These octal values are somewhat opaque. To make this more\n> self-documenting, would it make sense instead to define a global\n> variable named 'brackets' or 'squarebrackets' (or something) and then\n> reference that variable in each of the 'tr' commands?\n>\n>     brackets='\\133\\135'\n>     ...\n>     ehost=$(echo $3 | tr -d $brackets)\n\nQuoted, of course:\n\n    ehost=$(echo $3 | tr -d \"$brackets\")\n"}]}