Excluding such links may not be the expected behavior. In addition,
Microsoft's documentation for ImageX seems to be incorrect when it states
that ImageX excludes such links. Actually, it does not. So, for the
sake of consistency and also doing something that may more sense anyway,
just retain such links, but leave their targets as-is.
nondirectory files by default. Use the --no-replace option to get the
old behavior.
nondirectory files by default. Use the --no-replace option to get the
old behavior.
+ 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.
+
Added support for "WIMBoot" capture and extraction. See the
documentation for the new '--wimboot' option to wimcapture and wimapply
for more information.
Added support for "WIMBoot" capture and extraction. See the
documentation for the new '--wimboot' option to wimcapture and wimapply
for more information.
Set whether to fix targets of absolute symbolic links (reparse points in Windows
terminology) or not. When enabled (\fB--rpfix\fR), absolute symbolic links that
point inside the directory tree being captured will be adjusted to be absolute
Set whether to fix targets of absolute symbolic links (reparse points in Windows
terminology) or not. When enabled (\fB--rpfix\fR), absolute symbolic links that
point inside the directory tree being captured will be adjusted to be absolute
-relative to the root of the directory tree being captured. In addition,
-absolute symbolic links that point outside the directory tree being captured
-will be ignored and not be captured at all. When disabled (\fB--norpfix\fR),
-absolute symbolic links will be captured exactly as is.
+relative to the root of the directory tree being captured. When disabled
+(\fB--norpfix\fR), absolute symbolic links will be captured exactly as is.
.IP ""
The default behavior for \fB@IMAGEX_PROGNAME@ capture\fR is equivalent to
\fB--rpfix\fR. The default behavior for \fB@IMAGEX_PROGNAME@ append\fR will be
.IP ""
The default behavior for \fB@IMAGEX_PROGNAME@ capture\fR is equivalent to
\fB--rpfix\fR. The default behavior for \fB@IMAGEX_PROGNAME@ append\fR will be
* unsupported (e.g. an encrypted or device file). */
WIMLIB_SCAN_DENTRY_UNSUPPORTED,
* unsupported (e.g. an encrypted or device file). */
WIMLIB_SCAN_DENTRY_UNSUPPORTED,
- /** The file is an absolute symbolic link or junction
- * point and it is being excluded from capture because
- * it points outside of the capture directory and
- * reparse-point fixups are enabled. (Reparse point
- * fixups can be disabled by using the flag
- * ::WIMLIB_ADD_FLAG_NORPFIX.) */
- WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK,
-
/** The file is an absolute symbolic link or junction
* that points into the capture directory, and
* reparse-point fixups are enabled, so its target is
/** The file is an absolute symbolic link or junction
* that points into the capture directory, and
* reparse-point fixups are enabled, so its target is
* disabled with the flag ::WIMLIB_ADD_FLAG_NORPFIX.)
*/
WIMLIB_SCAN_DENTRY_FIXED_SYMLINK,
* disabled with the flag ::WIMLIB_ADD_FLAG_NORPFIX.)
*/
WIMLIB_SCAN_DENTRY_FIXED_SYMLINK,
+
+ /** Reparse-point fixups are enabled, but the file is an
+ * absolute symbolic link or junction that does
+ * <b>not</b> point into the capture directory, so its
+ * target is <b>not</b> being adjusted. */
+ WIMLIB_SCAN_DENTRY_NOT_FIXED_SYMLINK,
const wimlib_tchar *wim_target_path;
/** For ::WIMLIB_PROGRESS_MSG_SCAN_DENTRY and a status
const wimlib_tchar *wim_target_path;
/** For ::WIMLIB_PROGRESS_MSG_SCAN_DENTRY and a status
- * of @p WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK or @p
- * WIMLIB_SCAN_DENTRY_FIXED_SYMLINK, this is the target
- * of the absolute symbolic link or junction. */
+ * of @p WIMLIB_SCAN_DENTRY_FIXED_SYMLINK or @p
+ * WIMLIB_SCAN_DENTRY_NOT_FIXED_SYMLINK, this is the
+ * target of the absolute symbolic link or junction. */
const wimlib_tchar *symlink_target;
};
const wimlib_tchar *symlink_target;
};
/** Reparse-point fixups: Modify absolute symbolic links (or junction points,
* in the case of Windows) that point inside the directory being captured to
* instead be absolute relative to the directory being captured, rather than the
/** Reparse-point fixups: Modify absolute symbolic links (or junction points,
* in the case of Windows) that point inside the directory being captured to
* instead be absolute relative to the directory being captured, rather than the
- * current root; also exclude absolute symbolic links that point outside the
- * directory tree being captured.
*
* Without this flag, the default is to do this if WIM_HDR_FLAG_RP_FIX is set in
* the WIM header or if this is the first image being added.
*
* Without this flag, the default is to do this if WIM_HDR_FLAG_RP_FIX is set in
* the WIM header or if this is the first image being added.
imagex_printf(T("\nWARNING: Excluding unsupported file or directory\n"
" \"%"TS"\" from capture\n"), info->scan.cur_path);
break;
imagex_printf(T("\nWARNING: Excluding unsupported file or directory\n"
" \"%"TS"\" from capture\n"), info->scan.cur_path);
break;
- case WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK:
- imagex_printf(T("\nWARNING: Ignoring absolute symbolic link "
- "with out-of-tree target:\n"
- " \"%"TS"\" => \"%"TS"\"\n"
- " (Use --norpfix to capture "
- "absolute symbolic links as-is)\n"),
- info->scan.cur_path, info->scan.symlink_target);
- break;
case WIMLIB_SCAN_DENTRY_FIXED_SYMLINK:
/* Symlink fixups are enabled by default. This is
* mainly intended for Windows, which for some reason
* uses absolute junctions (with drive letters!) in the
* default installation. On UNIX-like systems, warn the
* user when fixing the target of an absolute symbolic
case WIMLIB_SCAN_DENTRY_FIXED_SYMLINK:
/* Symlink fixups are enabled by default. This is
* mainly intended for Windows, which for some reason
* uses absolute junctions (with drive letters!) in the
* default installation. On UNIX-like systems, warn the
* user when fixing the target of an absolute symbolic
- * link, so they know to disable this if they want.
- * (Although, more likely they will get the warning
- * about an absolute symbolic link with an out-of-tree
- * target first.) */
+ * link, so they know to disable this if they want. */
#ifndef __WIN32__
imagex_printf(T("\nWARNING: Adjusted target of "
"absolute symbolic link \"%"TS"\"\n"
#ifndef __WIN32__
imagex_printf(T("\nWARNING: Adjusted target of "
"absolute symbolic link \"%"TS"\"\n"
info->scan.cur_path);
#endif
break;
info->scan.cur_path);
#endif
break;
}
break;
case WIMLIB_PROGRESS_MSG_SCAN_END:
}
break;
case WIMLIB_PROGRESS_MSG_SCAN_END:
return 0;
case WIMLIB_SCAN_DENTRY_UNSUPPORTED:
case WIMLIB_SCAN_DENTRY_EXCLUDED:
return 0;
case WIMLIB_SCAN_DENTRY_UNSUPPORTED:
case WIMLIB_SCAN_DENTRY_EXCLUDED:
- case WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK:
case WIMLIB_SCAN_DENTRY_FIXED_SYMLINK:
case WIMLIB_SCAN_DENTRY_FIXED_SYMLINK:
+ case WIMLIB_SCAN_DENTRY_NOT_FIXED_SYMLINK:
if (!(params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE))
return 0;
}
if (!(params->add_flags & WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE))
return 0;
}
-unix_scan_symlink(struct wim_dentry **root_p, const char *full_path,
- int dirfd, const char *relpath,
+unix_scan_symlink(const char *full_path, int dirfd, const char *relpath,
struct wim_inode *inode, struct add_image_params *params)
{
char deref_name_buf[4096];
struct wim_inode *inode, struct add_image_params *params)
{
char deref_name_buf[4096];
if ((params->add_flags & WIMLIB_ADD_FLAG_RPFIX) &&
dest[0] == '/')
{
if ((params->add_flags & WIMLIB_ADD_FLAG_RPFIX) &&
dest[0] == '/')
{
/* RPFIX (reparse point fixup) mode: Change target of absolute
* symbolic link to be "absolute" relative to the tree being
* captured. */
/* RPFIX (reparse point fixup) mode: Change target of absolute
* symbolic link to be "absolute" relative to the tree being
* captured. */
- dest = unix_fixup_abslink(dest,
- params->capture_root_ino,
- params->capture_root_dev);
+ fixed_dest = unix_fixup_abslink(dest,
+ params->capture_root_ino,
+ params->capture_root_dev);
params->progress.scan.cur_path = full_path;
params->progress.scan.symlink_target = deref_name_buf;
params->progress.scan.cur_path = full_path;
params->progress.scan.symlink_target = deref_name_buf;
- if (dest) {
- /* Successfully fixed the link target. */
+ if (fixed_dest) {
+ /* Link points inside the tree being captured, so it was
+ * fixed. */
inode->i_not_rpfixed = 0;
inode->i_not_rpfixed = 0;
ret = do_capture_progress(params,
WIMLIB_SCAN_DENTRY_FIXED_SYMLINK,
NULL);
ret = do_capture_progress(params,
WIMLIB_SCAN_DENTRY_FIXED_SYMLINK,
NULL);
- /* Link points outside of the tree being captured.
- * Exclude it. */
- free_dentry(*root_p);
- *root_p = NULL;
- return do_capture_progress(params,
- WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK,
- NULL);
+ /* Link points outside the tree being captured, so it
+ * was not fixed. */
+ ret = do_capture_progress(params,
+ WIMLIB_SCAN_DENTRY_NOT_FIXED_SYMLINK,
+ NULL);
}
ret = wim_inode_set_symlink(inode, dest, params->lookup_table);
if (ret)
}
ret = wim_inode_set_symlink(inode, dest, params->lookup_table);
if (ret)
ret = unix_scan_directory(tree, full_path, full_path_len,
dirfd, relpath, params);
} else if (S_ISLNK(stbuf.st_mode)) {
ret = unix_scan_directory(tree, full_path, full_path_len,
dirfd, relpath, params);
} else if (S_ISLNK(stbuf.st_mode)) {
- ret = unix_scan_symlink(&tree, full_path, dirfd, relpath,
+ ret = unix_scan_symlink(full_path, dirfd, relpath,
* The path has an explicit length and is not necessarily null terminated.
*
* If the path just something like \??\e: then the returned pointer will point
* The path has an explicit length and is not necessarily null terminated.
*
* If the path just something like \??\e: then the returned pointer will point
- * just past the colon; in this case the length of the result will be 0
+ * just past the colon. In this case the length of the result will be 0
* characters. */
static const wchar_t *
get_device_relative_path(const wchar_t *path, size_t path_nchars)
* characters. */
static const wchar_t *
get_device_relative_path(const wchar_t *path, size_t path_nchars)
/* Reparse point fixup status code */
enum rp_status {
/* Reparse point fixup status code */
enum rp_status {
- /* Reparse point should be excluded from capture */
- RP_EXCLUDED = -0,
-
/* Reparse point will be captured literally (no fixup) */
RP_NOT_FIXED = -1,
/* Reparse point will be captured literally (no fixup) */
RP_NOT_FIXED = -1,
capture_root_ino,
capture_root_dev);
if (!rel_target) {
capture_root_ino,
capture_root_dev);
if (!rel_target) {
- /* Target points outside of the tree being captured. Exclude
- * this reparse point from the capture (but inform the library
- * user). */
+ /* Target points outside of the tree being captured. Don't
+ * adjust it. */
ret = winnt_rpfix_progress(params, path, &rpdata,
ret = winnt_rpfix_progress(params, path, &rpdata,
- WIMLIB_SCAN_DENTRY_EXCLUDED_SYMLINK);
+ WIMLIB_SCAN_DENTRY_NOT_FIXED_SYMLINK);
}
if (rel_target == rpdata.substitute_name) {
}
if (rel_target == rpdata.substitute_name) {
* On success, the length of the reparse point buffer in bytes is written
* to this location.
*
* On success, the length of the reparse point buffer in bytes is written
* to this location.
*
- * On success, returns a nonpositive `enum rp_status' value.
+ * On success, returns a negative `enum rp_status' value.
* On failure, returns a positive error code.
*/
static int
* On failure, returns a positive error code.
*/
static int
ret = winnt_get_reparse_data(h, full_path, params,
rpbuf, &rpbuflen);
switch (ret) {
ret = winnt_get_reparse_data(h, full_path, params,
rpbuf, &rpbuflen);
switch (ret) {
- case RP_EXCLUDED:
- ret = 0;
- goto out;
case RP_FIXED:
not_rpfixed = 0;
break;
case RP_FIXED:
not_rpfixed = 0;
break;
error "imagex capture --rpfix failed to fix absolute link to capture root"
fi
error "imagex capture --rpfix failed to fix absolute link to capture root"
fi
-if [[ -e out.dir/absnonexistent ]] ||
- [[ -e out.dir/absoutoftree ]]; then
- error "imagex capture --rpfix failed to exclude out of tree absolute links"
+if [[ ! -L out.dir/absnonexistent ]] ||
+ [[ ! -L out.dir/absoutoftree ]]; then
+ error "imagex capture --rpfix failed to also capture out of tree absolute links"
fi
if [[ `readlink out.dir/relalink` != "file" ]]; then
error "imagex capture --rpfix failed to capture relative symlink"
fi
if [[ `readlink out.dir/relalink` != "file" ]]; then
error "imagex capture --rpfix failed to capture relative symlink"
md in.dir\r
cd in.dir\r
\r
md in.dir\r
cd in.dir\r
\r
-echo Testing rpfix exclude\r
-mklink otherlink c:\some\other\directory > nul\r
-cd ..\r
-%WIMLIB_IMAGEX% capture in.dir test.wim > nul\r
-%WIMLIB_IMAGEX% apply test.wim out.dir > nul\r
-rd out.dir\r
-if %errorlevel% neq 0 exit /b %errorlevel%\r
-rd /s /q in.dir\r
-md in.dir\r
-cd in.dir\r
-\r
echo Testing rpfix relative\r
echo 1 > file\r
mklink relink file > nul\r
echo Testing rpfix relative\r
echo 1 > file\r
mklink relink file > nul\r