[Logcheck-commits] Frédéric Brière : Replaced bashisms with POSIX equivalents

Frédéric Brière fbriere-guest at alioth.debian.org
Mon Aug 17 22:24:44 UTC 2009


Module: logcheck
Branch: master
Commit: 77fc8bb7e69a0f1cb5257cfed1f012b28ce36401
URL:    http://git.debian.org/?p=logcheck/logcheck.git;a=commit;h=77fc8bb7e69a0f1cb5257cfed1f012b28ce36401

Author: Frédéric Brière <fbriere at fbriere.net>
Date:   Mon Aug 17 18:15:09 2009 -0400

Replaced bashisms with POSIX equivalents

Since logcheck doesn't require any bash-specific feature, there's no
harm in making it as POSIX-y as possible.  This was actually requested
on the BTS, so why not?

However, I'm not changing the shebang to /bin/sh, since it is far from
certain that the script is now POSIX compliant.  (Besides, what would be
the point?  Any speed gain will be dwarfed by egrep anyway.)

---

 debian/changelog |    1 +
 src/logcheck     |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index aceacbe..838b34c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ logcheck (1.3.4) experimental; urgency=low
   * Updated cron-apt "Fetched" rule to match new time formats
     (closes: #531596)
   * Updated cron-apt "Fetched" rule to match all possible sizes and lengths
+  * Replaced bashisms with POSIX equivalents (closes: #508546)
 
  -- Frédéric Brière <fbriere at fbriere.net>  Mon, 17 Aug 2009 11:48:08 -0400
 
diff --git a/src/logcheck b/src/logcheck
index 94b9b55..cebcd51 100755
--- a/src/logcheck
+++ b/src/logcheck
@@ -22,7 +22,7 @@
 # along with Logcheck; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-if [ $UID == 0 ]; then
+if [ `id -u` = 0 ]; then
     echo "logcheck should not be run as root. Use su to invoke logcheck:"
     echo "su -s /bin/bash -c \"/usr/sbin/logcheck${@:+ $@}\" logcheck"
     echo "Or use sudo: sudo -u logcheck logcheck${@:+ $@}."
@@ -303,7 +303,7 @@ sendreport() {
         if [ $MAILASATTACH -eq 1 ]; then
           debug "Sending report as attachment"
           if command -v nail >/dev/null; then
-            echo -e "Report attached" | nail -s "$subject" -a "$TMPDIR/report" "$SENDMAILTO"
+            echo "Report attached" | nail -s "$subject" -a "$TMPDIR/report" "$SENDMAILTO"
             return $?
           else
             echo >> $TMPDIR/report




More information about the Logcheck-commits mailing list