two trivial patches for the upcoming stable release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The first one was posted before, to enable out-of-tree builds; it was
acked but apparently it fell through the cracks.

The second fixes a regression in log rotation on systems that don't use
invoke-rc.d.  The which command doesn't output anything to stdout when
it fails to find the requested command, and for some reason [ -x ]
passes, so we end up trying to run the non-existing invoke-rc.d instead
of falling back to other alternatives as intended.

Search for srcdir/.git in check_version

From: Alexandre Oliva <oliva@xxxxxxxxxxxxxxxxx>

Support srcdir != . looking for .git in srcdir when computing the ceph
release and git tag.

Signed-off-by: Alexandre Oliva <oliva@xxxxxxxxxxxxxxxxx>
---

 src/check_version |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


diff --git a/src/check_version b/src/check_version
index e31ca49..8600c55 100755
--- a/src/check_version
+++ b/src/check_version
@@ -1,12 +1,13 @@
 #!/bin/sh
 
-if [ ! -d ../.git ]; then
-    echo "not updating .git_version (no ../.git)"
+dname=`dirname $0`
+
+if [ ! -d $dname/../.git ]; then
+    echo "not updating .git_version (no $dname/../.git)"
     exit 0
 fi
 
-dname=`dirname $0`
-cur=`git rev-parse HEAD 2>/dev/null; git describe 2>/dev/null`
+cur=`cd $dname && git rev-parse HEAD 2>/dev/null; git describe 2>/dev/null`
 [ -e $1 ] && old=`cat $1`
 
 if [ "$cur" != "$old" ]; then
logrotate on systems without invoke-rc.d

From: Alexandre Oliva <oliva@xxxxxxxxxxxxxxxxx>

The which command doesn't output anything to stdout when it can't find
the given program name, and then [ -x ] passes.  Use the exit status
of which to tell whether the command exists, before testing whether
it's executable, to fix it.

Signed-off-by: Alexandre Oliva <oliva@xxxxxxxxxxxxxxxxx>
---

 src/logrotate.conf |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/src/logrotate.conf b/src/logrotate.conf
index aef3572..97d4fcd 100644
--- a/src/logrotate.conf
+++ b/src/logrotate.conf
@@ -4,11 +4,11 @@
     compress
     sharedscripts
     postrotate
-        if [ -x `which invoke-rc.d` ]; then
+        if which invoke-rc.d && [ -x `which invoke-rc.d` ]; then
             invoke-rc.d ceph reload >/dev/null
-        elif [ -x `which service` ]; then
+        elif which service && [ -x `which service` ]; then
             service ceph reload >/dev/null
-        elif [ -x `which initctl` ]; then
+        elif which initctl && [ -x `which initctl` ]; then
             # upstart reload isn't very helpful here:
             #   https://bugs.launchpad.net/upstart/+bug/1012938
             for type in mon osd mds; do

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux