From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#13907: 24.3.50; cygw32 build mishandles drag-n-dropped file with non-ASCII characters in name Date: Fri, 08 Mar 2013 19:03:58 -0800 Message-ID: <513AA69E.5080908@dancol.org> References: <513A1D4D.5060908@cornell.edu> <8338w5zni7.fsf@gnu.org> <83vc91y6m4.fsf@gnu.org> <83txoly5ov.fsf@gnu.org> <513A5741.8060804@dancol.org> <513AA672.80903@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2NWUADRUWNONSJHFIQDWE" X-Trace: ger.gmane.org 1362798276 10704 80.91.229.3 (9 Mar 2013 03:04:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Mar 2013 03:04:36 +0000 (UTC) Cc: 13907@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 09 04:05:01 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UEA5j-0007tx-Dz for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Mar 2013 04:04:59 +0100 Original-Received: from localhost ([::1]:35279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA5N-0005Hk-Gc for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Mar 2013 22:04:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA5F-0005HS-W0 for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:04:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEA57-0000eY-Uf for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:04:29 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA57-0000eU-RR for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:04:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UEA5m-0002tw-7Z for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Mar 2013 03:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13907 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13907-submit@debbugs.gnu.org id=B13907.136279829211131 (code B ref 13907); Sat, 09 Mar 2013 03:05:02 +0000 Original-Received: (at 13907) by debbugs.gnu.org; 9 Mar 2013 03:04:52 +0000 Original-Received: from localhost ([127.0.0.1]:40480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEA5b-0002tT-Bh for submit@debbugs.gnu.org; Fri, 08 Mar 2013 22:04:51 -0500 Original-Received: from dancol.org ([96.126.100.184]:51984) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEA5Z-0002tM-KI for 13907@debbugs.gnu.org; Fri, 08 Mar 2013 22:04:50 -0500 Original-Received: from c-76-22-66-162.hsd1.wa.comcast.net ([76.22.66.162] helo=[0.0.0.0]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1UEA4u-0003D2-KS; Fri, 08 Mar 2013 19:04:08 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: <513AA672.80903@dancol.org> X-Enigmail-Version: 1.5.1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72257 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2NWUADRUWNONSJHFIQDWE Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 3/8/2013 7:03 PM, Daniel Colascione wrote: > On 3/8/2013 1:25 PM, Daniel Colascione wrote: >> On 3/8/2013 12:53 PM, Eli Zaretskii wrote: >>>> Date: Fri, 08 Mar 2013 22:33:07 +0200 >>>> From: Eli Zaretskii >>>> Cc: 13907@debbugs.gnu.org >>>> >>>> And one more question: what is the value of file-name _before_ it is= >>>> passed to cygwin-convert-file-name-from-windows? Does it perhaps >>>> already have the U-umlaut replaced by a blank? >>> >>> I think the problem is on the C level, not on the Lisp level. Take a= >>> look at w32term.c:construct_drag_n_drop -- it uses ANSI version of >>> DragQueryFile to get the file name, then decodes it by DECODE_FILE. >>> But DECODE_FILE uses UTF-8 in the cygw32 build, so this is >>> inappropriate for decoding file names that come from Windows APIs. >>> >>> Instead, in the cygw32 build, construct_drag_n_drop should use >>> DragQueryFileW and convert the file name to the internal Emacs >>> representation using from_unicode. >>> >> >> >> Thanks for finding that! I've been swamped this week, and I haven't be= en able to >> do any investigation. I'll see whether I can come up with a fix this w= eekend. >> >=20 > The patch below resolves the issue for me. Assuming it's acceptable, wh= ere > should I install it? >=20 > ~/edev/trunk > $ bzr diff > =3D=3D=3D modified file 'src/w32term.c' > --- src/w32term.c 2013-02-16 13:59:37 +0000 > +++ src/w32term.c 2013-03-09 03:02:10 +0000 > @@ -3186,12 +3186,27 @@ >=20 > for (i =3D 0; i < num_files; i++) > { > +#ifdef NTGUI_UNICODE > + len =3D DragQueryFileW (hdrop, i, NULL, 0); > + if (len <=3D 0) > + continue; > + > + name =3D alloca ((len + 1) * sizeof (wchar_t)); > + DragQueryFileW (hdrop, i, (wchar_t *) name, len + 1); > + files =3D Fcons ( > + from_unicode (make_unibyte_string( > + name, > + 1 + sizeof (wchar_t) * len)), > + files); > +#else > len =3D DragQueryFile (hdrop, i, NULL, 0); > if (len <=3D 0) > continue; > + > name =3D alloca (len + 1); > DragQueryFile (hdrop, i, name, len + 1); > files =3D Fcons (DECODE_FILE (build_string (name)), files); > +#endif /* NTGUI_UNICODE */ > } >=20 > DragFinish (hdrop); By the way: shouldn't we have an unwind handler here so that we call Drag= Finish even if our memory allocation fails? ------enig2NWUADRUWNONSJHFIQDWE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (Cygwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlE6pp4ACgkQ17c2LVA10VsFigCfR6mCk4fR7wY22xsP9NU4q9Qv LlcAn1fudUEltvKq41T4pi93zjJjQRdP =tg/A -----END PGP SIGNATURE----- ------enig2NWUADRUWNONSJHFIQDWE--