From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#19897: 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: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1424293340 29549 80.91.229.3 (18 Feb 2015 21:02:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2015 21:02:20 +0000 (UTC) To: 19897@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 18 22:02:10 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YOBl3-0008FQ-0m for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Feb 2015 22:02:09 +0100 Original-Received: from localhost ([::1]:53027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOBl2-0001n3-1v for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Feb 2015 16:02:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOBky-0001mH-1x for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:02:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOBkw-0003UL-Mc for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:02:04 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOBkw-0003UH-K2 for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YOBkw-0000Px-Dx for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2015 16:02:02 -0500 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14242932911561 (code B ref -1); Wed, 18 Feb 2015 21:02:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Feb 2015 21:01:31 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99566 Archived-At: 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)