From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#38287: 26.3.50; filenotify.el: the Chinese file name in the event is messy code Date: Wed, 20 Nov 2019 19:45:31 +0100 Message-ID: <87imne5qus.fsf@gmx.de> References: <87y2wa7bl3.fsf@gmx.de> <83pnhmzc16.fsf@gnu.org> <875zje780h.fsf@gmx.de> <83imnez9q9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="186169"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 38287@debbugs.gnu.org, netjune@outlook.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 20 19:55:44 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXV8e-000m8R-Bq for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Nov 2019 19:55:40 +0100 Original-Received: from localhost ([::1]:33612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXV8c-00055M-Oa for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Nov 2019 13:55:39 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXUzM-0004th-9W for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:46:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXUzK-00066k-4c for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:46:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42074) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXUzK-00066g-0q for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iXUzJ-0006N9-UT for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Nov 2019 18:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38287 X-GNU-PR-Package: emacs Original-Received: via spool by 38287-submit@debbugs.gnu.org id=B38287.157427555224475 (code B ref 38287); Wed, 20 Nov 2019 18:46:01 +0000 Original-Received: (at 38287) by debbugs.gnu.org; 20 Nov 2019 18:45:52 +0000 Original-Received: from localhost ([127.0.0.1]:50895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXUz5-0006MY-0r for submit@debbugs.gnu.org; Wed, 20 Nov 2019 13:45:47 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:43893) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXUz3-0006MK-FR for 38287@debbugs.gnu.org; Wed, 20 Nov 2019 13:45:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1574275534; bh=FM8cGahtnTmVUqyYQQ/XeXt967/rfKnRyWE4GE227SM=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=irQA5crFvHcjo8mii/0XRIaOPa8NS+7EYU9W66r5uK4BjtT9pDVvUcqYeuKI43S2B RoUFO+8j+qhYDOw7SYz5ug9NxjOiV4+ApbCU9UNTa8IlR+R+Rn4CGekbFQZJHWgd+/ w2Khx1duXa+ckgFf6BueOghsP1q7nzJzqCKcaoRI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.86.46.89]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MbzyP-1hzXCj11pv-00dZWY; Wed, 20 Nov 2019 19:45:34 +0100 In-Reply-To: <83imnez9q9.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Nov 2019 20:25:02 +0200") X-Provags-ID: V03:K1:OLO7Np9CjMAk+yrOkHgX69RjwsKPKFGGB2HA+/1YEZ/HYnwcu8J S3ReNnR4DgRtsiOLP6M+5CnnI9W2f3IIZAs/XnnF7dTo0agVYEZC+S5kpg/ba1v6DuVsuBK 7dgD9QzvLH/8mQasC/jE0fwc+gBh1eoC7wxd/BtJ3fcpFowW2rbpIOKjLz4srJ60BMLaz/i 2TyyApQhLJmReGkgtPboA== X-UI-Out-Filterresults: notjunk:1;V03:K0:j2+6k2sxXP0=:32KII0g+l0uUpEx2ltuvJ9 +olRUfk8amXegXwsazNAvQ8/wS4bLguvUPQy8CHL5vud1jsFana356MiVsPm2WuzYpDRqV1gA zPSK36BJPWeGeQA9E7hvrg7K6aU9DaPLlgwsJDgxzGY+iTv2Mt2yriw3/loAOIP9sMCtRtELI 43vdK1ZotWZEAamh8QByNvO64v0d+gR4ssyw6M7nsxF1hUJmZ+72SgeVxsBTC06MdDQcRiLpK D0bmgyxc/6oEfPvsghAXBbRCUFA4W0ytvksyQOF+BLRaiPuRsoBtJ794MRY0qS36z5xI9O8bz AedacNu7Y/8nd+cgOxMFx3PbykD1ncXXZ1oJz6DVSSmYUEvBJX79h5cH11Zt1r598sZ3xZGL8 cxqh5uq36Jx6GVkyKREKS7Wz4u39pFo2eLmpLg6r2Ea3SMfgCf+xaZhCcaTzXDxjhQUdT/vgb +MdLqSLivMCmtUOrrAEXKKa5RSRRmAo6OX/jWxYpmWc+VoWNKFPJ53nn7Jdl3KvkmbDrUy3Dw ozqKg4aQRlVrtKWXAk7a4d04tUocAlRpa++c+vMVWHA5IObhKqQeY9LCDB0bZuQvQ9IhUm1fx 1tNuiN/5lTq/xPGH6TQGhhC8nss08H414vCdOmmtyCkPUnbAyXsiGCaY9amXseYQgqL2A1s7C qKl2Hk6qZghanw2RCL1P9YKAVTh14w8JOaJf5EqyARKpY/v0hZ6HdUmbw3v+/d/P2Tg99eVqF 8u6AfpOq1xeZ5uU00uYMk/mv24Q3+/xwOziOhcktslKpxvg0q8mXAVmAsR6ywpjudYCct3KS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:172069 Archived-At: Eli Zaretskii writes: >> Hmm. kqueue.c is very lazy in using ENCODE_FILE, it uses it only in >> kqueue-add-watch. Maybe it is missing somewhere else? > > I see one potential problem: in kqueue-add-watch, you encode the file > name, but then pass it to APIs that generally expect multibyte > (i.e. un-encoded) strings, although they will also work with encoded > unibyte strings. Moreover, you put the unibyte encoded file name into > the watch object. Not sure if this is related to the issue at hand, > but it would be cleaner to make this change: > > diff --git a/src/kqueue.c b/src/kqueue.c > index 76d7fc1..1383d7d 100644 > --- a/src/kqueue.c > +++ b/src/kqueue.c > @@ -414,7 +414,7 @@ DEFUN ("kqueue-add-watch", Fkqueue_add_watch, Skqueu= e_add_watch, 3, 3, 0, > } > > /* Open file. */ > - file =3D ENCODE_FILE (file); > + Lisp_Object encoded_file =3D ENCODE_FILE (file); > oflags =3D O_NONBLOCK; > #if O_EVTONLY > oflags |=3D O_EVTONLY; > @@ -426,7 +426,7 @@ DEFUN ("kqueue-add-watch", Fkqueue_add_watch, Skqueu= e_add_watch, 3, 3, 0, > #else > oflags |=3D O_NOFOLLOW; > #endif > - fd =3D emacs_open (SSDATA (file), oflags, 0); > + fd =3D emacs_open (SSDATA (encoded_file), oflags, 0); > if (fd =3D=3D -1) > report_file_error ("File cannot be opened", file); Thanks, let's see how far we go with this. > Btw, I don't think I understand the nature of the problem yet: where > were the unibyte strings shown in the report printed? Did some Emacs > code print them, and if so, where is that code? Same question here. Looks like the OP has added some prints to the code. In Emacs 27.0.50, we have file-notify-debug, which does it for us when set to t. But this is Emacs 26.3.50, that's why I have asked to activate the relevant debug message manually. Best regards, Michael.