all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 38287@debbugs.gnu.org, netjune@outlook.com
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	[thread overview]
Message-ID: <87imne5qus.fsf@gmx.de> (raw)
In-Reply-To: <83imnez9q9.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Nov 2019 20:25:02 +0200")

Eli Zaretskii <eliz@gnu.org> 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, 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);

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.





  reply	other threads:[~2019-11-20 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aeef7181-2c14-4b93-90fd-dd71993ed3c8@Spark>
2019-11-20  3:50 ` bug#38287: 26.3.50; filenotify.el: the Chinese file name in the event is messy code HaiJun Zhang
2019-11-20 16:32   ` Michael Albinus
2019-11-20 17:35     ` Eli Zaretskii
2019-11-20 17:49       ` Michael Albinus
2019-11-20 18:25         ` Eli Zaretskii
2019-11-20 18:45           ` Michael Albinus [this message]
2019-11-21  0:35           ` HaiJun Zhang
2019-11-21  2:33           ` HaiJun Zhang
2019-11-21 14:42             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imne5qus.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=38287@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=netjune@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.