diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-06-26 15:21:28 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-06-26 15:21:28 -0400 |
commit | 8cec4acdc03a449e8b193948ebce22fe4ad21324 (patch) | |
tree | 73c064a225d96a418eeb08094da16dc75953b3a4 /misc | |
parent | 74430052bc5b3fffff3330f054849ca829fe24dc (diff) | |
download | android_external_e2fsprogs-8cec4acdc03a449e8b193948ebce22fe4ad21324.tar.gz android_external_e2fsprogs-8cec4acdc03a449e8b193948ebce22fe4ad21324.tar.bz2 android_external_e2fsprogs-8cec4acdc03a449e8b193948ebce22fe4ad21324.zip |
tests, mke2fs: add option to suppress xattr copying to fix f_extent_htree
If the developer is running with SELinux enabled on /tmp, the
f_extent_htree regression test will fail because mke2fs by default
copies the extended attributes into the newly created file system (if
a directory hierarchy is specified via the -d option).
Fix this by adding a new extended option to mke2fs, -E no_copy_xattrs
and using it in f_extent_htree's test script.
Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/create_inode.c | 3 | ||||
-rw-r--r-- | misc/create_inode.h | 3 | ||||
-rw-r--r-- | misc/mke2fs.8.in | 9 | ||||
-rw-r--r-- | misc/mke2fs.c | 4 |
4 files changed, 19 insertions, 0 deletions
diff --git a/misc/create_inode.c b/misc/create_inode.c index 6621b0ab..05aa6363 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -142,6 +142,9 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino, char *list = NULL; int i; + if (no_copy_xattrs) + return 0; + size = llistxattr(filename, NULL, 0); if (size == -1) { retval = errno; diff --git a/misc/create_inode.h b/misc/create_inode.h index 3a376322..b5eeb420 100644 --- a/misc/create_inode.h +++ b/misc/create_inode.h @@ -33,6 +33,9 @@ struct fs_ops_callbacks { ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode); }; +extern int no_copy_xattrs; /* this should eventually be a flag + passed to populate_fs3() */ + /* For populating the filesystem */ extern errcode_t populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, const char *source_dir, ext2_ino_t root); diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in index 7b989e0b..603e37e5 100644 --- a/misc/mke2fs.8.in +++ b/misc/mke2fs.8.in @@ -338,6 +338,15 @@ small risk if the system crashes before the journal has been overwritten entirely one time. If the option value is omitted, it defaults to 1 to enable lazy journal inode zeroing. .TP +.BI no_copy_xattrs +Normally +.B mke2fs +will copy the extended attributes of the files in the directory +hierarchy specified via the (optional) +.B \-d +option. This will disable the copy and leaves the files in the newly +created file system without any extended attributes. +.TP .BI num_backup_sb= <0|1|2> If the .B sparse_super2 diff --git a/misc/mke2fs.c b/misc/mke2fs.c index ce78b7c8..b23ea766 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -95,6 +95,7 @@ int journal_size; int journal_flags; static int lazy_itable_init; static int packed_meta_blocks; +int no_copy_xattrs; static char *bad_blocks_filename = NULL; static __u32 fs_stride; /* Initialize usr/grp quotas by default */ @@ -880,6 +881,9 @@ static void parse_extended_opts(struct ext2_super_block *param, r_usage++; continue; } + } else if (strcmp(token, "no_copy_xattrs") == 0) { + no_copy_xattrs = 1; + continue; } else if (strcmp(token, "num_backup_sb") == 0) { if (!arg) { r_usage++; |