Make printf_stderr work on Windows when it's been redirected
Categories
(Core :: XPCOM, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox88 | --- | fixed |
People
(Reporter: jrmuizel, Assigned: jrmuizel, NeedInfo)
References
Details
Attachments
(1 file)
Assignee | ||
Comment 1•3 years ago
|
||
Currently, printf_stderr doesn't show up when running with ./mach run.
This is because we run with -attach-console and that redirects stderr
to a different file descriptor using freopen in UseParentConsole.
The change from just using stderr directly happened in bug 340443 and was done
to avoid some linking issues. That problem doesn't seem to apply anymore so we
should be able to go back to the straightforward implemention that works even
if stderr has been redirected.
Updated•3 years ago
|
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/975163dad54f Use stderr in printf_stderr instead of reopening fd 2. r=glandium
Comment 3•3 years ago
|
||
Backed out for perma failures.
Logs:
https://treeherder.mozilla.org/logviewer?job_id=323535802&repo=autoland&lineNumber=4295
https://treeherder.mozilla.org/logviewer?job_id=323533749&repo=autoland&lineNumber=3463
Backout: https://hg.mozilla.org/integration/autoland/rev/6fc1c9e37981b58da91edea754d05deb10b0a137
Assignee | ||
Comment 4•3 years ago
|
||
Looks like the intermingling of stdout and stderr confuses some harnesses.
Comment 5•3 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jrmuizel, could you have a look please?
For more information, please visit auto_nag documentation.
Comment hidden (obsolete) |
Assignee | ||
Comment 7•3 years ago
|
||
Masatoshi, it doesn't look like we fflush(stderr) on the other platforms. Do we need to on Windows?
Comment hidden (obsolete) |
Comment 9•3 years ago
|
||
Hmm, fflush(stderr)
didn't help.
https://treeherder.mozilla.org/jobs?repo=try&revision=604441c192838f331f342555abdfc7abf8e7bb9b
Assignee | ||
Comment 10•3 years ago
|
||
Here's a version that instead of writing directly to stderr
replaces _fdopen(_dup(2), "a");
with _fdopen(_dup(_fileno(stderr)), "a");
It avoids the problems of the earlier version. But I don't really understand why yet.
Assignee | ||
Comment 11•3 years ago
|
||
Ok, my theory for the reason this works is because when reopen with a new FILE* we get the default buffering instead of stderr
's no buffering.
Comment 12•3 years ago
|
||
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a4bf5887fc2a Use stderr in printf_stderr instead of reopening fd 2. r=glandium
Comment 13•3 years ago
|
||
bugherder |
Comment 14•3 years ago
|
||
Backed out changeset a4bf5887fc2a (Bug 1680402) for being the most likely cause of Bug 1686387.
https://hg.mozilla.org/mozilla-central/rev/9594d105ec370e1512c20b23e9e523262ebcc4ca
Comment 15•3 years ago
|
||
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/93ac37a64828 Use stderr in printf_stderr instead of reopening fd 2. r=glandium
Comment 16•3 years ago
|
||
bugherder |
Description
•