From: Jan Nieuwenhuizen <janneke@gnu.org>
To: bug-hurd@gnu.org
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] ext2fs: Update to upstream Hurd-reserved xattr index for "gnu.*".
Date: Wed, 13 May 2020 14:04:04 +0200 [thread overview]
Message-ID: <87k11ghwi3.fsf@gnu.org> (raw)
In-Reply-To: <20200512142819.fzpeco3kk4ufqnlw@function> (Samuel Thibault's message of "Tue, 12 May 2020 16:28:19 +0200")
Samuel Thibault writes:
Hello Samuel,
> Jan Nieuwenhuizen, le mar. 12 mai 2020 16:12:34 +0200, a ecrit:
>> setfattr --name=gnu.translator --value='/hurd/pflocal\0' /mnt/servers/socket/1
>
> man setfattr says
>
> If the given string is enclosed in double quotes, the inner string is
> treated as text. In that case, backslashes and double quotes have
> special meanings and need to be escaped by a preceding backslash.
>
> so I guess it needs
>
> setfattr --name=gnu.translator --value='"/hurd/pflocal\0"' /mnt/servers/socket/1
>
> to actually interpret \0
Yes, that's it; thank you!
So I've now managed to create a vm-image using Guix that boots the Hurd
straight into our Guile RC script, without the need to use Bash for
that. See
https://gitlab.com/janneke/guix/-/commit/3b4c0dcda783e8c866be154ab46ec95fb581f08f
./pre-inst-env guix system vm-image --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl
and
wget https://lilypond.org/janneke/hurd/hurd-xattr.img.gz
gunzip hurd-xattr.img.gz
guix environment --ad-hoc qemu -- qemu-system-i386 -enable-kvm \
-snapshot -hda hurd-xattr.img -m 2G \
-device rtl8139,netdev=net0 -netdev user,id=net0,hostfwd=tcp:127.0.0.1:10022-:2222
So WDYT, is my patch for the Hurd (the first message in this thread)
https://lists.gnu.org/archive/html/bug-hurd/2020-05/msg00016.html
OK to apply now? Any ideas or suggestions on my Linux patch?
>> --8<---------------cut here---------------start------------->8---
>> fsck --yes --force /
>> fsysopts / --writable
>> mv /servers/socket/1 /servers/socket/1-linux
>> touch /servers/socket/1
>> setfattr --name=gnu.translator --value='/hurd/pflocal\0' /servers/socket/1
>
> Note that glibc's setxattr, i.e. _hurd_xattr_set, translates that
> into a __file_set_translator() RPC call. Did you pass the proper option
> to make ext2fs record the translator as xattr instead of passive record?
Yes...
>> And I guess there must be an incompatibility between Linux and the Hurd
>> in how setfattr embeds the xattr attributes into the file system.
>>
>> How to best "diff" this aspect in the file system; how to proceed?
>
> debugfs can be used for that.
Right, thanks. I was looking for something like that.
>> Inspired by Shengyu's GSoC code that simply seemed to use fprintf for
>> debbugging, I tried adding some debug printing in inode.c
>>
>> fprintf (stderr, "gnu.translator[%d,%d]=%s\n", datalen, strlen (*namep), *namep);
>
> Printf is the simplest way to make sure things are happening the way one
> wants, yes. Note however that in the case of translators even the output on
> stderr is buffered, so you need to flush it with fflush(stderr). Even
> safer is to use snprintf + mach_print().
>
>> but that does not seem to work,
>
> More precisely?
> I'll assume "does not show up".
(that was more precisely exactly what I meant to ask)
> If your print doesn't show up, try to put a print in other places which
> are definitely to be called such as in diskfs_user_read_node(). If those
> come up, then it means the code you put your prints is not even called,
> so put prints in code you thought was calling it etc. up to the RPC that
> you thought would be called, then jump to libc which was supposed to be
> making the RPC call, etc.
Thank you! It took me a while to find the right setfattr curse so I
dabbled in here some more and can confirm that combining your
instructions, e.g., like so
--8<---------------cut here---------------start------------->8---
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index a2e804b9..f4e29eb5 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -700,6 +700,9 @@ diskfs_get_translator (struct node *np, char **namep, unsigned *namelen)
void *transloc;
struct ext2_inode *di;
+ fprintf (stderr, "diskfs_get_translator\n");
+ fflush (stderr);
+
if (sblock->s_creator_os != EXT2_OS_HURD)
return EOPNOTSUPP;
--8<---------------cut here---------------end--------------->8---
"just work". That's helpful knowledge to have anyway.
Greetings,
janneke
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
next prev parent reply other threads:[~2020-05-13 12:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 14:12 [PATCH] ext2fs: Update to upstream Hurd-reserved xattr index for "gnu.*" Jan Nieuwenhuizen
2020-05-12 14:28 ` Samuel Thibault
2020-05-13 12:04 ` Jan Nieuwenhuizen [this message]
2020-05-13 22:52 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k11ghwi3.fsf@gnu.org \
--to=janneke@gnu.org \
--cc=bug-hurd@gnu.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).