Page 1 of 1

Option --rpfix not working on wimapply

Posted: Tue Dec 17, 2024 12:47 pm
by wimzzy
Here's the test I did (I also tested on a Windows machine and behavior was similar)

I had this folder:

Code: Select all

/Users/test/folder
├── Books -> /Users/test/folder/school/textbooks
├── Public -> /Users/Shared/pubdir
└── school
    └── textbooks
        └── book1.txt
I created two .wim files then applied them in upper directory:

Code: Select all

$ wimcapture folder folder_rpfixcap.wim --rpfix
$ wimcapture folder folder_norpfixcap.wim --norpfix
$ wimapply folder_rpfixcap.wim 1 /Users/folder_rpfixcap_rpfixapp --rpfix
$ wimapply folder_rpfixcap.wim 1 /Users/folder_rpfixcap_norpfixapp --norpfix
$ wimapply folder_norpfixcap.wim 1 /Users/folder_norpfixcap_rpfixapp --rpfix
$ wimapply folder_norpfixcap.wim 1 /Users/folder_norpfixcap_norpfixapp --norpfix
Here is how the symlinks/reparse points change:

Code: Select all

/Users/folder_rpfixcap_rpfixapp
├── Books -> /Users/folder_rpfixcap_rpfixapp/school/textbooks
├── Public -> /Users/Shared/pubdir
└── school
    └── textbooks
        └── book1.txt

/Users/folder_rpfixcap_norpfixapp
├── Books -> /school/textbooks
├── Public -> /Users/Shared/pubdir
└── school
    └── textbooks
        └── book1.txt

/Users/folder_norpfixcap_rpfixapp
├── Books -> /Users/test/folder/school/textbooks
├── Public -> /Users/Shared/pubdir
└── school
    └── textbooks
        └── book1.txt

/Users/folder_norpfixcap_norpfixapp
├── Books -> /Users/test/folder/school/textbooks
├── Public -> /Users/Shared/pubdir
└── school
    └── textbooks
        └── book1.txt
I have two observations that I couldn't make sense of from the man pages:
1. It seems like Reparse Points that point outside the directory are still captured, unlike DISM: "If /NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile will not be captured." It's pretty cool that wimlib seems to do this even with --rpfix but is there documentation for this anywhere? I could not find mention of this.
2. It seems like wimapply --rpfix on a wimage captured with wimcapture --norpfix does NOT have any effect on the reparse points. Is this correct? I initially expected (and wanted!) it to fix the reparse point that was originally pointing inside the tree being captured to now point inside (to /Users/folder_norpfixcap_rpfixapp/school/textbooks), but instead it is unchanged and so now points outside (to /Users/test/folder/school/textbooks) to the original.

Windows observation:
wimapply --norpfix after a wimcapture --rpfix shows the drive letter "X:" prepended to the Books reparse point, is this a Windows or a wimlib thing? It confused me a bit!

My requests:
1. Would it be a good idea to document these observations/cases?
2. Would it be possible for wimapply --rpfix on non-fixed captures to fix the reparse point to be inside the tree? Or have a new flag to do so like --forcerpfix or something?

Sorry, if this post comes off strange or nitpicky, I rarely post on forums so I hope this was formatted properly and in line, my use case for this is to back up a bunch of partitions from different devices and being able to apply the the images to be properly bootable and I was confused if I should use --rpfix or --norpfix

Re: Option --rpfix not working on wimapply

Posted: Fri Dec 20, 2024 12:43 am
by synchronicity
> 1. It seems like Reparse Points that point outside the directory are still captured, unlike DISM: "If /NoRpFix is not specified, reparse points that resolve to paths outside of the value specified by /ImageFile will not be captured." It's pretty cool that wimlib seems to do this even with --rpfix but is there documentation for this anywhere? I could not find mention of this.

This difference vs. DISM doesn't seem to be mentioned in wimlib's documentation, but the DISM behavior where it just throws your files away seems wrong.

> 2. It seems like wimapply --rpfix on a wimage captured with wimcapture --norpfix does NOT have any effect on the reparse points. Is this correct?

Yes, this is correct and is documented: "When enabled (--rpfix), extracted absolute symbolic links that are marked in the WIM image as being fixed are assumed to have absolute targets relative to the image root, and therefore wimapply prepends the absolute path to the extraction target directory to their targets." So only links that were "fixed" during capture get changed again during apply. If a link wasn't "fixed" previously, then it is not clear whether it is intended to point into the image or not.

Re: Option --rpfix not working on wimapply

Posted: Sat Dec 21, 2024 9:28 pm
by wimzzy
Aha! I found that behavior in NEWS.md https://wimlib.net/git/?p=wimlib;a=blob ... edd42#l621 , posting it here in case anyone sees it:

Code: Select all

## Version 1.7.0
...
- In reparse-point fixup mode (the default for capture), symbolic links and
  junctions that point outside the tree being captured are no longer excluded
  from capture.
but thank you for confirming it! Seems like --rpfix is the way to go for "clone" backups to ensure the root is being applied correctly and the tree is preserved as-is, ( : thank you for your response!