From cdc7f52187c1eb8decd1908895383858d5092217 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 14 Apr 2023 17:47:07 +0200 Subject: [PATCH] Reduced number of warnings about special files or symlinks in Joliet --- libisofs/ecma119.c | 12 ++++++++++++ libisofs/ecma119.h | 7 +++++++ libisofs/joliet.c | 32 +++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index dde70b9..83e3d2f 100644 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -2761,6 +2761,8 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img) target->curr_ce_entries = 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 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) */ + 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; return ISO_SUCCESS; diff --git a/libisofs/ecma119.h b/libisofs/ecma119.h index e4c361a..88b4420 100644 --- a/libisofs/ecma119.h +++ b/libisofs/ecma119.h @@ -926,6 +926,13 @@ struct ecma119_image /* Number of CE entries in currently processed node */ 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] diff --git a/libisofs/joliet.c b/libisofs/joliet.c index 218b1c1..47375b8 100644 --- a/libisofs/joliet.c +++ b/libisofs/joliet.c @@ -301,14 +301,36 @@ int create_tree(Ecma119Image *t, IsoNode *iso, JolietNode **tree, int pathlen) } break; case LIBISO_SYMLINK: - case LIBISO_SPECIAL: - { + t->joliet_symlinks++; + if (t->joliet_symlinks == 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. %s can only be added to a " - "Rock Ridge tree.", ipath, (iso->type == LIBISO_SYMLINK ? - "Symlinks" : "Special files")); + "Cannot add %s to Joliet tree. Symlinks can only be added to a " + "Rock Ridge tree.", 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; default: