GNU bug report logs -
#47596
File descriptor error when exiting emacs on android 11
Previous Next
Reported by: Henrik Grimler <henrik <at> grimler.se>
Date: Sun, 4 Apr 2021 19:21:02 UTC
Severity: normal
Tags: moreinfo
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 47596 <at> debbugs.gnu.org (full text, mbox):
Hi,
Compiling this, on any optimisation level, is enough to trigger the
error:
```
#include <stdio.h>
int main()
{
fdopen (2, "w");
fclose (stderr);
}
```
In emacs fdopen is run in init_standard_fds, where we have
```
[...]
force_open (STDERR_FILENO, O_RDONLY);
/* Set buferr if possible on platforms defining _PC_PIPE_BUF, as
they support the notion of atomic writes to pipes. */
#ifdef _PC_PIPE_BUF
buferr = fdopen (STDERR_FILENO, "w");
if (buferr)
setvbuf (buferr, NULL, _IOLBF, 0);
#endif
}
```
so I suppose there is either some very fundamental issue with
`fdopen (STDERR_FILENO, "w")` here, or the file descriptor sanitizer on
android is broken.
If I avoid that part of init_standard_fds, i.e. change the ifdef to
something like `#if defined(_PC_PIPE_BUF) && !defined(__ANDROID__)`, I
get an emacs that seem to fully work on android.
Best regards,
Henrik Grimler
This bug report was last modified 2 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.