Merge lp:~nobuto/ubuntu/vivid/unzip/fallback-encoding into lp:ubuntu/vivid/unzip

Proposed by Nobuto Murata on 2015-02-13
Status: Superseded
Proposed branch: lp:~nobuto/ubuntu/vivid/unzip/fallback-encoding
Merge into: lp:ubuntu/vivid/unzip
Diff against target: 65 lines (+42/-0)
3 files modified
debian/changelog (+7/-0)
debian/profile.unzip-default-charset.sh (+32/-0)
debian/rules (+3/-0)
To merge this branch: bzr merge lp:~nobuto/ubuntu/vivid/unzip/fallback-encoding
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre 2015-04-03 Needs Information on 2015-05-11
Sebastien Bacher 2015-02-13 Needs Information on 2015-02-16
Aron Xu (community) 2015-02-13 Approve on 2015-02-15
Review via email: mp+249644@code.launchpad.net

Description of the Change

This branch adds default charsets handling for Windows archives in CJKV+th locale, inspired by Ubuntu Kylin way.

As a result of bug #580961, two options have been added as Ubuntu patch.
> -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives
> -I CHARSET specify a character encoding for UNIX and other archives

Then Ubuntu Kylin added default encoding as environment variables for their distribution.
http://bazaar.launchpad.net/~ubuntukylin-members/ubuntukylin-default-settings/trunk/revision/171

Now as Ubuntu, we can go further by a better way:
 - per user settings by their locales instead of global settings
 - don't interfere in other locales by locale guard

I only add "-O", so no behavior change for zip files created on Ubuntu or other Linux/UNIX systems. This branch just handles zip file created on localized Windows system seamlessly.

charsets list is taken from:
https://msdn.microsoft.com/en-us/goglobal/bb964654
and
msdos/msdos.c in unzip package:
   1682 case 932: /* Japanese */
   1683 case 949: /* Korean */
   1684 case 936: /* Chinese, simple */
   1685 case 950: /* Chinese, traditional */
   1686 case 874: /* Thai */
   1687 case 1258: /* Vietnamese */

To post a comment you must log in.
31. By Nobuto Murata on 2015-02-13

name path properly

Jun Kobayashi (jkbys) wrote :

Works fine for me to extract zip file including files named with CP932.

Aron Xu (happyaron) :
review: Approve
Sebastien Bacher (seb128) wrote :

thanks, is there any reason that couldn't be forward to Debian? It would also be nice to have a bug report explaining the issue/what the change resolve and having the changelog refer to the said bug

review: Needs Information
32. By Nobuto Murata on 2015-02-16

update changelog to refer lp bug number

Nobuto Murata (nobuto) wrote :

@Sebastian,

> thanks, is there any reason that couldn't be forward to Debian?

This branch depends on an Ubuntu delta patch[1]. Debian also discussed about it on [2], but it seems stuck for a while.

[1] http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/unzip/vivid/view/head:/debian/patches/20-unzip60-alt-iconv-utf8

[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=483290

> It would also be nice to have a bug report explaining the issue/what the change resolve and having the changelog refer to the said bug

opened and updated the changelog accordingly.

Thanks,

33. By Nobuto Murata on 2015-02-27

rebase

Mathieu Trudel-Lapierre (cyphermox) wrote :

What will be the effect on decompressing files that were created on non-localized Windows systems for the locales affected by this change?

Otherwise the change looks fine to me.

review: Needs Information
34. By Nobuto Murata on 2015-05-28

rebase

35. By Nobuto Murata on 2015-05-29

add autopkgtest to make sure all of 3 types of zip files can be
extracted properly

Unmerged revisions

35. By Nobuto Murata on 2015-05-29

add autopkgtest to make sure all of 3 types of zip files can be
extracted properly

34. By Nobuto Murata on 2015-05-28

rebase

33. By Nobuto Murata on 2015-02-27

rebase

32. By Nobuto Murata on 2015-02-16

update changelog to refer lp bug number

31. By Nobuto Murata on 2015-02-13

name path properly

30. By Nobuto Murata on 2015-02-13

tweak variables' name

29. By Nobuto Murata on 2015-02-08

add default -O option to handle Windows' encoding for CJKV + th
locale, inspired by Ubuntu Kylin way

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-02-17 14:22:58 +0000
3+++ debian/changelog 2015-02-27 16:10:30 +0000
4@@ -1,3 +1,10 @@
5+unzip (6.0-13ubuntu4) UNRELEASED; urgency=medium
6+
7+ * add default charsets for Windows archives in CJKV+th locale,
8+ inspired by Ubuntu Kylin way, LP: #1422290
9+
10+ -- Nobuto MURATA <nobuto@ubuntu.com> Mon, 09 Feb 2015 00:18:46 +0900
11+
12 unzip (6.0-13ubuntu3) vivid; urgency=medium
13
14 * SECURITY UPDATE: heap overflow in charset_to_intern()
15
16=== added file 'debian/profile.unzip-default-charset.sh'
17--- debian/profile.unzip-default-charset.sh 1970-01-01 00:00:00 +0000
18+++ debian/profile.unzip-default-charset.sh 2015-02-27 16:10:30 +0000
19@@ -0,0 +1,32 @@
20+locale=${LC_ALL:-$LC_CTYPE}
21+locale=${locale:-$LANG}
22+locale=${locale%%.*}
23+
24+case "$locale" in
25+ ja_JP)
26+ charset=CP932
27+ ;;
28+ ko_KR)
29+ charset=CP949
30+ ;;
31+ th_TH)
32+ charset=CP874
33+ ;;
34+ vi_VN)
35+ charset=CP1258
36+ ;;
37+ zh_CN)
38+ charset=CP936
39+ ;;
40+ zh_TW)
41+ charset=CP950
42+ ;;
43+ *)
44+ charset=
45+ ;;
46+esac
47+
48+if [ -n "$charset" ]; then
49+ export UNZIP="-O $charset"
50+ export ZIPINFO="-O $charset"
51+fi
52
53=== modified file 'debian/rules'
54--- debian/rules 2014-06-05 10:03:44 +0000
55+++ debian/rules 2015-02-27 16:10:30 +0000
56@@ -50,6 +50,9 @@
57 $(MAKE) -f unix/Makefile install prefix=`pwd`/debian/tmp/usr
58 install -m 755 debian/postinst debian/postrm debian/tmp/DEBIAN
59 install -m 644 debian/mime debian/tmp/usr/lib/mime/packages/$(package)
60+ install -d debian/tmp/etc/profile.d
61+ install -m 644 debian/profile.unzip-default-charset.sh \
62+ debian/tmp/etc/profile.d/unzip-default-charset.sh
63 cat debian/copyright.in LICENSE > $(docdir)/copyright
64 cp debian/changelog $(docdir)/changelog.Debian
65 cp -p History.* BUGS ToDo $(docdir)

Subscribers

People subscribed via source and target branches

to all changes: