diff -ru grub-2.02~beta2.orig/util/grub-mkrescue.c grub-2.02~beta2/util/grub-mkrescue.c --- grub-2.02~beta2.orig/util/grub-mkrescue.c 2013-12-24 11:40:31.000000000 -0500 +++ grub-2.02~beta2/util/grub-mkrescue.c 2016-04-18 01:47:51.125048970 -0400 @@ -370,6 +371,22 @@ free (out); } +/* + * Count strings of the specified value among the elements of the + * specified argument vector. + */ +static int detect_option (int argc, char **argv, const char *val) +{ + int option_cnt = 0; + int i; + for (i = 0; i < argc; i++) { + if (strcmp (argv[ i ], val) == 0) { + option_cnt++; + } + } + return (option_cnt); +} + int main (int argc, char *argv[]) { @@ -387,6 +404,8 @@ xorriso = xstrdup ("xorriso"); label_font = grub_util_path_concat (2, pkgdatadir, "unicode.pf2"); + /* Is "-R" among the arguments? */ + int bigROption = detect_option (argc, argv, "-R"); argp_parse (&argp, argc, argv, 0, 0, 0); if (!output_image) @@ -843,7 +862,12 @@ xorriso_push ("--protective-msdos-label"); xorriso_push ("-o"); xorriso_push (output_image); - xorriso_push ("-r"); + if (! bigROption) { + /* Do not gratuitously suppress Rock Ridge ownership and + permission information in the final ISO image. Insert a little + "-r" flag only if a big "-R" flag is not already present. */ + xorriso_push ("-r"); + } xorriso_push (iso9660_dir); xorriso_push ("--sort-weight"); xorriso_push ("0");