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:14 -0800 Message-ID: <513AA672.80903@dancol.org> References: <513A1D4D.5060908@cornell.edu> <8338w5zni7.fsf@gnu.org> <83vc91y6m4.fsf@gnu.org> <83txoly5ov.fsf@gnu.org> <513A5741.8060804@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2WBVLHRGTOJKQXHOWUAWB" X-Trace: ger.gmane.org 1362798277 10709 80.91.229.3 (9 Mar 2013 03:04:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Mar 2013 03:04:37 +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-0007tw-Bi for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Mar 2013 04:04:59 +0100 Original-Received: from localhost ([::1]:35276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA5N-0005He-Dj 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]:38801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA5F-0005HR-Vj 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-0000eQ-Oi for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:04:29 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEA57-0000eM-LY 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 1UEA5l-0002tr-S4 for bug-gnu-emacs@gnu.org; Fri, 08 Mar 2013 22:05:01 -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:01 +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.136279825311079 (code B ref 13907); Sat, 09 Mar 2013 03:05:01 +0000 Original-Received: (at 13907) by debbugs.gnu.org; 9 Mar 2013 03:04:13 +0000 Original-Received: from localhost ([127.0.0.1]:40475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEA4y-0002se-Ok for submit@debbugs.gnu.org; Fri, 08 Mar 2013 22:04:13 -0500 Original-Received: from dancol.org ([96.126.100.184]:51981) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEA4v-0002sU-DM for 13907@debbugs.gnu.org; Fri, 08 Mar 2013 22:04:11 -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 1UEA4F-0003Cv-V7; Fri, 08 Mar 2013 19:03:28 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: <513A5741.8060804@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:72258 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2WBVLHRGTOJKQXHOWUAWB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. >> >=20 >=20 > Thanks for finding that! I've been swamped this week, and I haven't bee= n able to > do any investigation. I'll see whether I can come up with a fix this we= ekend. >=20 The patch below resolves the issue for me. Assuming it's acceptable, wher= e should I install it? ~/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 @@ 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 */ } DragFinish (hdrop); ------enig2WBVLHRGTOJKQXHOWUAWB 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/ iEYEARECAAYFAlE6pnQACgkQ17c2LVA10VvSIQCgtlKy+m9Rahj5OcPdCjGn1W1x Q/wAoIIDdRHBJ8rbSMne7UYigYff/YEL =hSc3 -----END PGP SIGNATURE----- ------enig2WBVLHRGTOJKQXHOWUAWB--