tags 392107 +pending
severity normal
thanks

The following patch has been applied to the mainline repository.

Since the Debian installer has a workaround for the bug, I've
reassigned its severity to normal.

                                                - Ted

# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1161145871 14400
# Node ID 733641c1e283d27b829ae72f51e18e43f8304652
# Parent  32c7d2357ee2232d4a76e86ff9738a234a6b8a65
Fix mke2fs error checking when creating revision 0 filesystems

Fix revision 0 error checking so that it doesn't give spurious error
when the user gives a command-line option of "-O none".  Add error
checking so that "-r 0 -j", "-r 0 -s 1", and "-r 0 -E resize=XXX" will
print an explanatory error message and abort.

Addresses Debian bug: #392107

Signed-off-by: "Theodore Ts'o" <[EMAIL PROTECTED]>

diff -r 32c7d2357ee2 -r 733641c1e283 misc/ChangeLog
--- a/misc/ChangeLog    Wed Oct 04 09:12:35 2006 -0400
+++ b/misc/ChangeLog    Wed Oct 18 00:31:11 2006 -0400
@@ -1,3 +1,12 @@ 2006-10-03  Theodore Tso  <[EMAIL PROTECTED]
+2006-10-18  Theodore Tso  <[EMAIL PROTECTED]>
+
+       * mke2fs.c: Fix revision 0 error checking so that it doesn't give
+               a spurious error when the user gives a command-line option
+               of "-O none".  (Addresses Debian bug: #392107).  Add 
+               error checking so that "-r 0 -j", "-r 0 -s 1", and 
+               "-r 0 -E resize=XXX" will print an explanatory error
+               message and abort.
+
 2006-10-03  Theodore Tso  <[EMAIL PROTECTED]>
 
        * badblocks.c: Fix the interpretation of the last_block parameter
diff -r 32c7d2357ee2 -r 733641c1e283 misc/mke2fs.c
--- a/misc/mke2fs.c     Wed Oct 04 09:12:35 2006 -0400
+++ b/misc/mke2fs.c     Wed Oct 18 00:31:11 2006 -0400
@@ -831,6 +831,11 @@ static void parse_extended_opts(struct e
                                rsv_gdb = EXT2_ADDR_PER_BLOCK(param);
 
                        if (rsv_gdb > 0) {
+                               if (param->s_rev_level == EXT2_GOOD_OLD_REV) {
+                                       fprintf(stderr, 
+       _("On-line resizing not supported with revision 0 filesystems\n"));
+                                       exit(1);
+                               }
                                param->s_feature_compat |=
                                        EXT2_FEATURE_COMPAT_RESIZE_INODE;
 
@@ -1273,39 +1278,58 @@ static void PRS(int argc, char *argv[])
 
        /* Figure out what features should be enabled */
 
-       if (r_opt == EXT2_GOOD_OLD_REV && fs_features) {
+       tmp = tmp2 = NULL;
+       if (fs_param.s_rev_level != EXT2_GOOD_OLD_REV) {
+               profile_get_string(profile, "defaults", "base_features", 0,
+                                  "filetype,sparse_super", &tmp);
+               profile_get_string(profile, "fs_types", fs_type, 
+                                  "base_features", tmp, &tmp2);
+               edit_feature(tmp2, &fs_param.s_feature_compat);
+               free(tmp);
+               free(tmp2);
+
+               tmp = tmp2 = NULL;
+               profile_get_string(profile, "defaults", "default_features", 0,
+                                  "", &tmp);
+               profile_get_string(profile, "fs_types", fs_type, 
+                                  "default_features", tmp, &tmp2);
+       }
+       edit_feature(fs_features ? fs_features : tmp2, 
+                    &fs_param.s_feature_compat);
+       if (tmp)
+               free(tmp);
+       if (tmp2)
+               free(tmp2);
+
+       if (r_opt == EXT2_GOOD_OLD_REV && 
+           (fs_param.s_feature_compat || fs_param.s_feature_incompat ||
+            fs_param.s_feature_incompat)) {
                fprintf(stderr, _("Filesystem features not supported "
                                  "with revision 0 filesystems\n"));
                exit(1);
        }
 
-       profile_get_string(profile, "defaults", "base_features", 0,
-                          "filetype,sparse_super", &tmp);
-       profile_get_string(profile, "fs_types", fs_type, "base_features",
-                          tmp, &tmp2);
-       edit_feature(tmp2, &fs_param.s_feature_compat);
-       free(tmp);
-       free(tmp2);
-
-       profile_get_string(profile, "defaults", "default_features", 0,
-                          "", &tmp);
-       profile_get_string(profile, "fs_types", fs_type, 
-                          "default_features", tmp, &tmp2);
-       edit_feature(fs_features ? fs_features : tmp2, 
-                    &fs_param.s_feature_compat);
-       free(tmp);
-       free(tmp2);
-
-       if (s_opt > 0)
+       if (s_opt > 0) {
+               if (r_opt == EXT2_GOOD_OLD_REV) {
+                       fprintf(stderr, _("Sparse superblocks not supported "
+                                 "with revision 0 filesystems\n"));
+                       exit(1);
+               }
                fs_param.s_feature_ro_compat |=
                        EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
-       else if (s_opt == 0)
+       } else if (s_opt == 0)
                fs_param.s_feature_ro_compat &=
                        ~EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER;
 
-       if (journal_size != 0)
+       if (journal_size != 0) {
+               if (r_opt == EXT2_GOOD_OLD_REV) {
+                       fprintf(stderr, _("Journals not supported "
+                                 "with revision 0 filesystems\n"));
+                       exit(1);
+               }
                fs_param.s_feature_compat |= 
                        EXT3_FEATURE_COMPAT_HAS_JOURNAL;
+       }
 
        if (fs_param.s_feature_incompat & 
            EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
@@ -1317,12 +1341,6 @@ static void PRS(int argc, char *argv[])
                fs_param.s_feature_ro_compat = 0;
        }
        
-       if (fs_param.s_rev_level == EXT2_GOOD_OLD_REV) {
-               fs_param.s_feature_incompat = 0;
-               fs_param.s_feature_compat = 0;
-               fs_param.s_feature_ro_compat = 0;
-       }
-
        /* Set first meta blockgroup via an environment variable */
        /* (this is mostly for debugging purposes) */
        if ((fs_param.s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) &&


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to