rpms/alexandria/F-9 alexandria-0.6.3-library-utf8-string.patch, NONE, 1.1 alexandria.spec, 1.16, 1.17

Mamoru Tasaka mtasaka at fedoraproject.org
Fri Feb 27 11:22:04 UTC 2009


Author: mtasaka

Update of /cvs/extras/rpms/alexandria/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13343/F-9

Modified Files:
	alexandria.spec 
Added Files:
	alexandria-0.6.3-library-utf8-string.patch 
Log Message:
Apply library UTF-8 patch on F-10/9

alexandria-0.6.3-library-utf8-string.patch:

--- NEW FILE alexandria-0.6.3-library-utf8-string.patch ---
Index: lib/alexandria/ui/sidepane.rb
===================================================================
--- lib/alexandria/ui/sidepane.rb	(revision 1012)
+++ lib/alexandria/ui/sidepane.rb	(revision 1021)
@@ -19,18 +19,42 @@
         x and x.name != @parent.selected_library.name
       end
 
-      def contains_illegal_character new_text
-        /([^\w\s'"()&?!:;.\-])/.match(new_text)
+      # if new_text is invalid utf-8, returns true
+      # if new_text contains disallowed char (/ or initial .), returns a MatchData object
+      # otherwise returns nil
+      def contains_illegal_character(new_text)
+        begin
+          new_text.unpack("U*") # attempt to unpack as UTF-8 characters
+          match = /(^\.|\/)/.match(new_text)
+          # forbid / character (since Library names become dir names)
+          # also no initial . since that hides the Library (hidden file)
+          #      forbidding an initial dot also disallows "." and ".."
+          #      which are of course pre-existing directories.
+          return match
+        rescue Exception => ex
+          log.warn { "New library name not valid UTF-8: #{ex.message}" }
+          return true
+        end
+        # /([^\w\s'"()&?!:;.\-])/.match(new_text) # anglocentric!
       end
 
       def on_edited_library cell, path_string, new_text
-        log.debug { "edited" }
+        log.debug { "edited library name #{new_text}" }
+        ## new_text = new_text.reverse # for testing; 
+                                       # a great way to generate broken UTF-8
         if cell.text != new_text
           if match = contains_illegal_character(new_text)
-            log.debug { "Illegal character" }
-            ErrorDialog.new(@main_app, _("Invalid library name '%s'") % new_text,
-              _("The name provided contains the " + "illegal character '<i>%s</i>'.") %
-            match[1].gsub(/&/, "&"))
+            if match.instance_of? MatchData
+              chars = match[1].gsub(/&/, "&")
+              ErrorDialog.new(@main_app, _("Invalid library name '%s'") % new_text,
+                              _("The name provided contains the " +
+                                "disallowed character <b>%s</b> ") % chars)
+            else
+              ErrorDialog.new(@main_app, _("Invalid library name"),
+                              _("The name provided contains " + 
+                                "invalid characters."))
+            end
+
           elsif new_text.strip.empty?
             log.debug { "Empty text" }
             ErrorDialog.new(@main_app, _("The library name " +


Index: alexandria.spec
===================================================================
RCS file: /cvs/extras/rpms/alexandria/F-9/alexandria.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- alexandria.spec	3 Feb 2009 16:19:17 -0000	1.16
+++ alexandria.spec	27 Feb 2009 11:21:33 -0000	1.17
@@ -1,11 +1,11 @@
-%{!?ruby_sitelib:	%define ruby_sitelib	%(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
+%{!?ruby_sitelib:	%global ruby_sitelib	%(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")}
 %define		rubyabi		1.8
 %define		repoid		32739
 
 %define		majorver	0.6.3
 %undefine		minorver	
 
-%define		fedorarel	7
+%define		fedorarel	11
 %define		rel		%{?minorver:0.}%{fedorarel}%{?minorver:.%minorver}
 
 
@@ -19,7 +19,12 @@
 License:	GPLv2+
 URL:		http://alexandria.rubyforge.org/
 Source0:	http://rubyforge.org/frs/download.php/%{repoid}/%{name}-%{version}%{?minorver}.tar.gz
+# http://rubyforge.org/tracker/?func=detail&atid=863&aid=19042&group_id=205
+# Turned out this was actually bug in ruby-gnome2, fixed in 0.17.0 rc1
 #Patch0:		alexandria-0.6.3-crash_tooltips.patch
+# http://rubyforge.org/tracker/?func=detail&atid=863&aid=20168&group_id=205
+# Patch is already in upstream svn repo
+Patch1:		alexandria-0.6.3-library-utf8-string.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:	noarch
@@ -68,6 +73,7 @@
 %prep
 %setup -q -n %{name}-%{majorver}%{?minorver}
 #%%patch0 -p1 -b .tooltips
+%patch1 -p0 -b .utf_8
 
 %build
 rake build
@@ -132,7 +138,6 @@
 
 %post
 touch --no-create %{_datadir}/icons/hicolor/
-%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
 
 %{_bindir}/scrollkeeper-update -q -o %{_datadir}/omf/%{name}
 
@@ -150,10 +155,16 @@
 exit 0
 
 %postun
+%{_bindir}/scrollkeeper-update -q
+[ "$1" -eq 0 ] || exit 0
+
 touch --no-create %{_datadir}/icons/hicolor/
 %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
 
-%{_bindir}/scrollkeeper-update -q
+exit 0
+
+%posttrans
+%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
 exit 0
 
 %files -f %{name}.lang
@@ -182,6 +193,22 @@
 %{_datadir}/icons/hicolor/*/apps/%{name}.*
 
 %changelog
+* Fri Feb 27 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.3-11
+- library UTF-8 patch update
+
+* Thu Feb 26 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.3-10
+- Use upstreamed patch for UTF-8 strings issue
+
+* Thu Feb 26 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.3-9
+- Attempt to handle UTF-8 strings in library names correctly
+
+* Tue Feb 24 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp>
+- F-11: Mass rebuild
+
+* Tue Feb 24 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.3-8
+- Global-ize "nested" macro
+- GTK icon cache update scripts update
+
 * Wed Feb  4 2009 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 0.6.3-7
 - Add hpricot dependency again (for Amazon provider)
 




More information about the fedora-extras-commits mailing list