hfsplus: fix generic/523 test-case failure
Subsystems (3)
Viacheslav Dubeyko
maintainerPATCH 1/1 hfsplus: fix generic/523 test-case failure
The xfstests' test-case generic/523 fails to execute correctly:
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc4+ #8 SMP PREEMPT_DYNAMIC Thu May 1 16:43:22 PDT 2025 MKFS_OPTIONS -- /dev/loop51MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/523 - output mismatch (see xfstests-dev/results//generic/523.out.bad)
The test-case expects to have '/' in the xattr name. However, HFS+ unicode logic makes conversion of '/' into ':'. In HFS+, a filename can contain '/' because ':' is the separator. The slash is a valid filename character on macOS. But on Linux, / is the path separator and it cannot appear in a filename component. But xattr name can contain any of these symbols. It means that this unicode logic conversion doesn't need to be executed for the case of xattr name.
This patch adds distinguishing the regular and xattr names. If we have a regular name, then this conversion of special symbols will be executed. Otherwise, the conversion is skipped for the case of xattr names.
sudo ./check -g auto
FSTYP -- hfsplus PLATFORM -- Linux/x86_64 hfsplus-testing-0001 7.0.0-rc1+ #24 SMP PREEMPT_DYNAMIC Fri Mar 20 12:36:49 PDT 2026 MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
<skipped>
generic/523 33s ... 25s
<skipped>
--- fs/hfsplus/attributes.c | 3 +- fs/hfsplus/catalog.c | 4 +- fs/hfsplus/hfsplus_fs.h | 3 +- fs/hfsplus/unicode.c | 121 ++++++++++++++++++++++++++----------- fs/hfsplus/unicode_test.c | 51 ++++++++++------ include/linux/hfs_common.h | 5 ++ 6 files changed, 132 insertions(+), 55 deletions(-)
fs/hfsplus/attributes.c +2 -1
@@ -57,7 +57,8 @@ int hfsplus_attr_build_key(struct super_block *sb, hfsplus_btree_key *key,if (name) {int res =hfsplus_asc2uni (sb, (struct hfsplus_unistr *)&key->attr.key_name, -HFSPLUS_ATTR_MAX_STRLEN , name,strlen (name)); +HFSPLUS_ATTR_MAX_STRLEN , name,strlen (name), +HFS_XATTR_NAME );if (res)return res; len =be16_to_cpu (key->attr.key_name.length);
fs/hfsplus/catalog.c +2 -2
@@ -47,7 +47,7 @@ int hfsplus_cat_build_key(struct super_block *sb, key->cat.parent =cpu_to_be32 (parent); err =hfsplus_asc2uni (sb, &key->cat.name,HFSPLUS_MAX_STRLEN , - str->name, str->len); + str->name, str->len,HFS_REGULAR_NAME );if (unlikely (err <0 ))return err;
@@ -183,7 +183,7 @@ static int hfsplus_fill_cat_thread(struct super_block *sb, entry->thread.reserved =0 ; entry->thread.parentID =cpu_to_be32 (parentid); err =hfsplus_asc2uni (sb, &entry->thread.nodeName,HFSPLUS_MAX_STRLEN , - str->name, str->len); + str->name, str->len,HFS_REGULAR_NAME );if (unlikely (err <0 ))return err;
fs/hfsplus/hfsplus_fs.h +2 -1
@@ -506,7 +506,8 @@ int hfsplus_uni2asc_xattr_str(struct super_block *sb,const struct hfsplus_attr_unistr *ustr, char *astr, int *len_p);int hfsplus_asc2uni (struct super_block *sb,struct hfsplus_unistr *ustr, -int max_unistr_len,const char *astr,int len); +int max_unistr_len,const char *astr,int len, +int name_type);int hfsplus_hash_dentry (const struct dentry *dentry,struct qstr *str);int hfsplus_compare_dentry (const struct dentry *dentry,unsigned int len,const char *str,const struct qstr *name);
fs/hfsplus/unicode.c +87 -34
196 lines not on this page · raw message
fs/hfsplus/unicode_test.c +34 -17
152 lines not on this page · raw message
include/linux/hfs_common.h +5 -0
@@ -166,6 +166,11 @@ struct hfsplus_attr_unistr {hfsplus_unichr unicode[HFSPLUS_ATTR_MAX_STRLEN ]; } __packed; +enum { +HFS_REGULAR_NAME , +HFS_XATTR_NAME , +}; +struct hfs_extent {__be16 block;__be16 count;
Signature · 1 line
2.43.0