]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: allow specifying the revision 1 via "-r 1"
authorTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2024 23:23:51 +0000 (18:23 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Dec 2024 23:23:51 +0000 (18:23 -0500)
The fsarchiver program unconditionally passes -r 1 even though it's
effectively a no-op.  To avoid commit 3fffe9dd6be5 breaking
fsarchiver, we'll silently allow the "-r 1" option instead of printing
an error and exiting.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index 170ec9bc310f8de409f8f37ed370bb4b2f94c447..aa4e454407a6be24bb9456db12d3f44dc7ca47fd 100644 (file)
@@ -1656,6 +1656,7 @@ static void PRS(int argc, char *argv[])
         * Finally, we complain about fs_blocks_count > 2^32 on a non-64bit fs.
         */
        blk64_t         fs_blocks_count = 0;
+       int             r_opt = -1;
        char            *fs_features = 0;
        int             fs_features_size = 0;
        int             use_bsize;
@@ -1932,11 +1933,26 @@ profile_error:
                        quiet = 1;
                        break;
                case 'r':
-                       com_err(program_name, 0,
-                               _("the -r option has been removed.\n\n"
+                       r_opt = strtoul(optarg, &tmp, 0);
+                       if (*tmp) {
+                               com_err(program_name, 0,
+                                       _("bad revision level - %s"), optarg);
+                               exit(1);
+                       }
+                       if (r_opt > EXT2_MAX_SUPP_REV) {
+                               com_err(program_name, EXT2_ET_REV_TOO_HIGH,
+                                       _("while trying to create revision %d"), r_opt);
+                               exit(1);
+                       }
+                       if (r_opt != EXT2_DYNAMIC_REV) {
+                               com_err(program_name, 0,
+       _("the -r option has been removed.\n\n"
        "If you really need compatibility with pre-1995 Linux systems, use the\n"
        "command-line option \"-E revision=0\".\n"));
-                       exit(1);
+                               exit(1);
+                       }
+                       fs_param.s_rev_level = r_opt;
+                       break;
                case 's':
                        com_err(program_name, 0,
                                _("the -s option has been removed.\n\n"