[PATCH 1/2] test: known broken tests for escape characters in config files.

Subject: [PATCH 1/2] test: known broken tests for escape characters in config files.

Date: Thu, 30 Sep 2021 15:28:34 -0300

To: David Bremner, notmuch@notmuchmail.org, Ciprian Dorin Craciun

Cc:

From: David Bremner


glib generates the following escape characters with their usual
meanings: \n, \t, \r, and \\, along with \s for _leading_
spaces. Currently notmuch fails to unescape these on reading the
config files. These tests demonstrate this bug; the one new test that
passes is because apparently glib only escapes tabs at the beginning
of a key.
---
 test/T030-config.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/test/T030-config.sh b/test/T030-config.sh
index 3a585d1b..09dacda3 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -67,6 +67,37 @@ user.primary_email=test_suite@notmuchmail.org
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Round trip config item with leading spaces"
+test_subtest_known_broken
+notmuch config set foo.bar "  thing"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "  thing"
+
+test_begin_subtest "Round trip config item with leading tab"
+test_subtest_known_broken
+notmuch config set foo.bar "	thing"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "	thing"
+
+test_begin_subtest "Round trip config item with embedded tab"
+notmuch config set foo.bar "thing	other"
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing	other"
+
+test_begin_subtest "Round trip config item with embedded backslash"
+test_subtest_known_broken
+notmuch config set foo.bar 'thing\other'
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing\other"
+
+test_begin_subtest "Round trip config item with embedded NL/CR"
+test_subtest_known_broken
+notmuch config set foo.bar 'thing
+
other'
+output=$(notmuch config get foo.bar)
+test_expect_equal "${output}" "thing
+
other"
+
 test_begin_subtest "Top level --config=FILE option"
 cp "${NOTMUCH_CONFIG}" alt-config
 notmuch --config=alt-config config set user.name "Another Name"
-- 
2.33.0
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: