Bug#701224: Safely prevent adverse impact if im-switch was removed but not purged

2013-02-26 Thread Osamu Aoki
severity 701224 serious
thanks

recently, im-switch 1.23 has migrated to testing while fixing serious
bug Disable hook script if package is removed.  Closes: #701181

(I was going to ask release exception later but somehow unblocked.)

This bug is essentially the same bug as #701181 thus I move this to
serious.  These are both maintained by the same maintainer and this is
done as a coordinated migration.

Hi,

On Sat, Feb 23, 2013 at 10:11:19PM +0100, Gunnar Hjalmarsson wrote:
 On 2013-02-23 16:58, Osamu Aoki wrote:
  I think if I update this, I need to add new hush number for new
  im-switch to ensure automatic erase.
 
 Why not drop the md5sum check as regards 80im-switch and use the
 attached file as is instead?

We can consider im-switch and im-config almost a different version of
one package but they are not really the same package.  Then we are
hitting policy violation issue.  Unless this is the only solution, I
will consider this option.  I mean why take chances.
 
 As Iain Lane pointed out at the Ubuntu bug report, if im-config deletes
 the file, and the user at a later point of time decides to go back to
 im-switch (for some reason), 80im-switch won't be reinstalled, and the
 user is faced with an issue that may be hard to track down.

I think 80im-switch get installed but ... let's not argue this point
now.

 Now when that line has been added to 80im-switch in the normal way, you
 can say that with the file I propose, all debian/postinst would do is
 adding a line to 80im-switch that would otherwise have been added at
 next update. It does no harm in any way.

This is what I was thinking ...

 If the policy still makes you hesitate, you should bear in mind that it
 was scarcely written with this special case in mind. Somebody should be
 able to approve an exception.

No I have seen people has added disabling thing as gray area.  (Old
network-manager,...)  Besides, these are two cooperating package by the
same maintainer and these are one of the cooperation script.  Perfectly
policy compliant!!! Also whatever happens, if im-switch is installed and
even if installation did not replace this script, it works :-)

 Using the attached file would also eliminate one of the current
 differences between the Debian and Ubuntu versions of im-config.
 Hopefully we'll soon be able to use exactly the same version.

Since if the md5sum are the same as installed, it is better to remove it
completely as they used to be.

So I modified a bit but in the same spirit :-)
I echo to STDERR.

Osamu

#!/bin/sh
# postinst script for im-config
# vim: set sts=4 expandtab:

set -e

# version just before wheezy release
# acb685ae9264be3fc1800f98a70b12bb  80im-switch 1.14
# 044a2f13aa8382902dc8f47dc7da7064  80im-switch 1.16 (oldstable) - 1.22 
(unstable)
# 5b34831bb3c203ced71b7efb6da4609e  80im-switch 1.23 (testing/unstable)

# 4045a8eeb0e9226cdd9f8a121ccf4c04  80im-config_launch 0.3 (stable initial)
# 8a4829f935b5561ca6e61bec6eb3893f  80im-config_launch 0.3+squeeze1 (stable), 
0.4
# b243876a16f7b87c397ceef626098069  80im-config_launch 0.5
# 5ef27261ac38d704d8f766da19635461  80im-config_launch 0.6-0.17 (testing, 
unstable)

case $1 in
configure)
IM_SWITCH_HOOK=/etc/X11/Xsession.d/80im-switch
IM_SWITCH_DISABLE_CODE='[ -x /usr/bin/im-switch ] || return 0'
if [ -f $IM_SWITCH_HOOK ]; then
IM_SWITCH_HOOK_MD5SUM=$(md5sum  $IM_SWITCH_HOOK|cut -d ' ' -f 1)
case $IM_SWITCH_HOOK_MD5SUM in

acb685ae9264be3fc1800f98a70b12bb|044a2f13aa8382902dc8f47dc7da7064|5b34831bb3c203ced71b7efb6da4609e)
rm -f $IM_SWITCH_HOOK
;;

*)
if [ $( head -1 $IM_SWITCH_HOOK ) != 
$IM_SWITCH_DISABLE_CODE ];then
echo Migrating from im-switch to im-config. Disabling: 
$IM_SWITCH_HOOK. 2
sed -i 1 i $IM_SWITCH_DISABLE_CODE $IM_SWITCH_HOOK
fi
;;
esac
fi

IM_CONFIG_HOOK=/etc/X11/Xsession.d/80im-config_launch
if [ -f $IM_CONFIG_HOOK ]; then
IM_CONFIG_HOOK_MD5SUM=$(md5sum  $IM_CONFIG_HOOK|cut -d ' ' -f 1)
case $IM_CONFIG_HOOK_MD5SUM in

4045a8eeb0e9226cdd9f8a121ccf4c04|8a4829f935b5561ca6e61bec6eb3893f|b243876a16f7b87c397ceef626098069|5ef27261ac38d704d8f766da19635461)
rm -f $IM_CONFIG_HOOK
;;

