Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 sed (4.2.1-10) unstable; urgency=low
 .
   * Bump to Standards-Version 3.9.2.
   * Use dpkg-buildflags.  closes: #653718.
   * Add build-arch and build-indep targets.
   * Change selinux build-dependency to [linux-any].
Author: Clint Adams <clint@debian.org>
Bug-Debian: http://bugs.debian.org/653718

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- sed-4.2.1.orig/ChangeLog
+++ sed-4.2.1/ChangeLog
@@ -1,3 +1,19 @@
+2009-12-07  Clint Adams  <schizo@debian.org>  (tiny change)
+
+	* sed/execute.c (open_next_file): If is_selinux_enabled returns -1,
+	treat it as "disabled".
+
+2009-10-15  Paolo Bonzini  <bonzini@gnu.org>
+
+	* sed/execute.c (closedown): First change owner (while permissions
+	stay 0?00), then mode.
+
+2009-10-15  Paolo Bonzini  <bonzini@gnu.org>
+	    WANG Yunfeng  <uhuruh@gmail.com>
+
+	* sed/execute.c (str_append, str_append_modified): Handle incomplete
+	sequences as if they were invalid.
+
 2009-06-27  Paolo Bonzini  <bonzini@gnu.org>
 
 	* configure.ac: Bump version.
--- sed-4.2.1.orig/THANKS
+++ sed-4.2.1/THANKS
@@ -23,6 +23,7 @@ Greg Ubben <gsu@romulus.ncsc.mil>
 Isamu Hasegawa <isamu@yamato.ibm.com>
 J.T. Conklin <jtc@gain.com>
 Jakub Jelinek <jakub@redhat.com>
+Jari Aalto <jari.aalto@cante.net>
 Jason Molenda <crash@cygnus.com>
 Jim Meyering <meyering@ascend.com>
 Laurent Vogel <lvl@club-internet.fr>
--- sed-4.2.1.orig/doc/sed.x
+++ sed-4.2.1/doc/sed.x
@@ -99,25 +99,6 @@ if
 .I label
 is omitted, branch to end of script.
 .TP
-.RI t\  label
-If a s/// has done a successful substitution since the
-last input line was read and since the last t or T
-command, then branch to
-.IR label ;
-if
-.I label
-is omitted, branch to end of script.
-.TP
-.RI T\  label
-If no s/// has done a successful substitution since the
-last input line was read and since the last t or T
-command, then branch to
-.IR label ;
-if
-.I label
-is omitted, branch to end of script.  This is a GNU
-extension.
-.TP
 c \e
 .TP
 .I text
@@ -140,9 +121,6 @@ Copy/append pattern space to hold space.
 g G
 Copy/append hold space to pattern space.
 .TP
-x
-Exchange the contents of the hold and pattern spaces.
-.TP
 l
 List out the current line in a ``visually unambiguous'' form.
 .TP
@@ -177,6 +155,25 @@ and the special escapes \e1 through \e9
 corresponding matching sub-expressions in the
 .IR regexp .
 .TP
+.RI t\  label
+If a s/// has done a successful substitution since the
+last input line was read and since the last t or T
+command, then branch to
+.IR label ;
+if
+.I label
+is omitted, branch to end of script.
+.TP
+.RI T\  label
+If no s/// has done a successful substitution since the
+last input line was read and since the last t or T
+command, then branch to
+.IR label ;
+if
+.I label
+is omitted, branch to end of script.  This is a GNU
+extension.
+.TP
 .RI w\  filename
 Write the current pattern space to
 .IR filename .
@@ -186,6 +183,9 @@ Write the first line of the current patt
 .IR filename .
 This is a GNU extension.
 .TP
+x
+Exchange the contents of the hold and pattern spaces.
+.TP
 .RI y/ source / dest /
 Transliterate the characters in the pattern space which appear in
 .I source
--- sed-4.2.1.orig/doc/sed-in.texi
+++ sed-4.2.1/doc/sed-in.texi
@@ -1841,9 +1841,12 @@ x
 G
 
 # check if converted file name is equal to original file name,
-# if it is, do not print nothing
+# if it is, do not print anything
 /^.*\/\(.*\)\n\1/b
 
