ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Jom on March 19, 2020, 03:04:41 AM

Title: Win32::FindFile
Post by: Jom on March 19, 2020, 03:04:41 AM
Hello, Phill.

I can't make friendship ExifTool with  files that use Cyrillic in their names.
I found that it depends on Win32:: Find File.
Unfortunately, I have this.

PS F:\> cpanm install Win32::FindFile                                                         --> Working on install
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/install-0.01.tar.gz ... OK
Configuring install-0.01 ... OK
Building and testing install-0.01 ... OK
Successfully installed install-0.01
--> Working on Win32::FindFile
Fetching http://www.cpan.org/authors/id/G/GR/GRIAN/Win32-FindFile-0.15.tar.gz ... OK
Configuring Win32-FindFile-0.15 ... OK
Building and testing Win32-FindFile-0.15 ... FAIL
! Installing Win32::FindFile failed. See C:\Users\andrei\.cpanm\work\1584600456.9600\build.log for details. Retry with --force to force install it.
1 distribution installed
PS F:\> exiftool -ver -v5                                                                     ExifTool version 11.91
Perl version 5.030002 (-C0)
Platform: MSWin32
Optional libraries:
  Archive::Zip                 1.68
  Compress::Zlib               2.093
  Digest::MD5                  2.55
  Digest::SHA                  6.02
  IO::Compress::Bzip2          2.093
  Time::Piece                  1.34
  Unicode::LineBreak           2019.001
  IO::Compress::RawDeflate     2.093
  IO::Uncompress::RawInflate   2.093
  Win32::API                   0.84
  Win32::FindFile              (not installed)
  Win32API::File               0.1203
Include directories:
  E:\software\ExifTool/lib
  C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
  C:/Strawberry/perl/site/lib
  C:/Strawberry/perl/vendor/lib
  C:/Strawberry/perl/lib


I also found everything about Win32:: FindFile on the forum and came to the conclusion that ExifTool can no longer be used with non-Latin file names on Windows.

Please tell me, Phil, do I understand the situation correctly, or is there something I can do that I haven't been able to find out?
Title: Re: Win32::FindFile
Post by: gnfalex on March 19, 2020, 05:10:46 AM
Greetings, Andrei Korzhyts
Did You tried "-charset  CP1251 -charset filename=CP1251"? It's works for me...
Best Regards.
Title: Re: Win32::FindFile
Post by: Jom on March 19, 2020, 05:29:22 AM
Quote from: gnfalex on March 19, 2020, 05:10:46 AM
Greetings, Andrei Korzhyts
Did You tried "-charset  CP1251 -charset filename=CP1251"? It's works for me...
Best Regards.

Hello, gnfalex

Please tell me more detail what kind of terminal and command shell you use, and the command you enter?
I use PowerShell 5.1 and enter:

PS F:\> $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
>>
PS F:\> exiftool -charset  CP1251 -charset filename=CP1251 .\Фото.CR2
No matching files


Title: Re: Win32::FindFile
Post by: Phil Harvey on March 19, 2020, 07:30:04 AM
Maybe try the --force option when installing Win32::FindFile.  It could have failed some test that wouldn't be a problem for ExifTool.

- Phil
Title: Re: Win32::FindFile
Post by: gnfalex on March 19, 2020, 08:33:20 AM
Sorry, i can't install PowerShell 5.1 - only 2.0. In 2.0 it's work without any additional commands...
I preffer cmd - and command look like "perl windows_exiftool -charset cp1251 -charset filename=cp1251 -filename -csv тест*.*"
AFAIK - "[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding" - changing codepages to UTF-8.
Please check "-charset  UTF8 -charset filename=CP1251".
You can also check encoding with Sysinternals Process Monitor - filter by "cr2" and find what filename it try to read.

Quote from: Andrei Korzhyts on March 19, 2020, 05:29:22 AM
Please tell me more detail what kind of terminal and command shell you use, and the command you enter?
I use PowerShell 5.1 and enter:
PS F:\> $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
>>
PS F:\> exiftool -charset  CP1251 -charset filename=CP1251 .\Фото.CR2
No matching files

