From: "Darrick J. Wong" <djwong@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Sam James <sam@gentoo.org>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/5] fuse2fs: stop aliasing stderr with ff->err_fp
Date: Mon, 21 Jul 2025 10:01:47 -0700 [thread overview]
Message-ID: <20250721170147.GT2672070@frogsfrogsfrogs> (raw)
In-Reply-To: <20250721114117.GB231115@mit.edu>
On Mon, Jul 21, 2025 at 07:41:17AM -0400, Theodore Ts'o wrote:
> On Sun, Jul 20, 2025 at 10:42:34PM -0700, Darrick J. Wong wrote:
> > Oh wait no it turns out that libfuse obliterates std{in,out,err} in
> > fuse_daemonize() by opening /dev/null and using that exact trick. So
> > the only reason why I was ever getting any FUSE2FS debug output
> > throughout *any* of the fuse+iomap development sprints was that glibc
> > lets you assign stdout/stderr directly.
> >
> > freopen also won't work (at least on glibc) because its freopen
> > implementation uses the dup2 trick which will be undone by libfuse.
> >
> > GREAT! I only got to debug my program because OF A WEIRD GLIBC QUIRK!!
>
> So either we need to find some way to inhibit fuse_daemonize() and
> then have fuse2fs handling doing the daemonization. Or maybe we can
> arrange to have some kind callback to set up stdout/stderr after
> fuse_main() is called? fuse_daemonize() is called from fuse_main(),
> right?
Right. We could just set up the log file again in op_init, which will
fix the daemonize() problem; use dup2 to cover any libraries that output
directly to STDOUT/ERR_FILE; and use freopen on /dev/fd/XX which will
cover any other libraries that call printf or fprintf(stdout/err.
$ diffstat < patches-djwong-dev/019*
fuse2fs.c | 141 +++++++++++++++++++++++++----
1 file changed, 123 insertions(+), 18 deletions(-)
Yuuuuuck.
--D
> - Ted
next prev parent reply other threads:[~2025-07-21 17:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 21:38 [PATCHSET 1/5] fuse2fs: better logging Darrick J. Wong
2025-04-24 21:38 ` [PATCH 1/5] fuse2fs: enable runtime debugging Darrick J. Wong
2025-04-24 21:39 ` [PATCH 2/5] fuse2fs: stop aliasing stderr with ff->err_fp Darrick J. Wong
2025-07-20 8:27 ` Sam James
2025-07-20 18:51 ` Darrick J. Wong
2025-07-21 5:42 ` Darrick J. Wong
2025-07-21 11:41 ` Theodore Ts'o
2025-07-21 17:01 ` Darrick J. Wong [this message]
2025-04-24 21:39 ` [PATCH 3/5] fuse2fs: use error logging macro for mount errors Darrick J. Wong
2025-04-24 21:39 ` [PATCH 4/5] fuse2fs: make other logging consistent Darrick J. Wong
2025-04-24 21:40 ` [PATCH 5/5] fuse2fs: redirect all messages when FUSE2FS_LOGFILE is set Darrick J. Wong
2025-05-21 14:51 ` [PATCHSET 1/5] fuse2fs: better logging Theodore Ts'o
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250721170147.GT2672070@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sam@gentoo.org \
--cc=tytso@mit.edu \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox