WIMLIB_EXTRACT_FLAG_GLOB_PATHS affects non-glob paths

Comments, questions, bug reports, etc.
Post Reply
joveler
Posts: 11
Joined: Wed Jan 31, 2018 2:45 pm

WIMLIB_EXTRACT_FLAG_GLOB_PATHS affects non-glob paths

Post by joveler »

wimlib_extract_pathlist() and wimlib_extract_paths() are both capable of bulk extraction of files from wim.

With them, I want these behaviors in my application:
- Glob paths (with *, ?) not being matched is allowed.
- When non-glob paths (without *, ?) are not matched, error should be raised.

But it seems wimlib treats non-glob path as globs when WIMLIB_EXTRACT_FLAG_GLOB_PATHS is specified.
So if I turn on WIMLIB_EXTRACT_FLAG_STRICT_GLOB, wimlib will ignore error even if non-glob path did not match.

Does it intended?
If not, can options for these behaviors be added to wimlib?

Test Sample
For test, please use this ListFile with LZX.wim.

Code: Select all

/ABDE
*.exe
/Z.txt
There are no /Z.txt and *.exe in LZX.wim, and these are my test result.
When WIMLIB_EXTRACT_FLAG_STRICT_GLOB is not set on wimlib_extract_pathlist(), no errors are raised.
When WIMLIB_EXTRACT_FLAG_STRICT_GLOB is set on wimlib_extract_pathlist(), error is raised on *.exe.
What I want is to make wimlib report error not on *.exe, but on /Z.txt.
joveler
Posts: 11
Joined: Wed Jan 31, 2018 2:45 pm

Re: WIMLIB_EXTRACT_FLAG_GLOB_PATHS affects non-glob paths

Post by joveler »

To achieve this in current version of wimlib, I had to track wimlib's error messags from error_file.
After calling wimlib_extract_pathlist(), my application search for this sentence in newly added warning/error messages.

Code: Select all

[WARNING] No matches for path pattern "(.+)"
With these at least I was able to track which glob was not matched, and it serves as another solution to my previous post.
However this solution tends to fail if the warning sentence is changed (which is NOT anticipated to be not being changed), and that is why I wrote this post.
synchronicity
Site Admin
Posts: 473
Joined: Sun Aug 02, 2015 10:31 pm

Re: WIMLIB_EXTRACT_FLAG_GLOB_PATHS affects non-glob paths

Post by synchronicity »

But it seems wimlib treats non-glob path as globs when WIMLIB_EXTRACT_FLAG_GLOB_PATHS is specified.
This is intentional, because if wimlib is operating in case insensitive mode (the default on Windows, but it can also be enabled on other OS's) a path without wildcard characters, e.g. "/foo", can still match multiple files, e.g. "/foo", "/Foo", and "/FOO". Also even if you are doing the extraction to a case-insensitive filesystem (e.g. NTFS on Windows, unless you've disabled the ObCaseInsensitive registry setting) it's still possible to extract all those case-insensitively-matching files by using the WIMLIB_EXTRACT_FLAG_ALL_CASE_CONFLICTS flag (--include-invalid-names for wimlib-imagex).
With them, I want these behaviors in my application:
- Glob paths (with *, ?) not being matched is allowed.
- When non-glob paths (without *, ?) are not matched, error should be raised.
There could be a flag added to disable the "case only" globs, i.e. ones without any wildcard characters. But I'm not yet convinced that it's really needed. Did you consider just calling wimlib_extract_files() twice, once with the paths with wildcard characters and WIMLIB_EXTRACT_FLAG_GLOB_PATHS, and the other with the remaining paths and without any flags?
joveler
Posts: 11
Joined: Wed Jan 31, 2018 2:45 pm

Re: WIMLIB_EXTRACT_FLAG_GLOB_PATHS affects non-glob paths

Post by joveler »

Did you consider just calling wimlib_extract_files() twice, once with the paths with wildcard characters and WIMLIB_EXTRACT_FLAG_GLOB_PATHS, and the other with the remaining paths and without any flags?
I tried that solution before, and it indeed works. The reason for this request is I wanted to let user to use listfile in application, I feared I have to interprete listfile myself while wimlib's globbing algorithm can be changed later (like ab[xyz] support).
Post Reply