Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with file mask #2633

Closed
megadalp opened this issue May 19, 2023 · 6 comments
Closed

Bug with file mask #2633

megadalp opened this issue May 19, 2023 · 6 comments
Labels

Comments

@megadalp
Copy link

Describe the bug

Version

exiv2 -V
exiv2 0.28.0

It is not possible to specify a file mask.

To Reproduce

Check files:

ls -1 1/*.jpg
1/IMG20230506184919.jpg
1/IMG20230506184935.jpg
1/IMG_20230505_175906_596.jpg
1/IMG_20230505_180827.jpg
1/IMG_20230507_110733_631.jpg
1/IMG_20230507_111634.jpg
1/IMG_20230507_133357_288.jpg

Not working:

exiv2 print 1/*.jpg
1/*.jpg: Failed to open the file

For a specific filename everything works:
exiv2 print 1/IMG20230506184919.jpg

Desktop (please complete the following information):

  • OS and version: Windows 10
  • Exiv2 version and source: 0.28.0 from exiv2.org, windows binary

Additional context

in version 0.25 it still worked, it broke since version 0.27.7

@megadalp megadalp added the bug label May 19, 2023
@neheb
Copy link
Collaborator

neheb commented May 20, 2023

You can probably work around with

exiv2 print $(ls -1 1/*.jpg)

@postscript-dev
Copy link
Collaborator

postscript-dev commented May 25, 2023

@megadalp
I tried to recreate your problem. I used Windows 11 and exiv2-0.28.0-2019msvc64.zip/exiv2-0.27.7-2019msvc64.zip versions downloaded from https://exiv2.org/download.html . I created a similar directory with 5 well-formed JPEGs and ran the same command as your above example.

When I used Windows' cmd.exe, I received the same error as you. I then repeated the same test with the same binaries using MSYS2 (ucrt64) and this time it worked! In the MSYS2 command line, I used / instead of \.

For cmd.exe, in

exiv2/src/futils.cpp

Lines 225 to 230 in 22b65cc

bool fileExists(const std::string& path) {
if (fileProtocol(path) != pFile) {
return true;
}
return fs::exists(path);
}

fs::exists(path); returns false. https://en.cppreference.com/w/cpp/filesystem/exists states:

No filesystem exception is thrown if object does not exist (use return value).

but this doesn't explain the problem. I am sorry but I don't have more time to look into this. @neheb do you have any thoughts?

@neheb
Copy link
Collaborator

neheb commented May 25, 2023

No real idea. I know std::filesystem differs between MSVC and GCC but that's about it.

For the MSYS2 case, I'm pretty sure the shell takes care of expanding *.

@kmilos
Copy link
Collaborator

kmilos commented May 25, 2023

For the MSYS2 case, I'm pretty sure the shell takes care of expanding *.

Yep, cmd.exe shell doesn't do gobbing like the regular *nix bash used by MSYS2 or even PowerShell...

It says Windows commands themselves must implement the globbing - I don't think exiv2 did something specific like this for Windows, ever?

@postscript-dev
Copy link
Collaborator

@kmilos

It says Windows commands themselves must implement the globbing - I don't think exiv2 did something specific like this for Windows, ever?

I repeated the same test with exiv2-0.27.5-2019msvc64.zip and it didn't work for me. Perhaps the user had used this version with a different OS.

@neheb
Copy link
Collaborator

neheb commented Jul 20, 2023

Closing this. There's no bug here.

@neheb neheb closed this as completed Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants