From unknown Sun Jun 22 03:56:49 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 18 Feb 2015 21:02:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: report 19897
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 19897@debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@gnu.org
Received: via spool by submit@debbugs.gnu.org id=B.14242932911561
(code B ref -1); Wed, 18 Feb 2015 21:02:02 +0000
Received: (at submit) by debbugs.gnu.org; 18 Feb 2015 21:01:31 +0000
Received: from localhost ([127.0.0.1]:48128 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from )
id 1YOBkQ-0000P6-Go
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:54714)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from ) id 1YOBkO-0000Oy-Kb
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YOBkN-00031f-F1
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:28 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_40,
FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled
version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:42555)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkN-00031Z-C5
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:27 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56414)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkL-0001be-U6
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YOBkH-0002zv-RO
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:25 -0500
Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:38227)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkH-0002zj-Ln
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:21 -0500
Received: by mail-wi0-f178.google.com with SMTP id em10so5015322wid.5
for ; Wed, 18 Feb 2015 13:01:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=from:to:subject:date:message-id:mime-version:content-type;
bh=d6HSs/NnCIBopOsrRK2RjiwPTQ/sdes7EzQTrtcb2VM=;
b=dPkXREGohk/Vs713oB81l+DQvS4Xm4nUob1oWTqkkAH/TqNbY7nfZfDZmxq3wyWcAH
J3tGVievObxTAoUt+sh00fHP5JEC48o9uezGG69wyqmWQHlv4vPNaHXyTEkAgjIU9oKk
nsDRj7ZuAB1hHzGHMsltVmP1xXyTn0IkY8m+GlrbK6GHFJgxuC70eQlh8GtLJBNLjKSC
0GzS1icJfDpZYgoxjscW0cI8ejV41I1/UudAc/u1OYXn7VYi9RgATJnu2qwnzom3DIjM
fFamjaX4wQwd7xRjfsDEtz2nb1kzq80M/Dq00d2VN2DdHZHdVh5IU4DhQZUl/1kuvnKm
esrQ==
X-Received: by 10.194.103.228 with SMTP id fz4mr2530744wjb.82.1424293279395;
Wed, 18 Feb 2015 13:01:19 -0800 (PST)
Received: from phst2.muc.corp.google.com ([2620:0:1046:0:6413:8898:8dd2:490c])
by mx.google.com with ESMTPSA id
dx11sm31400953wjb.23.2015.02.18.13.01.18 for
(version=TLSv1.2 cipher=RC4-SHA bits=128/128);
Wed, 18 Feb 2015 13:01:18 -0800 (PST)
From: Philipp Stephani
Date: Wed, 18 Feb 2015 21:58:42 +0100
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
(bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
(bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.8 (---)
This has been discussed in
https://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00381.html.
To reproduce:
$ emacs -Q -batch -eval '(error "foo")' < /dev/null ; echo $?
foo
255
$ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
37
$ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' <<< nil ; echo $?
Lisp expression: 37
$ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
Lisp expression: Error reading from stdin
0
$ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' < /dev/null ; echo $?
Lisp expression: 0
The examples with nonzero exit code are as expected. The examples with
zero exit code are unexpected. They are caused by the code
if (feof (stdin))
arg = Qt;
in Fkill_emacs. This behavior confuses e.g. unit tests runners that
rely on a precise exit code.
It is not documented in the documentation for kill-emacs.
In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
of 2014-03-07 on lamiak, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS
Configured using:
`configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x r e p o r t - e m
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
From unknown Sun Jun 22 03:56:49 2025
MIME-Version: 1.0
X-Mailer: MIME-tools 5.503 (Entity 5.503)
X-Loop: help-debbugs@gnu.org
From: help-debbugs@gnu.org (GNU bug Tracking System)
To: Philipp Stephani
Subject: bug#19897: closed (Re: bug#19897: 24.3; Emacs exits with exit
code 0 if EOF of stdin has been reached)
Message-ID:
References: <83twyi539j.fsf@gnu.org>
X-Gnu-PR-Message: they-closed 19897
X-Gnu-PR-Package: emacs
Reply-To: 19897@debbugs.gnu.org
Date: Wed, 18 Feb 2015 21:17:02 +0000
Content-Type: multipart/mixed; boundary="----------=_1424294222-2962-1"
This is a multi-part message in MIME format...
------------=_1424294222-2962-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
Your bug report
#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 19897@debbugs.gnu.org.
--=20
19897: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19897
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
------------=_1424294222-2962-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Received: (at 19897-done) by debbugs.gnu.org; 18 Feb 2015 21:16:33 +0000
Received: from localhost ([127.0.0.1]:48137 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from )
id 1YOByz-0000l3-GT
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:16:33 -0500
Received: from mtaout22.012.net.il ([80.179.55.172]:60274)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from ) id 1YOByw-0000kt-Cz
for 19897-done@debbugs.gnu.org; Wed, 18 Feb 2015 16:16:31 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
a-mtaout22.012.net.il (HyperSendmail v2007.08) id
<0NJZ00M00KBELE00@a-mtaout22.012.net.il> for 19897-done@debbugs.gnu.org;
Wed, 18 Feb 2015 23:16:28 +0200 (IST)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il
(HyperSendmail v2007.08) with ESMTPA id
<0NJZ00MJAKFGJK20@a-mtaout22.012.net.il>;
Wed, 18 Feb 2015 23:16:28 +0200 (IST)
Date: Wed, 18 Feb 2015 23:16:40 +0200
From: Eli Zaretskii
Subject: Re: bug#19897: 24.3;
Emacs exits with exit code 0 if EOF of stdin has been reached
In-reply-to:
X-012-Sender: halo1@inter.net.il
To: Philipp Stephani
Message-id: <83twyi539j.fsf@gnu.org>
References:
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 19897-done
Cc: 19897-done@debbugs.gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: Eli Zaretskii
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: 1.0 (+)
> From: Philipp Stephani
> Date: Wed, 18 Feb 2015 21:58:42 +0100
>
> This has been discussed in
> https://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00381.html.
>
> To reproduce:
>
> $ emacs -Q -batch -eval '(error "foo")' < /dev/null ; echo $?
> foo
> 255
>
> $ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
> 37
>
> $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' <<< nil ; echo $?
> Lisp expression: 37
>
> $ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
> Lisp expression: Error reading from stdin
> 0
>
> $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' < /dev/null ; echo $?
> Lisp expression: 0
>
> The examples with nonzero exit code are as expected. The examples with
> zero exit code are unexpected. They are caused by the code
>
> if (feof (stdin))
> arg = Qt;
>
> in Fkill_emacs. This behavior confuses e.g. unit tests runners that
> rely on a precise exit code.
> It is not documented in the documentation for kill-emacs.
Fixed in commit 7932d06 on master branch.
------------=_1424294222-2962-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Received: (at submit) by debbugs.gnu.org; 18 Feb 2015 21:01:31 +0000
Received: from localhost ([127.0.0.1]:48128 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from )
id 1YOBkQ-0000P6-Go
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:30 -0500
Received: from eggs.gnu.org ([208.118.235.92]:54714)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from ) id 1YOBkO-0000Oy-Kb
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:29 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YOBkN-00031f-F1
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:28 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_40,
FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled
version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:42555)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkN-00031Z-C5
for submit@debbugs.gnu.org; Wed, 18 Feb 2015 16:01:27 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56414)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkL-0001be-U6
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:27 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1YOBkH-0002zv-RO
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:25 -0500
Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:38227)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from ) id 1YOBkH-0002zj-Ln
for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:01:21 -0500
Received: by mail-wi0-f178.google.com with SMTP id em10so5015322wid.5
for ; Wed, 18 Feb 2015 13:01:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=from:to:subject:date:message-id:mime-version:content-type;
bh=d6HSs/NnCIBopOsrRK2RjiwPTQ/sdes7EzQTrtcb2VM=;
b=dPkXREGohk/Vs713oB81l+DQvS4Xm4nUob1oWTqkkAH/TqNbY7nfZfDZmxq3wyWcAH
J3tGVievObxTAoUt+sh00fHP5JEC48o9uezGG69wyqmWQHlv4vPNaHXyTEkAgjIU9oKk
nsDRj7ZuAB1hHzGHMsltVmP1xXyTn0IkY8m+GlrbK6GHFJgxuC70eQlh8GtLJBNLjKSC
0GzS1icJfDpZYgoxjscW0cI8ejV41I1/UudAc/u1OYXn7VYi9RgATJnu2qwnzom3DIjM
fFamjaX4wQwd7xRjfsDEtz2nb1kzq80M/Dq00d2VN2DdHZHdVh5IU4DhQZUl/1kuvnKm
esrQ==
X-Received: by 10.194.103.228 with SMTP id fz4mr2530744wjb.82.1424293279395;
Wed, 18 Feb 2015 13:01:19 -0800 (PST)
Received: from phst2.muc.corp.google.com ([2620:0:1046:0:6413:8898:8dd2:490c])
by mx.google.com with ESMTPSA id
dx11sm31400953wjb.23.2015.02.18.13.01.18 for
(version=TLSv1.2 cipher=RC4-SHA bits=128/128);
Wed, 18 Feb 2015 13:01:18 -0800 (PST)
From: Philipp Stephani
To: bug-gnu-emacs@gnu.org
Subject: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached
Date: Wed, 18 Feb 2015 21:58:42 +0100
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
(bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
(bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.8 (---)
This has been discussed in
https://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00381.html.
To reproduce:
$ emacs -Q -batch -eval '(error "foo")' < /dev/null ; echo $?
foo
255
$ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
37
$ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' <<< nil ; echo $?
Lisp expression: 37
$ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
Lisp expression: Error reading from stdin
0
$ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))' < /dev/null ; echo $?
Lisp expression: 0
The examples with nonzero exit code are as expected. The examples with
zero exit code are unexpected. They are caused by the code
if (feof (stdin))
arg = Qt;
in Fkill_emacs. This behavior confuses e.g. unit tests runners that
rely on a precise exit code.
It is not documented in the documentation for kill-emacs.
In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
of 2014-03-07 on lamiak, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS
Configured using:
`configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
'--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
'--localstatedir=/var/lib' '--infodir=/usr/share/info'
'--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
'CPPFLAGS=-D_FORTIFY_SOURCE=2''
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x r e p o r t - e m
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
------------=_1424294222-2962-1--
From unknown Sun Jun 22 03:56:49 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#19897: 24.3; Emacs exits with exit code 0 if EOF of stdin has been reached
In-Reply-To:
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 19 Feb 2015 11:48:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 19897
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Eli Zaretskii
Cc: 19897-done@debbugs.gnu.org
Received: via spool by 19897-done@debbugs.gnu.org id=D19897.142434645015853
(code D ref 19897); Thu, 19 Feb 2015 11:48:02 +0000
Received: (at 19897-done) by debbugs.gnu.org; 19 Feb 2015 11:47:30 +0000
Received: from localhost ([127.0.0.1]:48420 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from )
id 1YOPZp-00047d-7e
for submit@debbugs.gnu.org; Thu, 19 Feb 2015 06:47:29 -0500
Received: from mail-la0-f47.google.com ([209.85.215.47]:36010)
by debbugs.gnu.org with esmtp (Exim 4.80)
(envelope-from ) id 1YOPZn-00047U-5s
for 19897-done@debbugs.gnu.org; Thu, 19 Feb 2015 06:47:27 -0500
Received: by labgq15 with SMTP id gq15so7081542lab.3
for <19897-done@debbugs.gnu.org>; Thu, 19 Feb 2015 03:47:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:references:from:date:message-id:subject:to:cc
:content-type; bh=4Ug4+seQDRd2sTN7Fe29pMONzJ+0DnQPKu3kJNlNRZU=;
b=Uerg3N5IBW+OBppzJcEoYLCIKDEdmp06Ai3etTsqTMGCsJ+LwPKLJCIAAg3TkOXRPm
vQE98DqiV/tw4kjEDGpkToC9mOb63jyDS305zNZ2GE4omwO5aGODU2r31qTtxqzD1LfS
5z10weAvH1dbcLlC1zTlx6NA1sX/AbTqANIbS/9nWim3YjIOMM+B/Uhg5GWyO/xCV8oi
tQc6+n1OzvzRubND0bSPBeKydgaJGCeP8UgSgpNeXGyzZiNrYxRAf1MpXi79ugHwZ05D
nyzyIzTcGK58ngXXi8Ufk+mCpeZZwpXtxcWjXaXrQsqlhwSBKKAfIqFldgM/yjrFGcqB
M3sA==
X-Received: by 10.112.64.2 with SMTP id k2mr3736459lbs.54.1424346446371; Thu,
19 Feb 2015 03:47:26 -0800 (PST)
MIME-Version: 1.0
References:
<83twyi539j.fsf@gnu.org>
From: Philipp Stephani
Date: Thu, 19 Feb 2015 11:47:25 +0000
Message-ID:
Content-Type: multipart/alternative; boundary=001a11c3fc3cf9247a050f6f7f0c
X-Spam-Score: -0.4 (/)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.4 (/)
--001a11c3fc3cf9247a050f6f7f0c
Content-Type: text/plain; charset=UTF-8
Eli Zaretskii schrieb am Wed Feb 18 2015 at 10:16:29 PM:
> > From: Philipp Stephani
> > Date: Wed, 18 Feb 2015 21:58:42 +0100
> >
> > This has been discussed in
> > https://lists.gnu.org/archive/html/help-gnu-emacs/2015-02/msg00381.html.
> >
> > To reproduce:
> >
> > $ emacs -Q -batch -eval '(error "foo")' < /dev/null ; echo $?
> > foo
> > 255
> >
> > $ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; echo $?
> > 37
> >
> > $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))'
> <<< nil ; echo $?
> > Lisp expression: 37
> >
> > $ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
> > Lisp expression: Error reading from stdin
> > 0
> >
> > $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs 37))'
> < /dev/null ; echo $?
> > Lisp expression: 0
> >
> > The examples with nonzero exit code are as expected. The examples with
> > zero exit code are unexpected. They are caused by the code
> >
> > if (feof (stdin))
> > arg = Qt;
> >
> > in Fkill_emacs. This behavior confuses e.g. unit tests runners that
> > rely on a precise exit code.
> > It is not documented in the documentation for kill-emacs.
>
> Fixed in commit 7932d06 on master branch.
>
Thanks for the speedy fix. Confirming that this fixes my problem.
--001a11c3fc3cf9247a050f6f7f0c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Eli =
Zaretskii <
eliz@gnu.org> schrieb =
am Wed Feb 18 2015 at 10:16:29 PM:
> F=
rom: Philipp Stephani <p.stephani2@gmail.com>
> Date: Wed, 18 Feb 2015 21:58:42 +0100
>
> This has been discussed in
> https://lists.gnu.org/archive/html/h=
elp-gnu-emacs/2015-02/msg00381.html.
>
> To reproduce:
>
> $ emacs -Q -batch -eval '(error "foo")' < /dev/nu=
ll ; echo $?
> foo
> 255
>
> $ emacs -Q -batch -eval '(kill-emacs 37)' < /dev/null ; ech=
o $?
> 37
>
> $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs=
37))' <<< nil ; echo $?
> Lisp expression: 37
>
> $ emacs -Q -batch -eval '(read)' < /dev/null ; echo $?
> Lisp expression: Error reading from stdin
> 0
>
> $ emacs -Q -batch -eval '(progn (ignore-errors (read)) (kill-emacs=
37))' < /dev/null ; echo $?
> Lisp expression: 0
>
> The examples with nonzero exit code are as expected.=C2=A0 The example=
s with
> zero exit code are unexpected.=C2=A0 They are caused by the code
>
>=C2=A0 =C2=A0if (feof (stdin))
>=C2=A0 =C2=A0 =C2=A0arg =3D Qt;
>
> in Fkill_emacs.=C2=A0 This behavior confuses e.g. unit tests runners t=
hat
> rely on a precise exit code.
> It is not documented in the documentation for kill-emacs.
Fixed in commit 7932d06 on master branch.
Thanks for the speedy fix. Confirming that this fixes my problem.=C2=A0<=
/div>
--001a11c3fc3cf9247a050f6f7f0c--