{"thread":{"id":"35075","subject":"[PATCH 4/6] t9500-*.sh: Fix highlight test hang on Linux Mint","startedAt":"2013-10-06T20:50:46Z","lastAt":"2013-10-06T20:50:46Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"228589","messageId":"5251CD26.8060803@ramsay1.demon.co.uk","threadId":"35075","inReplyTo":null,"subject":"[PATCH 4/6] t9500-*.sh: Fix highlight test hang on Linux Mint","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-10-06T20:50:46Z","receivedAt":"2013-10-06T20:50:46Z","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 avoid hanging the test, add '</dev/null' to the command\nline of the highlight invocation. Also, since the 'highlight' tool\nrequred by gitweb produces '--version' output (and the script does\nnot), saving the command output allows a simple check for the wrong\n'highlight'.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n t/t9500-gitweb-standalone-no-errors.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh\nindex 6fca193..718014d 100755\n--- a/t/t9500-gitweb-standalone-no-errors.sh\n+++ b/t/t9500-gitweb-standalone-no-errors.sh\n@@ -683,9 +683,11 @@ test_expect_success \\\n # syntax highlighting\n \n \n-highlight --version >/dev/null 2>&1\n+highlight_version=$(highlight --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 else\n \ttest_set_prereq HIGHLIGHT\n \tcat >>gitweb_config.perl <<-\\EOF\n-- \n1.8.4\n"}]}