[iso] count Rock Ridge duplicated files into the total size to process

* Duplicated symlinked Rock Ridge files were not counted into the total size needed
  to process the image and as a result, progress could go over 100% when extracting
  data (e.g. debian-live-12.1.0-amd64-lxqt.iso).
* Fix this by adding the duplicated files twice in the total block size.
This commit is contained in:
Pete Batard 2023-09-23 17:07:55 +01:00
parent 1fc790295c
commit 8859c59548
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
2 changed files with 16 additions and 7 deletions

View File

@ -708,7 +708,8 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
EXTRACT_PROPS props;
BOOL is_symlink, is_identical, free_p_statbuf = FALSE;
int length, r = 1;
char tmp[128], psz_fullpath[MAX_PATH], *psz_basename = NULL, *psz_sanpath = NULL;
char psz_fullpath[MAX_PATH], *psz_basename = NULL, *psz_sanpath = NULL;
char tmp[128], target_path[256];
const char *psz_iso_name = &psz_fullpath[strlen(psz_extract_dir)];
unsigned char buf[ISO_BLOCKSIZE];
CdioListNode_t* p_entnode;
@ -792,6 +793,15 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
} else {
file_length = p_statbuf->total_size;
if (check_iso_props(psz_path, file_length, psz_basename, psz_fullpath, &props)) {
// Add symlink duplicated files to total_size at scantime
if (is_symlink && (file_length == 0) && (strcmp(psz_path, "/firmware") == 0)) {
static_sprintf(target_path, "%s/%s", psz_path, p_statbuf->rr.psz_symlink);
iso9660_stat_t *p_statbuf2 = iso9660_ifs_stat_translate(p_iso, target_path);
if (p_statbuf2 != NULL) {
total_blocks += (p_statbuf2->total_size + ISO_BLOCKSIZE - 1) / ISO_BLOCKSIZE;
iso9660_stat_free(p_statbuf2);
}
}
continue;
}
if (!is_symlink)
@ -822,7 +832,6 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
} else if (strcmp(psz_path, "/firmware") == 0) {
// Special handling for ISOs that use symlinks for /firmware/ (e.g. Debian non-free)
// TODO: Do we want to do this for all file symlinks?
char target_path[256];
static_sprintf(target_path, "%s/%s", psz_path, p_statbuf->rr.psz_symlink);
p_statbuf = iso9660_ifs_stat_translate(p_iso, target_path);
if (p_statbuf != NULL) {

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.3.2083"
CAPTION "Rufus 4.3.2084"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,2083,0
PRODUCTVERSION 4,3,2083,0
FILEVERSION 4,3,2084,0
PRODUCTVERSION 4,3,2084,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.3.2083"
VALUE "FileVersion", "4.3.2084"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.3.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.3.2083"
VALUE "ProductVersion", "4.3.2084"
END
END
BLOCK "VarFileInfo"