Skip to contentSkip to conversation

libext2fs: add gnu.translator support

PATCH Applied Romain Naour 2 participants 2 messages Nov 2, 2020 – Jan 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libext2fs: add gnu.translator support

The support of setting (and reading) of passive translators from GNU/Linux has been added to the Linux kernel by the commit [1]. The name index '10' has been reserved for GNU/Hurd.

Hurd passive translators are stored as a xattr value with name "gnu.translator" [2].

If "gnu.translator" xattr value has been set before calling mkfs.ext2, it will segfault since "gnu." is not present in ea_names[].

$ setfattr -n gnu.translator -v "/hurd/exec\0" ${TARGET_DIR}/servers/exec
$ mkfs.ext2 -d ${TARGET_DIR} -o hurd -O ext_attr rootfs.ext2 "1G"

Adding "gnu." to ea_names[], allow to create ext2 filesystem for GNU/Hurd with passive translator already set.

[1] https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=a04c7bf83172faa7cb080fbe3b6c04a8415ca645
[2] https://lists.gnu.org/archive/html/bug-hurd/2016-08/msg00075.html

---
 lib/ext2fs/ext_attr.c | 1 +
 1 file changed, 1 insertion(+)
lib/ext2fs/ext_attr.c +1 -0
index 871319a5..4580d2e1 100644
@@ -336,6 +336,7 @@ struct ea_name_index {
 
 /* Keep these names sorted in order of decreasing specificity. */
 static struct ea_name_index ea_names[] = {
+	{10, "gnu."},
 	{3, "system.posix_acl_default"},
 	{2, "system.posix_acl_access"},
 	{8, "system.richacl"},
Signature · 1 line
2.25.4
#1 lore raw
Quoted 14 lines · Romain Naour

The support of setting (and reading) of passive translators from GNU/Linux has been added to the Linux kernel by the commit [1]. The name index '10' has been reserved for GNU/Hurd.

Hurd passive translators are stored as a xattr value with name "gnu.translator" [2].

If "gnu.translator" xattr value has been set before calling mkfs.ext2, it will segfault since "gnu." is not present in ea_names[].

$ setfattr -n gnu.translator -v "/hurd/exec\0" ${TARGET_DIR}/servers/exec
$ mkfs.ext2 -d ${TARGET_DIR} -o hurd -O ext_attr rootfs.ext2 "1G"
Quoted 8 lines

Adding "gnu." to ea_names[], allow to create ext2 filesystem for GNU/Hurd with passive translator already set.

[1] https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=a04c7bf83172faa7cb080fbe3b6c04a8415ca645
[2] https://lists.gnu.org/archive/html/bug-hurd/2016-08/msg00075.html

Applied, thanks.

- Ted