Improved warning messages about symbolic links and special files in ISO 9660:1999 tree

This commit is contained in:
Thomas Schmitt 2024-05-19 18:35:40 +02:00
parent 57fcd4bfbb
commit 78708015af
3 changed files with 42 additions and 5 deletions

View File

@ -2764,6 +2764,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
target->joliet_ucs2_failures = 0;
target->joliet_symlinks = 0;
target->joliet_specials = 0;
target->iso1999_symlinks = 0;
target->iso1999_specials = 0;
/* If partitions get appended, then the backup GPT cannot be part of
the ISO filesystem.
@ -3303,6 +3305,16 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
"Number of special files omitted from Joliet tree: %lu",
target->joliet_specials);
}
if (target->iso1999_symlinks > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of symbolic links omitted from ISO 9660:1999 tree: %lu",
target->iso1999_symlinks);
}
if (target->iso1999_specials > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of special files omitted from ISO 9660:1999 tree: %lu",
target->iso1999_specials);
}
*img = target;
return ISO_SUCCESS;

View File

@ -933,6 +933,12 @@ struct ecma119_image
unsigned long joliet_symlinks;
unsigned long joliet_specials;
/* Count of symbolic links and special files which could not be represented
in ISO 9660:1999.
*/
unsigned long iso1999_symlinks;
unsigned long iso1999_specials;
};
#define BP(a,b) [(b) - (a) + 1]

View File

@ -251,14 +251,33 @@ int create_tree(Ecma119Image *t, IsoNode *iso, Iso1999Node **tree, int pathlen)
}
break;
case LIBISO_SYMLINK:
case LIBISO_SPECIAL:
{
t->iso1999_symlinks++;
if (t->iso1999_symlinks == 1) {
char *ipath = iso_tree_get_node_path(iso);
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Can't add %s to ISO 9660:1999 tree. This kind of files "
"can only be added to a Rock Ridget tree. Skipping.",
"Cannot add symbolic link %s to ISO 9660:1999 tree. Skipping.",
ipath);
free(ipath);
} else {
if (t->iso1999_symlinks == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More symbolic links were omitted from ISO 9660:1999 tree.");
ret = 0;
}
break;
case LIBISO_SPECIAL:
t->iso1999_specials++;
if (t->iso1999_specials == 1) {
char *ipath = iso_tree_get_node_path(iso);
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Cannot add special file %s to ISO 9660:1999 tree. Skipping.",
ipath);
free(ipath);
} else {
if (t->iso1999_specials == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More special files were omitted from ISO 9660:1999 tree.");
ret = 0;
}
break;
default: