Reduced number of warnings about special files or symlinks in Joliet

This commit is contained in:
Thomas Schmitt 2023-04-14 17:47:07 +02:00
parent bd415402f4
commit cdc7f52187
3 changed files with 46 additions and 5 deletions

View File

@ -2761,6 +2761,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
target->curr_ce_entries = 0; target->curr_ce_entries = 0;
target->joliet_ucs2_failures = 0; target->joliet_ucs2_failures = 0;
target->joliet_symlinks = 0;
target->joliet_specials = 0;
/* If partitions get appended, then the backup GPT cannot be part of /* If partitions get appended, then the backup GPT cannot be part of
the ISO filesystem. the ISO filesystem.
@ -3290,6 +3292,16 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
* even modified by the read thread (look inside bs_* functions) * even modified by the read thread (look inside bs_* functions)
*/ */
if (target->joliet_symlinks > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of symbolic links omitted from Joliet tree: %lu",
target->joliet_symlinks);
}
if (target->joliet_specials > 0) {
iso_msg_submit(target->image->id, ISO_FILE_IGNORED, 0,
"Number of special files omitted from Joliet tree: %lu",
target->joliet_specials);
}
*img = target; *img = target;
return ISO_SUCCESS; return ISO_SUCCESS;

View File

@ -926,6 +926,13 @@ struct ecma119_image
/* Number of CE entries in currently processed node */ /* Number of CE entries in currently processed node */
uint32_t curr_ce_entries; uint32_t curr_ce_entries;
/* Count of symbolic links and special files which could not be represented
in Joliet.
*/
unsigned long joliet_symlinks;
unsigned long joliet_specials;
}; };
#define BP(a,b) [(b) - (a) + 1] #define BP(a,b) [(b) - (a) + 1]

View File

@ -301,14 +301,36 @@ int create_tree(Ecma119Image *t, IsoNode *iso, JolietNode **tree, int pathlen)
} }
break; break;
case LIBISO_SYMLINK: case LIBISO_SYMLINK:
case LIBISO_SPECIAL: t->joliet_symlinks++;
{ if (t->joliet_symlinks == 1) {
char *ipath = iso_tree_get_node_path(iso); char *ipath = iso_tree_get_node_path(iso);
/* This first ret might indicate the need to abort */
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0, ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Cannot add %s to Joliet tree. %s can only be added to a " "Cannot add %s to Joliet tree. Symlinks can only be added to a "
"Rock Ridge tree.", ipath, (iso->type == LIBISO_SYMLINK ? "Rock Ridge tree.", ipath);
"Symlinks" : "Special files"));
free(ipath); free(ipath);
} else {
if (t->joliet_symlinks == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More symbolic links were omitted from Joliet tree.");
ret = 0;
}
break;
case LIBISO_SPECIAL:
t->joliet_specials++;
if (t->joliet_specials == 1) {
char *ipath = iso_tree_get_node_path(iso);
/* This first ret might indicate the need to abort */
ret = iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"Cannot add %s to Joliet tree. "
"Special files can only be added to a Rock Ridge tree.",
ipath);
free(ipath);
} else {
if (t->joliet_specials == 2)
iso_msg_submit(t->image->id, ISO_FILE_IGNORED, 0,
"More special files were omitted from Joliet tree.");
ret = 0;
} }
break; break;
default: default: