{"thread":{"id":"15207","subject":"[PATCH] Suppress some bash redirection error messages","startedAt":"2008-08-26T17:52:57Z","lastAt":"2008-08-26T17:52:57Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88620","messageId":"48B442F9.1090801@ramsay1.demon.co.uk","threadId":"15207","inReplyTo":null,"subject":"[PATCH] Suppress some bash redirection error messages","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2008-08-26T17:52:57Z","receivedAt":"2008-08-26T17:52:57Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, when testing if the filesystem allows tabs in\nfilenames, bash issues an error something like:\n\n./t4016-diff-quote.sh: pathname\twith HT: No such file or directory\n\nwhich is caused by the failure of the (stdout) redirection,\nsince the file cannot be created. In order to suppress the\nerror message, you must redirect stderr to /dev/null, *before*\nthe stdout redirection on the command-line.\n\nAlso, remove a redundant filesystem check from the begining of\nthe t3902-quoted.sh test and standardise the \"test skipped\"\nmessage to 'say' on exit.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n t/t3300-funny-names.sh |    2 +-\n t/t3902-quoted.sh      |    8 +-------\n t/t4016-diff-quote.sh  |    4 ++--\n 3 files changed, 4 insertions(+), 10 deletions(-)\n\ndiff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh\nindex 0574ef1..db46d53 100755\n--- a/t/t3300-funny-names.sh\n+++ b/t/t3300-funny-names.sh\n@@ -21,7 +21,7 @@ cat >\"$p0\" <<\\EOF\n 3. A quick brown fox jumps over the lazy cat, oops dog.\n EOF\n \n-cat >\"$p1\" \"$p0\"\n+cat 2>/dev/null >\"$p1\" \"$p0\"\n echo 'Foo Bar Baz' >\"$p2\"\n \n test -f \"$p1\" && cmp \"$p0\" \"$p1\" || {\ndiff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh\nindex fe4fb51..5868052 100755\n--- a/t/t3902-quoted.sh\n+++ b/t/t3902-quoted.sh\n@@ -7,12 +7,6 @@ test_description='quoted output'\n \n . ./test-lib.sh\n \n-P1='pathname\twith HT'\n-: >\"$P1\" 2>&1 && test -f \"$P1\" && rm -f \"$P1\" || {\n-\techo >&2 'Filesystem does not support HT in names'\n-\ttest_done\n-}\n-\n FN='濱野'\n GN='純'\n HT='\t'\n@@ -20,7 +14,7 @@ LF='\n '\n DQ='\"'\n \n-echo foo > \"Name and an${HT}HT\"\n+echo foo 2>/dev/null > \"Name and an${HT}HT\"\n test -f \"Name and an${HT}HT\" || {\n \t# since FAT/NTFS does not allow tabs in filenames, skip this test\n \tsay 'Your filesystem does not allow tabs in filenames, test skipped.'\ndiff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh\nindex f07035a..55eb5f8 100755\n--- a/t/t4016-diff-quote.sh\n+++ b/t/t4016-diff-quote.sh\n@@ -13,8 +13,8 @@ P1='pathname\twith HT'\n P2='pathname with SP'\n P3='pathname\n with LF'\n-: >\"$P1\" 2>&1 && test -f \"$P1\" && rm -f \"$P1\" || {\n-\techo >&2 'Filesystem does not support tabs in names'\n+: 2>/dev/null >\"$P1\" && test -f \"$P1\" && rm -f \"$P1\" || {\n+\tsay 'Your filesystem does not allow tabs in filenames, test skipped.'\n \ttest_done\n }\n \n-- \n1.6.0\n"}]}