Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file

From: Mathias Lafeldt <hidden>
Date: 2016-06-15 22:49:51
Subsystem: the rest · Maintainer: Linus Torvalds

- check for version file with "test -r"
- read version file using shell builtin "read" rather than "cat"

Signed-off-by: Mathias Lafeldt <redacted>
---
 GIT-VERSION-GEN |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 73d5cf9..427d5d6 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -8,9 +8,9 @@ LF='
 
 # First see if there is a version file (included in release tarballs),
 # then try git-describe, then default.
-if test -f version
+if test -r version
 then
-	VN=$(cat version) || VN="$DEF_VER"
+	read VN 2>/dev/null < version || VN="$DEF_VER"
 elif test -d .git -o -f .git &&
 	VN=$(git describe --match "v[0-9]*" --abbrev=4 --dirty 2>/dev/null) &&
 	case "$VN" in
-- 
1.7.3.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help