Blame SOURCES/mcelog-patch-0755b55af.patch

09c1d0
From: Prarit Bhargava <prarit@redhat.com>
09c1d0
09c1d0
Subject: Makefile: Make `git` check portable (POSIX compatible)
09c1d0
09c1d0
commit 0755b55afbf76fcacc31e98bb8c163c8e055ccb2
09c1d0
Author: Paul Menzel <pmenzel@molgen.mpg.de>
09c1d0
Date:   Mon Jan 30 15:56:41 2017 +0100
09c1d0
09c1d0
    Makefile: Make `git` check portable (POSIX compatible)
09c1d0
    
09c1d0
    On systems using not the *GNU Bourne-Again SHell* (bash) as shell, the
09c1d0
    git check might fail. This happens on Debian systems where the *Debian
09c1d0
    Almquist Shell* (dash) is used by default for `/bin/sh`.
09c1d0
    
09c1d0
    As a result, after running `make` the file `version.c` always contains
09c1d0
    `unknown` instead of the correct version.
09c1d0
    
09c1d0
    The problem is, that `type -p git` is not portable. Use `command -v`
09c1d0
    instead [1][2].
09c1d0
    
09c1d0
    > Where bash is your shell/hashbang, consistently use hash (for
09c1d0
    > commands) or type (to consider built-ins & keywords).
09c1d0
    >
09c1d0
    > When writing a POSIX script, use command -v.
09c1d0
    
09c1d0
    Fixes: #42
09c1d0
    
09c1d0
    [1] https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
09c1d0
        "Check if a program exists from a Bash script"
09c1d0
    [2] https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
09c1d0
        "Why not use “which”? What to use then?"
09c1d0
09c1d0
diff --git a/Makefile b/Makefile
09c1d0
index 9dbbdbf8eb97e21a6d2efee7f308c1e7e742845b..e4341fceb882597ceebb56883625338c89923ee0 100644
09c1d0
--- a/Makefile
09c1d0
+++ b/Makefile
09c1d0
@@ -82,7 +82,7 @@ depend: .depend
09c1d0
 
09c1d0
 version.tmp: FORCE
09c1d0
 	( echo -n "char version[] = \"" ; 	\
09c1d0
-	if type -p git >/dev/null; then 	\
09c1d0
+	if command -v git >/dev/null; then 	\
09c1d0
 	if [ -d .git ] ; then 			\
09c1d0
 		git describe --tags HEAD | tr -d '\n'; 	\
09c1d0
 	else 					\