{"thread":{"id":"34869","subject":"[PATCH/RFC] t9500-*.sh: Fix highlight test hang on Linux Mint","startedAt":"2013-09-06T22:05:25Z","lastAt":"2013-09-07T16:23:21Z","messageCount":2,"participants":["Ramsay Jones","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"226996","messageId":"522A51A5.9090905@ramsay1.demon.co.uk","threadId":"34869","inReplyTo":null,"subject":"[PATCH/RFC] t9500-*.sh: Fix highlight test hang on Linux Mint","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-09-06T22:05:25Z","receivedAt":"2013-09-06T22:05:25Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nLinux Mint has an implementation of the highlight command (unrelated\nto the one from http://www.andre-simon.de) that works as a simple\nfilter. The script uses 'sed' to add terminal colour escape codes\naround text matching a regular expression. When t9500-*.sh attempts\nto run \"highlight --version\", the script simply hangs waiting for\ninput. (See https://bugs.launchpad.net/linuxmint/+bug/815005).\n\nThe tool required by gitweb can be installed from the 'highlight'\npackage. Unfortunately, given the default $PATH, this leads to the\ntool having lower precedence than the script.\n\nIn order to allow the user to specify the correct tool, introduce\nthe GIT_TEST_HIGHLIGHT_BIN variable. Also, add '</dev/null' to the\ncommand line of the highlight invocation; this avoids hanging the\ntest if the filter script is used nonetheless.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Junio,\n\nI recently upgraded my Ubuntu installation to Linux Mint 15 Cinnamon.\n(Unity makes me want to throw my laptop at the wall!)\n\nHaving tickled this bug, I solved the problem by building highlight\nv3.15 from source and installing in $HOME.\n\nThis patch is marked RFC because this bug does not seem to have\naffected too many people (given that Heiko reported the problem\nback in 2011) ... :-D\n\n[Also, note that I didn't fix up the form of the conditional.]\n\nATB,\nRamsay Jones\n\n\n t/t9500-gitweb-standalone-no-errors.sh | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh\nindex 6fca193..0208c8e 100755\n--- a/t/t9500-gitweb-standalone-no-errors.sh\n+++ b/t/t9500-gitweb-standalone-no-errors.sh\n@@ -683,14 +683,18 @@ test_expect_success \\\n # syntax highlighting\n \n \n-highlight --version >/dev/null 2>&1\n+GIT_TEST_HIGHLIGHT_BIN=${GIT_TEST_HIGHLIGHT_BIN:-highlight}\n+highlight_version=$($GIT_TEST_HIGHLIGHT_BIN --version </dev/null 2>/dev/null)\n if [ $? -eq 127 ]; then\n-\tsay \"Skipping syntax highlighting test, because 'highlight' was not found\"\n+\tsay \"Skipping syntax highlighting tests: 'highlight' not found\"\n+elif test -z \"$highlight_version\"; then\n+\tsay \"Skipping syntax highlighting tests: incorrect 'highlight' found\"\n+\tsay \"set GIT_TEST_HIGHLIGHT_BIN to full path of highlight program\"\n else\n \ttest_set_prereq HIGHLIGHT\n-\tcat >>gitweb_config.perl <<-\\EOF\n-\tour $highlight_bin = \"highlight\";\n-\t$feature{'highlight'}{'override'} = 1;\n+\tcat >>gitweb_config.perl <<-EOF\n+\tour \\$highlight_bin = \"$GIT_TEST_HIGHLIGHT_BIN\";\n+\t\\$feature{'highlight'}{'override'} = 1;\n \tEOF\n fi\n \n-- \n1.8.4\n"},{"id":"227025","messageId":"xmqqmwnovbwm.fsf@gitster.dls.corp.google.com","threadId":"34869","inReplyTo":"522A51A5.9090905@ramsay1.demon.co.uk","subject":"Re: [PATCH/RFC] t9500-*.sh: Fix highlight test hang on Linux Mint","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-07T16:23:21Z","receivedAt":"2013-09-07T16:23:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> In order to allow the user to specify the correct tool, introduce\n> the GIT_TEST_HIGHLIGHT_BIN variable. Also, add '</dev/null' to the\n> command line of the highlight invocation; this avoids hanging the\n> test if the filter script is used nonetheless.\n\ngitweb/Makefile seems to have a rule to set this to a custom\nlocation, though.  Why do we need a special test-only location?  If\nthe user wants the right one during the test, wouldn't the final\nbuild and install also want to use the same \"right one\" that is not\njust a generic 'highlight' that does not say which path it resides\nat?\n\nSo I think forcing the testers to say the same thing twice like this\npatch does is a good way forward.  Add a mechanism to allow outside\nworld to ask which \"highlight\" gitweb/Makefile was told to use, use\nthat mechanism to learn the value of HIGHLIGHT_BIN to check if the\nbinary is usable for the test, or something perhaps?\n\nThe killing of the input is independently a good idea, I think.\n"}]}