diff options
author | Gabriel Krisman Bertazi <krisman@collabora.com> | 2020-12-17 18:35:42 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-01-27 22:18:53 -0500 |
commit | 1e6a3a32beb37b90f60a67806a2f75caccf4698c (patch) | |
tree | 8a9bc08592033e449c2bd2aaccae06da9ded935c | |
parent | 782df523380761a54376d8645ea781172cae1f5f (diff) | |
download | e2fsprogs-1e6a3a32beb37b90f60a67806a2f75caccf4698c.tar.gz |
e2fsck: add option to force encoded filename verification
This is interesting for !strict filesystems as part of the encoding
update procedure. Once the filesystem is known to not have badly encoded
filenames, the update is trivial, thanks to the stability of assigned
code points in the unicode specification.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/e2fsck.h | 1 | ||||
-rw-r--r-- | e2fsck/pass2.c | 5 | ||||
-rw-r--r-- | e2fsck/unix.c | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h index 32159d278..0e910a92a 100644 --- a/e2fsck/e2fsck.h +++ b/e2fsck/e2fsck.h @@ -178,6 +178,7 @@ struct resource_track { #define E2F_OPT_ICOUNT_FULLMAP 0x20000 /* use an array for inode counts */ #define E2F_OPT_UNSHARE_BLOCKS 0x40000 #define E2F_OPT_CLEAR_UNINIT 0x80000 /* Hack to clear the uninit bit */ +#define E2F_OPT_CHECK_ENCODING 0x100000 /* Force verification of encoded filenames */ /* * E2fsck flags diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index f23a3a9c6..7e961e82f 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1049,9 +1049,10 @@ static int check_dir_block(ext2_filsys fs, ctx = cd->ctx; /* We only want filename encoding verification on strict - * mode. */ + * mode or if explicitly requested by user. */ if (ext2fs_test_inode_bitmap2(ctx->inode_casefold_map, ino) && - (ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL)) + ((ctx->fs->super->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL) || + (ctx->options & E2F_OPT_CHECK_ENCODING))) cf_dir = 1; if (ctx->flags & E2F_FLAG_RUN_RETURN) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 4fe5fe4cb..08f1863da 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -753,6 +753,9 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts) ctx->options |= E2F_OPT_UNSHARE_BLOCKS; ctx->options |= E2F_OPT_FORCE; continue; + } else if (strcmp(token, "check_encoding") == 0) { + ctx->options |= E2F_OPT_CHECK_ENCODING; + continue; #ifdef CONFIG_DEVELOPER_FEATURES } else if (strcmp(token, "clear_all_uninit_bits") == 0) { ctx->options |= E2F_OPT_CLEAR_UNINIT; @@ -784,6 +787,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts) fputs("\tbmap2extent\n", stderr); fputs("\tunshare_blocks\n", stderr); fputs("\tfixes_only\n", stderr); + fputs("\tcheck_encoding\n", stderr); fputc('\n', stderr); exit(1); } |