From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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 20:25:02 +0200 Message-ID: <83imnez9q9.fsf@gnu.org> References: <87y2wa7bl3.fsf@gmx.de> <83pnhmzc16.fsf@gnu.org> <875zje780h.fsf@gmx.de> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="77923"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38287@debbugs.gnu.org, netjune@outlook.com To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 20 19:30:28 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 1iXUkF-000K7y-So for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Nov 2019 19:30:28 +0100 Original-Received: from localhost ([::1]:33386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXUkD-00019w-Vf for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Nov 2019 13:30:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37095) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXUfz-0003GC-3h for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:26:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXUfy-00085M-2F for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:26:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42054) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXUfx-00085I-V1 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iXUfx-0005sz-PZ for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2019 13:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Nov 2019 18:26: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.157427430722555 (code B ref 38287); Wed, 20 Nov 2019 18:26:01 +0000 Original-Received: (at 38287) by debbugs.gnu.org; 20 Nov 2019 18:25:07 +0000 Original-Received: from localhost ([127.0.0.1]:50875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXUf1-0005rf-6R for submit@debbugs.gnu.org; Wed, 20 Nov 2019 13:25:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXUey-0005r8-RI for 38287@debbugs.gnu.org; Wed, 20 Nov 2019 13:25:01 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iXUet-0007ok-E5; Wed, 20 Nov 2019 13:24:55 -0500 Original-Received: from [176.228.60.248] (port=2179 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iXUes-0004tg-SS; Wed, 20 Nov 2019 13:24:55 -0500 In-reply-to: <875zje780h.fsf@gmx.de> (message from Michael Albinus on Wed, 20 Nov 2019 18:49:34 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:172068 Archived-At: > From: Michael Albinus > Cc: netjune@outlook.com, 38287@debbugs.gnu.org > Date: Wed, 20 Nov 2019 18:49:34 +0100 > > > The strings shown in the image are UTF-8 encoded. > > 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, Skqueue_add_watch, 3, 3, 0, } /* Open file. */ - file = ENCODE_FILE (file); + Lisp_Object encoded_file = ENCODE_FILE (file); oflags = O_NONBLOCK; #if O_EVTONLY oflags |= O_EVTONLY; @@ -426,7 +426,7 @@ DEFUN ("kqueue-add-watch", Fkqueue_add_watch, Skqueue_add_watch, 3, 3, 0, #else oflags |= O_NOFOLLOW; #endif - fd = emacs_open (SSDATA (file), oflags, 0); + fd = emacs_open (SSDATA (encoded_file), oflags, 0); if (fd == -1) report_file_error ("File cannot be opened", file); 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?