Subject: Re: bug#55386: 29.0.50; check-declare-directory doesn't work on Windows

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 May 2022 19:43:36 +0300

> Cc: [email-masked]
> From: Lars Ingebrigtsen <[email-masked]>
> Date: Thu, 12 May 2022 17:57:01 +0200
> 
> > Debugger entered--Lisp error: (file-error "Opening input file" "Invalid argument" "c:/Users/yasu/ファイルが見つかりません - \"^[ \11]*(declare-funct...")
> >   insert-file-contents("ファイルが見つかりません - \"^[ \11]*(declare-function\"")
> >   check-declare-scan("ファイルが見つかりません - \"^[ \11]*(declare-function\"")
> >   check-declare-files("ファイルが見つかりません - \"^[ \11]*(declare-function\"")
> >   apply(check-declare-files "ファイルが見つかりません - \"^[ \11]*(declare-function\"")
> 
> check-declare-directory is just a wrapper around `find', and I'm surprised
> that this even vaguely works on Windows:

Why are you surprised?

> (defun check-declare-directory (root)
> [...]
>   (let ((files (process-lines-ignore-status
>                 find-program root
>                 "-name" "*.el"
>                 "-exec" grep-program
>                 "-l" "^[ \t]*(declare-function" "{}" "+")))
> 
> If you run this "manually", what does it output?

Here, it produces a long list of *.el files.

The string "ファイルが見つかりません" translates from Japanese as
"File not found".  So I suspect the OP doesn't have a port of GNU Find
on Path before the Windows program of the same name (which does
something completely different), or maybe the version of Find or Grep
the OP has don't support non-ASCII characters encoded in the OP's
locale's codepage.

Basically, that command tries to tell us that some (or all) of the
files were not found.

I wonder whether it could be a good idea to replace the find/grep
command by something that traverses the files in Lisp, like
dired-do-search or somesuch?  This would resolve any problems with
file names and incompatible versions of Find and Grep.