Re: [PATCH] test: use dtach(1) instead of screen(1) in emacs tests.
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 11 Nov 2011 11:29:48 +0000 (13:29 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:04 +0000 (09:40 -0800)
f2/06c00c405e7c1d14ca1b1d669f1ee6623bc536 [new file with mode: 0644]

diff --git a/f2/06c00c405e7c1d14ca1b1d669f1ee6623bc536 b/f2/06c00c405e7c1d14ca1b1d669f1ee6623bc536
new file mode 100644 (file)
index 0000000..e30ece0
--- /dev/null
@@ -0,0 +1,173 @@
+Return-Path: <tomi.ollila@nixu.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 25E36431FD0\r
+       for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 03:30:00 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id KCszDFmBLBGt for <notmuch@notmuchmail.org>;\r
+       Fri, 11 Nov 2011 03:29:59 -0800 (PST)\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DBD0C431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 11 Nov 2011 03:29:58 -0800 (PST)\r
+Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
+       by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
+       pABBTmmw000575; Fri, 11 Nov 2011 13:29:49 +0200\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>,\r
+       Tomi Ollila <tomi.ollila@iki.fi>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] test: use dtach(1) instead of screen(1) in emacs tests.\r
+In-Reply-To: <877h373vbs.fsf@gmail.com>\r
+References: <yf6mxc3ab4t.fsf@taco2.nixu.fi>\r
+       <1320963737-1666-1-git-send-email-jrollins@finestructure.net>\r
+       <877h373vbs.fsf@gmail.com>\r
+User-Agent: Notmuch/0.9+23~g556c5fa (http://notmuchmail.org) Emacs/23.3.1\r
+       (i686-pc-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Fri, 11 Nov 2011 13:29:48 +0200\r
+Message-ID: <yf67h36ew2b.fsf@taco2.nixu.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 11 Nov 2011 11:30:00 -0000\r
+\r
+On Fri, 11 Nov 2011 12:41:11 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
+> Hi Tomi.\r
+> \r
+> On Thu, 10 Nov 2011 14:22:17 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
+> > From: Tomi Ollila <tomi.ollila@iki.fi>\r
+> > \r
+> > dtach is lighter than screen and is not setuid/setgid program so\r
+> > TMPDIR does not get reset by dynamic loader when executed.\r
+> > \r
+> > Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>\r
+> > ---\r
+> > This tweaks the original patch slightly by removing the no-longer needed\r
+> > screenrc variables.\r
+> > \r
+> >  test/test-lib.sh |    5 ++---\r
+> >  1 files changed, 2 insertions(+), 3 deletions(-)\r
+> > \r
+> > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+> > index c81c709..c0fe037 100755\r
+> > --- a/test/test-lib.sh\r
+> > +++ b/test/test-lib.sh\r
+> > @@ -50,8 +50,6 @@ TZ=UTC\r
+> >  TERM=dumb\r
+> >  export LANG LC_ALL PAGER TERM TZ\r
+> >  GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\r
+> > -export SCREENRC=/dev/null\r
+> > -export SYSSCREENRC=/dev/null\r
+> >  \r
+> >  # Protect ourselves from common misconfiguration to export\r
+> >  # CDPATH into the environment\r
+> > @@ -844,7 +842,8 @@ test_emacs () {\r
+> >    if [ -z "$EMACS_SERVER" ]; then\r
+> >            EMACS_SERVER="notmuch-test-suite-$$"\r
+> >            # start a detached screen session with an emacs server\r
+> > -          screen -S "$EMACS_SERVER" -d -m "$TMP_DIRECTORY/run_emacs" \\r
+> > +          TERM=xterm dtach -n "$TMP_DIRECTORY/dtach-emacs-socket-$$" \\r
+> \r
+> Can you please give a more detailed explanation (and a comment) to\r
+> justify this workaround:\r
+> \r
+> * Is it actually needed for dtach or emacs?  If it is the latter, then\r
+>   it should be "dtach ... env TERM=xterm emacs ...", right?\r
+\r
+dtach doesn't care about TERM, it is emacs which does (as you noticed\r
+below). But it is bood that the TERM is same in dtach's environment.\r
+\r
+doing VAR=val command args instead of env VAR=val saves one execve(2)\r
+as the shell does the environment setting (after fork before execve)\r
+> \r
+> * Why should we care about systems that use terminals without\r
+>   corresponding terminfo installed?\r
+\r
+That's the issue I thought, armdragon on IRC thought etc. The 'xterm'\r
+is part of ncurses-base on Debian, at least (thanks armdragon for this\r
+info) and is it pretty much as base to every terminal emulator there is \r
+(I just launched gnome-terminal for testing, TERM was set to xterm --\r
+it may have been initially in environment but if gnome-terminal changed\r
+it before launching shell, my shell config will not change it)\r
+\r
+> * Why is it safe to use xterm?  Is there any standard that requires\r
+>   xterm info to be present on the system?\r
+\r
+xterm is not needed, it is just to tell emacs it can use it's display\r
+control sequences. more common alternative would have been vt100, just\r
+that if one ever wants to attach to that emacs session you he gets\r
+better experience (such as colors), using any terminal emulator, like rxvt.\r
+\r
+> I have tried running dtach with emacs in rxvt-unicode and it worked fine\r
+> without overriding TERM.\r
+\r
+you had originally suitable TERM to be passed to emacs.\r
+\r
+> \r
+> I have also tried running dtach with invalid TERM:\r
+> \r
+>   $ TERM=non-existing-term dtach -n s /bin/sh\r
+>   zsh: can't find terminal definition for non-existing-term\r
+> \r
+> No segfault, shell is started fine.\r
+\r
+Yes, dtach could not care less...\r
+\r
+> \r
+> But emacs does not work without a valid terminfo:\r
+> \r
+>   $ TERM=non-existing-term emacs -nw\r
+>   emacs: Terminal type non-existing-term is not defined.\r
+>   If that is not the actual type of terminal you have,\r
+>   use the Bourne shell command `TERM=... export TERM' (C-shell:\r
+>   `setenv TERM ...') to specify the correct type.  It may be necessary\r
+>   to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.\r
+\r
+Yes, I got SIGSEGV --  strace -o oprfx -ff command args  is your friend :D\r
+\r
+> Regards,\r
+>   Dmitry\r
+\r
+Thanks for your analysis. \r
+\r
+Tomi\r
+\r
+> \r
+> > +                  "$TMP_DIRECTORY/run_emacs" \\r
+> >                    --no-window-system \\r
+> >                    --eval "(setq server-name \"$EMACS_SERVER\")" \\r
+> >                    --eval '(server-start)' \\r
+> > -- \r
+> > 1.7.7.1\r
+> > \r
+> > _______________________________________________\r
+> > notmuch mailing list\r
+> > notmuch@notmuchmail.org\r
+> > http://notmuchmail.org/mailman/listinfo/notmuch\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+> \r