Title: Re: Win32::FindFile
Post by: Jom on March 19, 2020, 08:41:13 AM
Quote from: Phil Harvey on March 19, 2020, 07:30:04 AM
Maybe try the --force option when installing Win32::FindFile.  It could have failed some test that wouldn't be a problem for ExifTool.

- Phil

Yes, I've seen it and tried it. It doesn't help.

I've already done thousands of different experiments. Difficulties not only with file names, but also with tag values in Cyrillic. I tried PowerShell 5.1, cmd.exe, PowerShell 7 — nothing works. I tried different ways to change the encoding for them, but still the broken data reaches ExifTool. This happens somewhere between the terminal and ExifTool.

It is easier to migrate your process to Unix than to configure it on Windows.

But I got one way. If I access ExifTool via Perl (past PowerShell, etc.),

metadata.pl
system('exiftool -exif:copyright="(CCCC)© АндRei КорZhyts" -xmp-dc:rights="(C)© АндRei КорZhyts" -ext cr2 .');

perl metadata.pl

I can write data in Cyrillic, but the file names in Russian still don't reach ExifTool.

Now even Win32:: FindFile is not installed.
I want to know if Win32:: FindFile is still supported or not?
I can't understand it. It's a pity if this was the only way to read file names in Cyrillic.
Title: Re: Win32::FindFile
Post by: Jom on March 19, 2020, 09:49:56 AM
exiftool -charset  UTF8 -charset filename=CP1251 -exif:copyright="(C)© АндRei КорZhyts" -xmp-dc:rights="(C)© АндRei КорZhyts" Фото.cr2

