control: tags 717326 patch

Hi,

The postinst script of tomoyo-tools has funny grep line.

    `grep "^GRUB_CMDLINE_LINUX=\"*security*\"" $GRUBCONF`

This is regular expression, so "*" should be ".*" to match any
characters.   

This is the root cause of http://bugs.debian.org/717326

I also proofed other package scripts and found that the postrm script
also needs to be fixed.  If some one add other options to
GRUB_CMDLINE_LINUX, this script does not work as expected.  The fix is
as easy as to copy the better script snippet from the postinst.

Patch file attached.

Osamu

diff -Nru tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postinst tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postinst
--- tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postinst	2013-03-03 12:56:13.000000000 +0900
+++ tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postinst	2013-10-31 23:59:08.281700381 +0900
@@ -30,7 +30,7 @@
 
         if [ -f $GRUBCONF ] && [ -x /usr/sbin/update-grub ]; then
             if [ $RET = true ]; then
-		if [ `grep "^GRUB_CMDLINE_LINUX=" $GRUBCONF` -a ! `grep "^GRUB_CMDLINE_LINUX=\"*security*\"" $GRUBCONF` ]; then
+		if [ `grep "^GRUB_CMDLINE_LINUX=" $GRUBCONF` -a ! `grep "^GRUB_CMDLINE_LINUX=\".*security=tomoyo.*\"" $GRUBCONF` ]; then
                     sed -e /^GRUB_CMDLINE_LINUX=\"/s/\"$/\ $FLAG\"/ -i $GRUBCONF && update-grub
 		fi
             elif [ $RET = false ]; then
diff -Nru tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postrm tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postrm
--- tomoyo-tools-2.5.0-20130406.orig/debian/tomoyo-tools.postrm	2012-06-15 09:25:39.000000000 +0900
+++ tomoyo-tools-2.5.0-20130406/debian/tomoyo-tools.postrm	2013-11-01 00:09:15.507647403 +0900
@@ -4,6 +4,8 @@
 
 CONFDIR="/etc/tomoyo"
 CONFFILES="domain_policy.conf exception_policy.conf manager.conf profile.conf meminfo.conf stat.conf"
+GRUBCONF="/etc/default/grub"
+FLAG="security=tomoyo"
 
 case "$1" in
     upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
@@ -11,8 +13,7 @@
 
     remove)
     if [ -f /etc/default/grub ] && [ -x /usr/sbin/update-grub ]; then
-      sed -e s/GRUB_CMDLINE_LINUX=\"security=tomoyo\"/GRUB_CMDLINE_LINUX=\"\"/ \
-	  -i /etc/default/grub && update-grub
+      sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG// -i $GRUBCONF && update-grub
     fi
     ;;
 
@@ -28,8 +29,7 @@
     fi
 
     if [ -f /etc/default/grub ] && [ -x /usr/sbin/update-grub ]; then
-      sed -e s/GRUB_CMDLINE_LINUX=\"security=tomoyo\"/GRUB_CMDLINE_LINUX=\"\"/ \
-	  -i /etc/default/grub && update-grub
+      sed -e /^GRUB_CMDLINE_LINUX/s/$FLAG// -i $GRUBCONF && update-grub
     fi
     ;;
 

Reply via email to