From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Henrik Grimler Newsgroups: gmane.emacs.bugs Subject: bug#47596: File descriptor error when exiting emacs on android 11 Date: Mon, 10 May 2021 09:23:05 +0200 Message-ID: <8a9fbefead009fce76aa5a28315c0fedf3ce7bec.camel@grimler.se> References: <83im51deye.fsf@gnu.org> <730dad3a54f0f53b22e9603879e949b60f5b2c00.camel@grimler.se> <191e2295b88384adf0e7cc1e3dc84cf8f37eb973.camel@grimler.se> <838s5wdhef.fsf@gnu.org> <2215b2299da65d790a705d9b83051028a1a2b693.camel@grimler.se> <87k0ocw37m.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7944"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.40.1 Cc: 47596@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 10 09:24:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lg0H7-0001vK-0F for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 May 2021 09:24:21 +0200 Original-Received: from localhost ([::1]:56078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lg0H5-0005FH-VR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 May 2021 03:24:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lg0Gp-0005Bh-2d for bug-gnu-emacs@gnu.org; Mon, 10 May 2021 03:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lg0Go-0005DG-GS for bug-gnu-emacs@gnu.org; Mon, 10 May 2021 03:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lg0Go-0003wM-D8 for bug-gnu-emacs@gnu.org; Mon, 10 May 2021 03:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Henrik Grimler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 May 2021 07:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47596 X-GNU-PR-Package: emacs Original-Received: via spool by 47596-submit@debbugs.gnu.org id=B47596.162063139715080 (code B ref 47596); Mon, 10 May 2021 07:24:02 +0000 Original-Received: (at 47596) by debbugs.gnu.org; 10 May 2021 07:23:17 +0000 Original-Received: from localhost ([127.0.0.1]:57272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg0G5-0003vA-KP for submit@debbugs.gnu.org; Mon, 10 May 2021 03:23:17 -0400 Original-Received: from h02mx15.reliablemail.org ([185.76.66.168]:28904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg0G2-0003us-D7 for 47596@debbugs.gnu.org; Mon, 10 May 2021 03:23:16 -0400 X-Halon-Out: 9112a061-b160-11eb-a991-45bbe13bd5ad DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=grimler.se; s=default; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References: In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=y0vMqBaABKTG16GGRy/z9cMeCQOhJ0nOufeLnHLwsFI=; b=YLEDCeUzgGi34YWXnftwi+3vPL LpC0dPP8bIiJYUTO/VwUK/Y9Dsem2rcVKxUCqBPXBIr6JBCABmNB+viLoB7hD366q1Y7G9hoipfZn 1j8kKkTsRwf17pZbZAhnJKoOxSwo8IwehC7/Koy3KuW+n4F+6o2KBc8XV8mgjVQK0wzuesNAgtWsp HoRCh8xeegczW+hfdz1TJYRYKIkd4+2ug8LbPafcqCudKJ6lhjJlia4pPg7+G8OBYMqAo65O3khFZ /eRAg6NvApiZwcfepaQmzZxQGIFo5FsHHALHkBd8lPG9cNocwBhM82IjUeRYHXloy72BLuJ1zwacQ Sj+XgVzg==; In-Reply-To: <87k0ocw37m.fsf@gnus.org> X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpsrv07.misshosting.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - grimler.se X-Get-Message-Sender-Via: cpsrv07.misshosting.com: authenticated_id: henrik@grimler.se X-Authenticated-Sender: cpsrv07.misshosting.com: henrik@grimler.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206125 Archived-At: Hi Lars, On Thu, 2021-05-06 at 12:45 +0200, Lars Ingebrigtsen wrote: > > I probably should have included a bit more context in the android bug > > report to better show what the code does. > > Did you try to include this context in the Android bug report and see > what they say then? > I added another comment now with a slightly more verbose example: ``` #include #include /* If FD is not already open, arrange for it to be open with FLAGS. */ static void force_open (int fd, int flags) { if (dup2 (fd, fd) < 0) { int n = open ("/dev/null", flags); if (n < 0 || (fd != n && (dup2 (n, fd) < 0 || close (n) == 0 != 0))) exit (EXIT_FAILURE); } } /* A stream that is like stderr, except line buffered. It is NULL during startup, or if line buffering is not in use. */ static FILE *buferr; int main() { /* Make sure stderr are open to something, so that the file descriptor is not hijacked by later system calls. */ 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 int err = buferr && (fflush (buferr) != 0 || ferror (buferr)); if (err | (fclose (stderr) != 0)) return 1; return 0; } ``` Hopefully they have time to provide some feedback. Best regards, Henrik Grimler