No. It doesn't help.
This is somewhere at the Windows level, maybe at the .NET level...
I'll have to spend some time trying to figure out how it works in Windows.
I'm sure there is a solution, but it's all so confusing
Title: Re: Win32::FindFile
Post by: Phil Harvey on March 19, 2020, 09:59:59 AM
Win32::FindFile is distributed from here (https://metacpan.org/pod/Win32::FindFile).  The latest version is from 2014, and has passed tests on 14 systems, but failed on 22 (http://www.cpantesters.org/distro/W/Win32-FindFile.html). :(

- Phil
Title: Re: Win32::FindFile
Post by: Jom on March 19, 2020, 10:26:21 AM
What happened? Why supporting was stopped? Anybody know about it?
I see ExifTool still offers to install it. Why?
Title: Re: Win32::FindFile
Post by: Phil Harvey on March 19, 2020, 11:10:58 AM
Quote from: Andrei Korzhyts on March 19, 2020, 10:26:21 AM
What happened? Why supporting was stopped? Anybody know about it?

You would have to ask the author.

QuoteI see ExifTool still offers to install it. Why?

I don't know of any alternatives.

- Phil
Title: Re: Win32::FindFile
Post by: obetz on March 20, 2020, 03:50:58 AM
Quote from: Andrei Korzhyts on March 19, 2020, 10:26:21 AM
What happened? Why supporting was stopped? Anybody know about it?
I see ExifTool still offers to install it. Why?

I described the problem and a solution in https://exiftool.org/forum/index.php?topic=10135.msg52996#msg52996

Even the delivery of mails to the "maintainer" of Win32::FindFile "grian" fails.

Nobody seems to be interested to fix this long known error (see https://rt.cpan.org/Public/Dist/Display.html?Name=Win32-FindFile) in the automated test.

Really sad.

Oliver
Title: Re: Win32::FindFile
Post by: Jom on March 20, 2020, 05:38:53 AM
DST is always disabled initially — in my country, there are no transitions to winter and summer time.
On my computer, I still can't use ExifTool with non-Latin file names. Win32::FindFile also can't install in any way. If everything depends only on Win32::Find File, then it is probably not worth trying to solve this problem anymore. Just use only the Latin alphabet in the file names... And this is correct, so as not to depend on such situations.
Title: Re: Win32::FindFile
Post by: obetz on March 20, 2020, 06:14:51 AM
Andrei, thanks for the information.

Would you mind to check the logs which error kept Win32::FindFile from installing?

After all, you can use my Strawberry Perl based package containing also Win32::FindFile.

Oliver
Title: Re: Win32::FindFile
Post by: Phil Harvey on March 20, 2020, 06:52:44 AM
Quote from: Andrei Korzhyts on March 20, 2020, 05:38:53 AM
Win32::FindFile also can't install in any way.

You should be able to download the package from metapan then do this:

perl Makefile.PL
make install


It is not necessary to pass the tests before installing.

- Phil
Title: Re: Win32::FindFile
Post by: Jom on March 20, 2020, 07:30:58 AM
Which folder should I download the package to?
Somewhere inside the Strawberry folder?
Title: Re: Win32::FindFile
Post by: Phil Harvey on March 20, 2020, 08:54:53 AM
It doesn't matter.  The "make install" step will put it where it needs to go.

- Phil
Title: Re: Win32::FindFile
Post by: Jom on March 20, 2020, 09:58:08 AM
Thanks for the answers, but I don't understand anything already. I do everything as you had wrote, but there is no result. Am I doing something wrong? Or is it just because of Windows... I understand, probably, not worth hoping for a solution, but if someone has any thoughts, thank you.

PS E:\_\Win32-FindFile-0.15> perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for Win32::FindFile
Writing MYMETA.yml and MYMETA.json
PS E:\_\Win32-FindFile-0.15> make install
Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation. All rights reserved.

E:\_\Win32-FindFile-0.15>exiftool -ver -v5
ExifTool version 11.91
Perl version 5.030002 (-C0)
Platform: MSWin32
Optional libraries:
  Archive::Zip                 1.68
  Compress::Zlib               2.093
  Digest::MD5                  2.55
  Digest::SHA                  6.02
  IO::Compress::Bzip2          2.093
  Time::Piece                  1.34
  Unicode::LineBreak           2019.001
  IO::Compress::RawDeflate     2.093
  IO::Uncompress::RawInflate   2.093
  Win32::API                   0.84
  Win32::FindFile              (not installed)
  Win32API::File               0.1203
Include directories:
  E:\software\ExifTool/lib
  C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
  C:/Strawberry/perl/site/lib
  C:/Strawberry/perl/vendor/lib
  C:/Strawberry/perl/lib
Title: Re: Win32::FindFile
Post by: Phil Harvey on March 20, 2020, 10:03:51 AM
Odd.  I'm sure this is how I installed this on my virtual Windows 10 machine.  I used "nmake", but that shouldn't make a difference.  I would have also run "nmake" before "nmake install", but I thought this wasn't necessary.

- Phil
Title: Re: Win32::FindFile
Post by: Jom on March 20, 2020, 10:56:25 AM
Quote from: obetz on March 20, 2020, 06:14:51 AM
Would you mind to check the logs which error kept Win32::FindFile from installing?

Thanks, Oliver.  Log is attached.

Quote from: obetz on March 20, 2020, 06:14:51 AM
After all, you can use my Strawberry Perl based package containing also Win32::FindFile.

Thank you, but I want to understand this by myself also.
But I'm interested, had you made this Strawberry Perl based package for your own personal purposes? Why had you made this package? What is it package?
Title: Re: Win32::FindFile
Post by: Jom on March 20, 2020, 11:22:33 AM
From README for Win32-FindFile

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install



Probably, all is bad.

Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation. All rights reserved.

e:\_\Win32-FindFile-0.15>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for Win32::FindFile
Writing MYMETA.yml and MYMETA.json

e:\_\Win32-FindFile-0.15>make
Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation. All rights reserved.

e:\_\Win32-FindFile-0.15>make test
make[1]: Entering directory `/e/_/Win32-FindFile-0.15'
Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation. All rights reserved.

e:\_\Win32-FindFile-0.15>make install
make[2]: Entering directory `/e/_/Win32-FindFile-0.15'
Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation. All rights reserved.

e:\_\Win32-FindFile-0.15>make install -force
make[3]: Entering directory `/e/_/Win32-FindFile-0.15'
make[3]: orce: No such file or directory
make[3]: *** No rule to make target `orce'.  Stop.
make[3]: Leaving directory `/e/_/Win32-FindFile-0.15'
Title: Re: Win32::FindFile
Post by: obetz on March 23, 2020, 11:00:23 AM
Quote from: Andrei Korzhyts on March 20, 2020, 10:56:25 AM
Thanks, Oliver.  Log is attached.

this is not the DST error I mentioned. It doesn't even compile as far as I see.

Maybe you are using the wrong make.exe: Strawberry Perl comes with a gmake.exe, but you typed "make" instead.

What says "make --version" on your system?

Did you set the path correctly, e.g. by running portableshell.bat?

I see references to c:\mingw in your logfile. Strawberry Perl comes with it's own compiler in the strawberry Perl directory tree, so an external mingw seems to be wrong.

Quote from: Andrei Korzhyts on March 20, 2020, 10:56:25 AM
But I'm interested, had you made this Strawberry Perl based package for your own personal purposes? Why had you made this package? What is it package?

I hope I described this in detail on https://oliverbetz.de/pages/Artikel/ExifTool-for-Windows and https://oliverbetz.de/pages/Artikel/Portable-Perl-Applications

tl;dr: Make a clean, robust and liberally licensed ExifTool for Windows.

Oliver

P.S.: I was able to install Win32::File with 5.30.2.1 here.
Title: Re: Win32::FindFile
Post by: Jom on March 23, 2020, 02:42:25 PM
QuoteWhat says "make --version" on your system?

f:\>make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-msys
Title: Re: Win32::FindFile
Post by: obetz on March 23, 2020, 02:58:42 PM
that's not the version shipped with Strawberry Perl (but it should work).

I suggest to check your path settings. Be sure to use compiler and tools from the Strawberry Perl distribution.

Look at portableshell.bat
Title: Re: Win32::FindFile
Post by: Jom on March 23, 2020, 03:05:51 PM
QuoteLook at portableshell.bat

What it is file?
Title: Re: Win32::FindFile
Post by: obetz on March 23, 2020, 03:13:30 PM
for some reason I don't remember, I supposed you are using the portable edition of Strawberry Perl which comes with portableshell.bat setting the path variable:


[...]
set PATH=%~dp0perl\site\bin;%~dp0perl\bin;%~dp0c\bin;%PATH%
[...]


Having multiple compilers in the path variable gives unpredictable results.
Title: Re: Win32::FindFile
Post by: Jom on March 24, 2020, 08:56:59 AM
Thank you all for your help.

It was the compiler. I used the MinGW compiler (I had it over Strawberry Perl in the environment variable) and so it ran.

I deleted MinGW,
reinstalled Strawberry Perl,
and placed the path to the gmake.exe compiler is higher than other program paths.

Everything turned out as in the instructions, but I wrote gmake instead of make.

What different between gmake and make?


QuoteHaving multiple compilers in the path variable gives unpredictable results.
This is if you don 't know that you have in your environment variable "Path".
Will starting the compiler that is the first in the string of "Path".
I like to control it manually.
Title: Re: Win32::FindFile
Post by: obetz on March 24, 2020, 09:50:10 AM
Quote from: Andrei Korzhyts on March 24, 2020, 08:56:59 AM
I deleted MinGW,
reinstalled Strawberry Perl,
and placed the path to the gmake.exe compiler is higher than other program paths.

deleting /resinstalling was not necessary just to modify the path variable.

Quote from: Andrei Korzhyts on March 24, 2020, 08:56:59 AM
What different between gmake and make?

the name.

Quote from: Andrei Korzhyts on March 24, 2020, 08:56:59 AM
QuoteHaving multiple compilers in the path variable gives unpredictable results.
This is if you don 't know that you have in your environment variable "Path".

Using Perl and Mingw is not trivial.