diff mbox

two trivial patches for the upcoming stable release

Message ID ord2z06rhh.fsf@livre.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Alexandre Oliva Nov. 26, 2012, 8:26 p.m. UTC
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.

Comments

Sage Weil Nov. 26, 2012, 9:09 p.m. UTC | #1
Applied, thanks!

On Mon, 26 Nov 2012, Alexandre Oliva wrote:

> 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.
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

logrotate on systems without invoke-rc.d

From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>

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@lsd.ic.unicamp.br>
---

 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