* Adapt some tests to work around broken Solaris tools
@ 2015-07-19 18:00 Ben Walton
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ben Walton @ 2015-07-19 18:00 UTC (permalink / raw)
To: gitster; +Cc: git, sunshine, j6t, johannes.schindelin
This series is a respin of the previous submission, taking feedback
into account.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris
2015-07-19 18:00 Adapt some tests to work around broken Solaris tools Ben Walton
@ 2015-07-19 18:00 ` Ben Walton
2015-07-19 21:49 ` Eric Sunshine
2015-07-19 18:00 ` [PATCH 2/3] Fix sed usage in tests to work around broken xpg4/sed " Ben Walton
2015-07-19 18:00 ` [PATCH 3/3] " Ben Walton
2 siblings, 1 reply; 6+ messages in thread
From: Ben Walton @ 2015-07-19 18:00 UTC (permalink / raw)
To: gitster; +Cc: git, sunshine, j6t, johannes.schindelin, Ben Walton
It seems that xpg4/tr mishandles some strings involving [ not followed
by a character class:
% echo '[::1]' | /usr/xpg4/bin/tr -d '[]'
[::1
% echo '[::1]' | /usr/xpg4/bin/tr -d '['
usr/xpg4/bin/tr: Bad string.
This was breaking two tests. To fix the issue, use the octal
representations of [ and ] instead. Reference the octal expression as
a newly exported variable so that it's shared across tests and more
easily understood when reading it.
Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
t/t5500-fetch-pack.sh | 2 +-
t/t5601-clone.sh | 8 ++++----
t/test-lib.sh | 5 ++++-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 3a9b775..2db9bde 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -547,7 +547,7 @@ check_prot_host_port_path () {
*ssh*)
pp=ssh
uah=userandhost
- ehost=$(echo $3 | tr -d "[]")
+ ehost=$(echo $3 | tr -d "$squarebrackets")
diagport="Diag: port=$4"
;;
*)
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index bfdaf75..8299d14 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -445,7 +445,7 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
#IPv6
for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:
do
- ehost=$(echo $tuah | sed -e "s/1]:/1]/ "| tr -d "[]")
+ ehost=$(echo $tuah | sed -e "s/1]:/1]/ " | tr -d "$squarebrackets")
test_expect_success "clone ssh://$tuah/home/user/repo" "
test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
"
@@ -454,7 +454,7 @@ done
#IPv6 from home directory
for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
do
- euah=$(echo $tuah | tr -d "[]")
+ euah=$(echo $tuah | tr -d "$squarebrackets")
test_expect_success "clone ssh://$tuah/~repo" "
test_clone_url ssh://$tuah/~repo $euah '~repo'
"
@@ -463,7 +463,7 @@ done
#IPv6 with port number
for tuah in [::1] user@[::1] [user@::1]
do
- euah=$(echo $tuah | tr -d "[]")
+ euah=$(echo $tuah | tr -d "$squarebrackets")
test_expect_success "clone ssh://$tuah:22/home/user/repo" "
test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo
"
@@ -472,7 +472,7 @@ done
#IPv6 from home directory with port number
for tuah in [::1] user@[::1] [user@::1]
do
- euah=$(echo $tuah | tr -d "[]")
+ euah=$(echo $tuah | tr -d "$squarebrackets")
test_expect_success "clone ssh://$tuah:22/~repo" "
test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
"
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 39da9c2..6b5b6cd 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -173,7 +173,10 @@ LF='
# when case-folding filenames
u200c=$(printf '\342\200\214')
-export _x05 _x40 _z40 LF u200c
+# [ and ], for use by tr commands.
+squarebrackets="\133\135"
+
+export _x05 _x40 _z40 LF u200c squarebrackets
# Each test should start with something like this, after copyright notices:
#
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] Fix sed usage in tests to work around broken xpg4/sed on Solaris
2015-07-19 18:00 Adapt some tests to work around broken Solaris tools Ben Walton
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
@ 2015-07-19 18:00 ` Ben Walton
2015-07-19 18:00 ` [PATCH 3/3] " Ben Walton
2 siblings, 0 replies; 6+ messages in thread
From: Ben Walton @ 2015-07-19 18:00 UTC (permalink / raw)
To: gitster; +Cc: git, sunshine, j6t, johannes.schindelin, Ben Walton
The space following the last / in a sed command caused Solaris'
xpg4/sed to fail, claiming the program was garbled and exit with
status 2:
% echo 'foo' | /usr/xpg4/bin/sed -e 's/foo/bar/ '
sed: command garbled: s/foo/bar/
% echo $?
2
Fix this by simply removing the unnecessary space.
Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
t/t5601-clone.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 8299d14..8b7f8e1 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -445,7 +445,7 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
#IPv6
for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:
do
- ehost=$(echo $tuah | sed -e "s/1]:/1]/ " | tr -d "$squarebrackets")
+ ehost=$(echo $tuah | sed -e "s/1]:/1]/" | tr -d "$squarebrackets")
test_expect_success "clone ssh://$tuah/home/user/repo" "
test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
"
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] Fix sed usage in tests to work around broken xpg4/sed on Solaris
2015-07-19 18:00 Adapt some tests to work around broken Solaris tools Ben Walton
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
2015-07-19 18:00 ` [PATCH 2/3] Fix sed usage in tests to work around broken xpg4/sed " Ben Walton
@ 2015-07-19 18:00 ` Ben Walton
2015-07-19 20:22 ` Johannes Sixt
2 siblings, 1 reply; 6+ messages in thread
From: Ben Walton @ 2015-07-19 18:00 UTC (permalink / raw)
To: gitster; +Cc: git, sunshine, j6t, johannes.schindelin, Ben Walton
In 99094a7a, a trivial && breakage was fixed. This exposed a problem
with the test when run on Solaris with xpg4/sed that had gone silently
undetected since its introduction in e4bd10b2. Solaris' sed executes
the requested substitution but prints a warning about the missing
newline at the end of the file and exits with status 2.
% echo "CHANGE_ME" | \
tr -d "\\012" | /usr/xpg4/bin/sed -e 's/CHANGE_ME/change_me/'
sed: Missing newline at end of file standard input.
change_me
% echo $?
2
To work around this, use perl to perform the substitution instead.
Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
t/t9500-gitweb-standalone-no-errors.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index e94b2f1..a7383fa 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -290,7 +290,7 @@ test_expect_success 'setup incomplete lines' '
echo "incomplete" | tr -d "\\012" >>file &&
git commit -a -m "Add incomplete line" &&
git tag incomplete_lines_add &&
- sed -e s/CHANGE_ME/change_me/ <file >file+ &&
+ perl -pne "s/CHANGE_ME/change_me/" file >file+ &&
mv -f file+ file &&
git commit -a -m "Incomplete context line" &&
git tag incomplete_lines_ctx &&
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] Fix sed usage in tests to work around broken xpg4/sed on Solaris
2015-07-19 18:00 ` [PATCH 3/3] " Ben Walton
@ 2015-07-19 20:22 ` Johannes Sixt
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Sixt @ 2015-07-19 20:22 UTC (permalink / raw)
To: Ben Walton; +Cc: gitster, git, sunshine, johannes.schindelin
Am 19.07.2015 um 20:00 schrieb Ben Walton:
> - sed -e s/CHANGE_ME/change_me/ <file >file+ &&
> + perl -pne "s/CHANGE_ME/change_me/" file >file+ &&
Did you mean '-lpe' or better '-pe' here?
-- Hannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
@ 2015-07-19 21:49 ` Eric Sunshine
0 siblings, 0 replies; 6+ messages in thread
From: Eric Sunshine @ 2015-07-19 21:49 UTC (permalink / raw)
To: Ben Walton; +Cc: Junio C Hamano, Git List, Johannes Sixt, Johannes Schindelin
On Sun, Jul 19, 2015 at 2:00 PM, Ben Walton <bdwalton@gmail.com> wrote:
> It seems that xpg4/tr mishandles some strings involving [ not followed
> by a character class:
> % echo '[::1]' | /usr/xpg4/bin/tr -d '[]'
> [::1
>
> % echo '[::1]' | /usr/xpg4/bin/tr -d '['
> usr/xpg4/bin/tr: Bad string.
>
> This was breaking two tests. To fix the issue, use the octal
> representations of [ and ] instead. Reference the octal expression as
> a newly exported variable so that it's shared across tests and more
> easily understood when reading it.
>
> Signed-off-by: Ben Walton <bdwalton@gmail.com>
> ---
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 39da9c2..6b5b6cd 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -173,7 +173,10 @@ LF='
> # when case-folding filenames
> u200c=$(printf '\342\200\214')
>
> -export _x05 _x40 _z40 LF u200c
> +# [ and ], for use by tr commands.
> +squarebrackets="\133\135"
While it's true that the reader may be able to consult the commit
message to learn more about "squarebrackets" and "tr", this might be
one of those cases where either a more explanatory in-code comment is
warranted or the comment should be dropped altogether, since the the
current comment is not illuminating. I'd vote for expanding the
comment a bit to mention "some versions of Solaris 'tr'" and a short
description of the misbehavior.
Also, Hannes wondered how Solaris 'tr' would react to '[][]'. Were you
able to test that or the alternative '[[]]'?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-19 21:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-19 18:00 Adapt some tests to work around broken Solaris tools Ben Walton
2015-07-19 18:00 ` [PATCH 1/3] Modify tr expressions so that xpg4/tr handles it on Solaris Ben Walton
2015-07-19 21:49 ` Eric Sunshine
2015-07-19 18:00 ` [PATCH 2/3] Fix sed usage in tests to work around broken xpg4/sed " Ben Walton
2015-07-19 18:00 ` [PATCH 3/3] " Ben Walton
2015-07-19 20:22 ` Johannes Sixt
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).