*)
echo ERROR: Unknown hook file exists: $IM_CONFIG_HOOK. 2
;;
esac
fi
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo postinst called with unknown argument \`$1' 2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0



Bug#701224: Safely prevent adverse impact if im-switch was removed but not purged

2013-02-26 Thread Gunnar Hjalmarsson
On 2013-02-26 15:10, Osamu Aoki wrote:
 On Sat, Feb 23, 2013 at 10:11:19PM +0100, Gunnar Hjalmarsson wrote:
 As Iain Lane pointed out at the Ubuntu bug report, if im-config deletes
 the file, and the user at a later point of time decides to go back to
 im-switch (for some reason), 80im-switch won't be reinstalled, and the
 user is faced with an issue that may be hard to track down.
 
 I think 80im-switch get installed but ... let's not argue this point
 now.

No need to argue, really.

$ ll /etc/X11/Xsession.d/80im-switch
-rwxr-xr-x 1 root root 2353 nov  7 21:00 /etc/X11/Xsession.d/80im-switch*
$ sudo dpkg -r im-switch
(Reading database ... 545778 files and directories currently installed.)
Removing im-switch ...
...
$ sudo rm /etc/X11/Xsession.d/80im-switch
$ sudo apt-get install im-switch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed
  im-switch
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/16,6 kB of archives.
After this operation, 116 kB of additional disk space will be used.
Selecting previously unselected package im-switch.
(Reading database ... 545770 files and directories currently installed.)
Unpacking im-switch (from .../im-switch_1.22ubuntu2.1_all.deb) ...
...
$ ll /etc/X11/Xsession.d/80im-switch
ls: cannot access /etc/X11/Xsession.d/80im-switch: No such file or directory

 So I modified a bit but in the same spirit :-)
 I echo to STDERR.

And on the Ubuntu side we are now happy with debian/postinst in version
0.21, except that we want a supplementary condition to be met to edit
80im-switch. Will get back to you about it later on in a private mail.

Thanks!

-- 
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#701224: Safely prevent adverse impact if im-switch was removed but not purged

2013-02-23 Thread Osamu Aoki
On Sat, Feb 23, 2013 at 05:45:54AM +0100, Gunnar Hjalmarsson wrote:
 Package: im-config
 Severity: important
 
 This is a forward of the Ubuntu bug https://launchpad.net/bugs/1101836

Thanks.  I think if I update this, I need to add new hush number for new
im-switch to ensure automatic erase.

Osamu


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#701224: Safely prevent adverse impact if im-switch was removed but not purged

2013-02-23 Thread Gunnar Hjalmarsson
On 2013-02-23 16:58, Osamu Aoki wrote:
 I think if I update this, I need to add new hush number for new
 im-switch to ensure automatic erase.

Why not drop the md5sum check as regards 80im-switch and use the
attached file as is instead?

As Iain Lane pointed out at the Ubuntu bug report, if im-config deletes
the file, and the user at a later point of time decides to go back to
im-switch (for some reason), 80im-switch won't be reinstalled, and the
user is faced with an issue that may be hard to track down.

Now when that line has been added to 80im-switch in the normal way, you
can say that with the file I propose, all debian/postinst would do is
adding a line to 80im-switch that would otherwise have been added at
next update. It does no harm in any way.

If the policy still makes you hesitate, you should bear in mind that it
was scarcely written with this special case in mind. Somebody should be
able to approve an exception.

Using the attached file would also eliminate one of the current
differences between the Debian and Ubuntu versions of im-config.
Hopefully we'll soon be able to use exactly the same version.

-- 
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#701224: Safely prevent adverse impact if im-switch was removed but not purged

2013-02-22 Thread Gunnar Hjalmarsson
Package: im-config
Severity: important

This is a forward of the Ubuntu bug https://launchpad.net/bugs/1101836

The fix of http://bugs.debian.org/701181 meant inserting of a line of
code which prevents that /etc/X11/Xsession.d/80im-switch keeps being
sourced if the im-switch package is removed but not purged. This is
essential for im-config to work correctly.

However, if a user who has modified 80im-switch does not update before
replacing im-switch with im-config, 80im-switch will keep being sourced
and with that affect the im-config functionality adversely. One way to
prevent that from happening is to let im-config at installation insert a
line as just mentioned into 80im-switch, if it's not there already.
Attached please find a modified debian/postinst file which does just
that, and which we are about to use in Ubuntu.

-- 
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj
#!/bin/sh
# postinst script for im-config
# vim: set sts=4 expandtab:

set -e

# version just before wheezy release
# 4045a8eeb0e9226cdd9f8a121ccf4c04  80im-config_launch 0.3 (stable initial)
# 8a4829f935b5561ca6e61bec6eb3893f  80im-config_launch 0.3+squeeze1 (stable), 
0.4
# b243876a16f7b87c397ceef626098069  80im-config_launch 0.5
# 5ef27261ac38d704d8f766da19635461  80im-config_launch 0.6-0.17 (testing, 
unstable)

case $1 in
configure)
IM_SWITCH_HOOK=/etc/X11/Xsession.d/80im-switch
IM_SWITCH_DISABLE_CODE='[ -x /usr/bin/im-switch ] || return 0'
if [ -f $IM_SWITCH_HOOK ] 
 [ $( head -1 $IM_SWITCH_HOOK ) != $IM_SWITCH_DISABLE_CODE ] 
 [ $( sed -n 15p $IM_SWITCH_HOOK ) != $IM_SWITCH_DISABLE_CODE ]
then
echo Disabling conflicting hook file: $IM_SWITCH_HOOK ...
sed -i 1 i $IM_SWITCH_DISABLE_CODE $IM_SWITCH_HOOK
fi
IM_CONFIG_HOOK=/etc/X11/Xsession.d/80im-config_launch
if [ -f $IM_CONFIG_HOOK ]; then
IM_CONFIG_HOOK_MD5SUM=$(md5sum  $IM_CONFIG_HOOK|cut -d ' ' -f 1)
case $IM_CONFIG_HOOK_MD5SUM in

4045a8eeb0e9226cdd9f8a121ccf4c04|8a4829f935b5561ca6e61bec6eb3893f|b243876a16f7b87c397ceef626098069|5ef27261ac38d704d8f766da19635461)
rm -f $IM_CONFIG_HOOK
;;

*)
echo ERROR: Unknown hook file exists: $IM_CONFIG_HOOK. 2
;;
esac
fi
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
echo postinst called with unknown argument \`$1' 2
exit 1
;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0