+# escape special characters for the shell
+s/["$`\\]/\\&/g
+
 # now, transform path/fromfile\n, into
 # mv path/fromfile path/tofile and print it
 s/^\(.*\/\)\(.*\)\n\(.*\)$/mv "\1\2" "\1\3"/p
--- sed-4.2.1.orig/doc/sed.1
+++ sed-4.2.1/doc/sed.1
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.28.
-.TH SED "1" "June 2009" "sed version 4.2.1" "User Commands"
+.TH SED "1" "December 2010" "sed 4.2.1" "User Commands"
 .SH NAME
 sed \- stream editor for filtering and transforming text
 .SH SYNOPSIS
@@ -151,25 +151,6 @@ if
 .I label
 is omitted, branch to end of script.
 .TP
-.RI t\  label
-If a s/// has done a successful substitution since the
-last input line was read and since the last t or T
-command, then branch to
-.IR label ;
-if
-.I label
-is omitted, branch to end of script.
-.TP
-.RI T\  label
-If no s/// has done a successful substitution since the
-last input line was read and since the last t or T
-command, then branch to
-.IR label ;
-if
-.I label
-is omitted, branch to end of script.  This is a GNU
-extension.
-.TP
 c \e
 .TP
 .I text
@@ -192,9 +173,6 @@ Copy/append pattern space to hold space.
 g G
 Copy/append hold space to pattern space.
 .TP
-x
-Exchange the contents of the hold and pattern spaces.
-.TP
 l
 List out the current line in a ``visually unambiguous'' form.
 .TP
@@ -229,6 +207,25 @@ and the special escapes \e1 through \e9
 corresponding matching sub-expressions in the
 .IR regexp .
 .TP
+.RI t\  label
+If a s/// has done a successful substitution since the
+last input line was read and since the last t or T
+command, then branch to
+.IR label ;
+if
+.I label
+is omitted, branch to end of script.
+.TP
+.RI T\  label
+If no s/// has done a successful substitution since the
+last input line was read and since the last t or T
+command, then branch to
+.IR label ;
+if
+.I label
+is omitted, branch to end of script.  This is a GNU
+extension.
+.TP
 .RI w\  filename
 Write the current pattern space to
 .IR filename .
@@ -238,6 +235,9 @@ Write the first line of the current patt
 .IR filename .
 This is a GNU extension.
 .TP
+x
+Exchange the contents of the hold and pattern spaces.
+.TP
 .RI y/ source / dest /
 Transliterate the characters in the pattern space which appear in
 .I source
--- sed-4.2.1.orig/doc/sed.texi
+++ sed-4.2.1/doc/sed.texi
@@ -1895,11 +1895,16 @@ G
 
 @group
 # check if converted file name is equal to original file name,
-# if it is, do not print nothing
+# if it is, do not print anything
 /^.*\/\(.*\)\n\1/b
 @end group
 
 @group
+# escape special characters for the shell
+s/["$`\\]/\\&/g
+@end group
+
+@group
 # now, transform path/fromfile\n, into
 # mv path/fromfile path/tofile and print it
 s/^\(.*\/\)\(.*\)\n\(.*\)$/mv "\1\2" "\1\3"/p
--- sed-4.2.1.orig/po/hu.po
+++ sed-4.2.1/po/hu.po
@@ -13,7 +13,7 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-2\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
 
 #: sed/compile.c:161
 msgid "multiple `!'s"
--- sed-4.2.1.orig/sed/execute.c
+++ sed-4.2.1/sed/execute.c
@@ -254,8 +254,8 @@ str_append(to, string, length)
       {
         size_t n = MBRLEN (string, length, &to->mbstate);
 
-        /* An invalid sequence is treated like a singlebyte character. */
-        if (n == (size_t) -1)
+        /* An invalid or imcomplete sequence is treated like a singlebyte character. */
+        if (n == (size_t) -1 || n == (size_t) -2)
 	  {
 	    memset (&to->mbstate, 0, sizeof (to->mbstate));
 	    n = 1;
@@ -745,7 +745,7 @@ open_next_file(name, input)
         panic(_("couldn't edit %s: not a regular file"), input->in_file_name);
 
 #ifndef BOOTSTRAP
-      if (is_selinux_enabled ())
+      if (is_selinux_enabled () > 0)
 	{
           security_context_t con;
 	  if (getfilecon (input->in_file_name, &con) != -1)
@@ -805,13 +805,13 @@ closedown(input)
       target_name = input->in_file_name;
       input_fd = fileno (input->fp);
       output_fd = fileno (output_file.fp);
-      copy_acl (input->in_file_name, input_fd,
-		input->out_file_name, output_fd,
-		input->st.st_mode);
 #ifdef HAVE_FCHOWN
       if (fchown (output_fd, input->st.st_uid, input->st.st_gid) == -1)
         fchown (output_fd, -1, input->st.st_gid);
 #endif
+      copy_acl (input->in_file_name, input_fd,
+		input->out_file_name, output_fd,
+		input->st.st_mode);
 
       ck_fclose (input->fp);
       ck_fclose (output_file.fp);
