* [PATCH 1/5] removed use of 'echo -n' (and echo -n -e ...)
@ 2022-02-20 20:52 Tomi Ollila
0 siblings, 0 replies; only message in thread
From: Tomi Ollila @ 2022-02-20 20:52 UTC (permalink / raw)
To: notmuch
In most cases used printf %s ... instead.
echo -n > file lines to create empty / truncate files were
changed to : > file lines, like done in in test-lib-emacs.sh
And one echo -n " " just merged to echo in previous line.
---
Most of the changes went to release-checks.sh -- the one
I've mostly written ;/
For anyone interested, dash printf "\xEF\x0D\x0A" would not work
as expected (it can only output octal escapes). Initially I had
that as printf %s $'\xEF\x0D\x0A' but it is as less portable
(and it was hard to explain in commit message).
Makefile.local | 5 ++---
devel/release-checks.sh | 20 ++++++++++----------
test/T090-search-output.sh | 2 +-
test/T190-multipart.sh | 2 +-
test/T380-atomicity.sh | 4 ++--
5 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/Makefile.local b/Makefile.local
index 10fb9908..abda9ff3 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -119,8 +119,7 @@ release-message:
@echo ""
@echo "Which can be verified with:"
@echo ""
- @echo " $(RELEASE_URL)/$(SHA256_FILE)"
- @echo -n " "
+ @echo " $(RELEASE_URL)/$(SHA256_FILE) "
@cat releases/$(SHA256_FILE)
@echo ""
@echo " $(RELEASE_URL)/$(DETACHED_SIG_FILE)"
@@ -169,7 +168,7 @@ release-checks:
.PHONY: verify-newer
verify-newer:
- @echo -n "Checking that no $(VERSION) release already exists..."
+ @printf %s "Checking that no $(VERSION) release already exists..."
@wget -q --no-check-certificate -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
case $$? in \
8) echo "Good." ;; \
diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 23c29eaa..c0accf78 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -59,7 +59,7 @@ readonly VERSION
# In the rest of this file, tests collect list of errors to be fixed
-echo -n "Checking that git working directory is clean... "
+printf %s "Checking that git working directory is clean... "
git_status=`git status --porcelain`
if [ "$git_status" = '' ]
then
@@ -77,7 +77,7 @@ verfail ()
append_emsg " Please follow the instructions in RELEASING to choose a version"
}
-echo -n "Checking that '$VERSION' is good with digits and periods... "
+printf %s "Checking that '$VERSION' is good with digits and periods... "
case $VERSION in
*[!0-9.]*)
verfail "'$VERSION' contains other characters than digits and periods" ;;
@@ -88,7 +88,7 @@ case $VERSION in
*) verfail "'$VERSION' is a single number" ;;
esac
-echo -n "Checking that this is Debian package for notmuch... "
+printf %s "Checking that this is Debian package for notmuch... "
read deb_notmuch deb_version rest < debian/changelog
if [ "$deb_notmuch" = 'notmuch' ]
then
@@ -98,7 +98,7 @@ else
append_emsg "Package name '$deb_notmuch' is not 'notmuch' in debian/changelog"
fi
-echo -n "Checking that Debian package version is $VERSION-1... "
+printf %s "Checking that Debian package version is $VERSION-1... "
if [ "$deb_version" = "($VERSION-1)" ]
then
@@ -108,7 +108,7 @@ else
append_emsg "Version '$deb_version' is not '($VERSION-1)' in debian/changelog"
fi
-echo -n "Checking that python bindings version is $VERSION... "
+printf %s "Checking that python bindings version is $VERSION... "
py_version=`python3 -c "with open('$PV_FILE') as vf: exec(vf.read()); print(__VERSION__)"`
if [ "$py_version" = "$VERSION" ]
then
@@ -118,7 +118,7 @@ else
append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
fi
-echo -n "Checking that NEWS header is tidy... "
+printf %s "Checking that NEWS header is tidy... "
if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
then
echo Yes.
@@ -132,7 +132,7 @@ else
fi
fi
-echo -n "Checking that this is Notmuch NEWS... "
+printf %s "Checking that this is Notmuch NEWS... "
read news_notmuch news_version news_date < NEWS
if [ "$news_notmuch" = "Notmuch" ]
then
@@ -142,7 +142,7 @@ else
append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
fi
-echo -n "Checking that NEWS version is $VERSION... "
+printf %s "Checking that NEWS version is $VERSION... "
if [ "$news_version" = "$VERSION" ]
then
echo Yes.
@@ -154,7 +154,7 @@ fi
#eval `date '+year=%Y mon=%m day=%d'`
today0utc=`date --date=0Z +%s` # gnu date feature
-echo -n "Checking that NEWS date is right... "
+printf %s "Checking that NEWS date is right... "
case $news_date in
'('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
@@ -176,7 +176,7 @@ case $news_date in
esac
year=`exec date +%Y`
-echo -n "Checking that copyright in documentation contains 2009-$year... "
+printf %s "Checking that copyright in documentation contains 2009-$year... "
# Read the value of variable `copyright' defined in 'doc/conf.py'.
copyrightline=$(grep ^copyright doc/conf.py)
case $copyrightline in
diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
index bf28d220..0d85c609 100755
--- a/test/T090-search-output.sh
+++ b/test/T090-search-output.sh
@@ -435,7 +435,7 @@ test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "search for non-existent message prints nothing"
notmuch search "no-message-matches-this" > OUTPUT
-echo -n >EXPECTED
+: >EXPECTED
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "search --format=json for non-existent message prints proper empty json"
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 3545a599..d3b7f87c 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -683,7 +683,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)"
test_begin_subtest "'notmuch show --part' does not corrupt a part with CRLF pair"
notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out
-echo -n -e "\xEF\x0D\x0A" > crlf.expected
+printf "\xEF\x0D\x0A" > crlf.expected
test_expect_equal_file crlf.out crlf.expected
diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
index afe49d93..0f9e6d2e 100755
--- a/test/T380-atomicity.sh
+++ b/test/T380-atomicity.sh
@@ -71,8 +71,8 @@ if test_require_external_prereq gdb; then
# Check output against golden output
outcount=$(cat outcount)
- echo -n > searchall
- echo -n > expectall
+ : > searchall
+ : > expectall
for ((i = 0; i < $outcount; i++)); do
if ! cmp -s search.$i expected; then
# Find the range of interruptions that match this output
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-20 20:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20 20:52 [PATCH 1/5] removed use of 'echo -n' (and echo -n -e ...) Tomi Ollila
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.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).