I use Shift+Ctrl+F to do `Find in Files`. It failed when there are filenames with some unicode characters.
I tried the `grep.exe` directly: ``` "C:\Program Files (x86)\Geany\bin\grep.exe" -nHIirF ring * grep: New folder/zhon??.txt: Invalid argument ``` The `??` are some unicode characters.
I tried another `grep.exe` shipped with Git on Windows: `"C:\Program Files\Git\usr\bin\grep.exe" -nHIirF ring *` This one works fine!
I guess Geany can simply use another version of `grep.exe`. (Maybe use the same version Git is using.) So `Find in Files` can work flawlessly on Windows?
I tried changing `PATH` to force Geany to use `C:\Program Files\Git\usr\bin\grep.exe`. `File in Files` works now. Just need to change the grep executable.
Does git grep solve #1229 as well?
Not sure. Is it related to symlink? I don't know how it's produced.
@cshu sorry that question should have been addressed to @eht16
(Note to self, don't comment on github and watch TV at the same time)
I can't comment and test this as I'm not at home for the next few days and so don't have access to a Windows systems.
@cshu it'd be cool if you'd like to test the #1229. Reproducing is simple: simple use the Find in Files dialog, choose some directory with sub directories in it and use a search term which should match some file in one of the sub directories. Ensure you have checked the option "Recurse in subfolders".
I reproduced the `recursive directory loop` warning.
And then tried forcing Geany to use git grep. It works without warning.
Yay. I would try to find the differences between the binaries, just for my curiosity.
@cshu great. Thanks for testing. When I'm back home, I'll check whether and how to include the grep binary from the Git Windows distribution.
The `grep` binary shipped with Git for Windows is from MSYS2 and hence it requires the MSYS2 libraries: ```sh $ ls -lh /c/tmp/git-grep/ total 4.9M -rwxr-xr-x 1 enrico None 210K Mar 11 2016 grep.exe -rwxr-xr-x 1 enrico None 3.3M Sep 9 09:38 msys-2.0.dll -rwxr-xr-x 1 enrico None 108K Apr 1 2016 msys-gcc_s-1.dll -rwxr-xr-x 1 enrico None 912K Nov 4 2014 msys-iconv-2.dll -rwxr-xr-x 1 enrico None 44K Mar 2 2016 msys-intl-8.dll -rwxr-xr-x 1 enrico None 282K Jan 20 2016 msys-pcre-1.dll ``` These are the required libraries for grep.exe and as you can see, it would require about 5 MB more space. Compared to the overall size of the Windows binaries and their dependencies, this is not that much. I'm not yet completely sure why the MSYS2 grep works that differently, maybe because it uses the MSYS2 path manipulation magic behind the scenes.
I tried to self-compile grep using the patch which is used by MSYS2 (https://github.com/Alexpux/MSYS2-packages/blob/master/grep/grep-2.23-msys2.p...) which "only" modifies the build environment but the resulting binary has the recursion problem again. So I assume there is something in the MSYS2 libraries which changes the behaviour of handling paths and their encodings.
After all the troubles we had with `grep` on Windows so far, I'm actually tempted to bundle the MSYS2 binary along with the necessary libraries. At least this would safe us from the ugly patching in #1237.
I'm actually tempted to bundle the MSYS2 binary along with the necessary libraries
The only "problem" I see that we would may be including two separate copies of `libiconv`, `libpcre` and maybe `libintl` since GLib already embeds these. IIRC, Glib build system has compile-time options to tell it whether to embed various libraries, so in theory "all" we would need to do is build both packages to use the same shared libs from Msys and there would be no "problem". Maybe Msys packages already do this?
In any case, I don't think it's a big deal, especially if we eventually re-write "Find in Files" to not use Grep but rather GIO async file-IO or what have you (I might work on this some day).
I don't think the two copies of the mentioned libraries will cause any troubles. Especially as the MSYS2 libraries are prefixed in their names. The other point about the GLib compile-time options might help but would require a complete new bunch of work as it would require us to compile GLib ourselves and to get it running with the MSYS2 libraries. I don't think it's worth the efforts compared to just include 5 more megabytes in the bundle.
Closed #1260.
This should be fixed now in Geany 1.29 (released today). We merged #1301 and the Windows installer has a `grep` version from the MSYS2 project bundled which seems to work fine with non-ASCII files and paths.
github-comments@lists.geany.org