From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5315 invoked from network); 10 Jul 2009 09:10:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 10 Jul 2009 09:10:19 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 5500 invoked from network); 10 Jul 2009 09:02:55 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Jul 2009 09:02:55 -0000 Received: (qmail 29197 invoked by alias); 10 Jul 2009 09:02:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27119 Received: (qmail 29168 invoked from network); 10 Jul 2009 09:02:41 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 Jul 2009 09:02:41 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 52D4B80307FA for ; Fri, 10 Jul 2009 11:02:36 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly26g.srv.mailcontrol.com (MailControl) with ESMTP id n6A92K7P010396 for ; Fri, 10 Jul 2009 10:02:31 +0100 Received: from news01 ([10.99.50.25]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Fri, 10 Jul 2009 09:58:13 +0100 Date: Fri, 10 Jul 2009 09:58:13 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: non-interactive set -m Message-ID: <20090710095813.4cc774b0@news01> In-Reply-To: References: <200907080858.n688wXfc030608@news01.csr.com> <200907081349.n68DneSv001850@news01.csr.com> <20090709212345.05cc2213@pws-pc> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 Jul 2009 08:58:13.0216 (UTC) FILETIME=[8E657600:01CA013C] X-Scanned-By: MailControl A-09-20-00 (www.mailcontrol.com) on 10.71.0.136 X-Virus-Scanned: ClamAV 0.94.2/9551/Thu Jul 9 15:22:08 2009 on bifrost X-Virus-Status: Clean On Thu, 9 Jul 2009 21:40:19 +0000 (UTC) Eric Blake wrote: > POSIX states that fg output goes to stdout, not stderr. >... > It looks like two different sources of noise - creating the background task is > outputting information about the job just created, which should really be > conditional on being interactive (a non-interactive shell will use 'jobs' to > learn this information, rather than having it printed to stderr). The > other source of noise is that fg is writing to stderr instead of the > required stdout. It looks like you didn't want the other "if (interact)" removing. This should fix these two. > Also, POSIX states that fg output should be the name of the command that was > brought into the foreground, and not the 'jobs' output describing that > command. Haven't looked at this, but as an annoying fiddly difference it probably needs to be an option. Index: Src/jobs.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v retrieving revision 1.67 diff -u -r1.67 jobs.c --- Src/jobs.c 9 Jul 2009 20:33:56 -0000 1.67 +++ Src/jobs.c 10 Jul 2009 08:56:26 -0000 @@ -828,7 +828,7 @@ int job, len = 9, sig, sflag = 0, llen; int conted = 0, lineleng = columns, skip = 0, doputnl = 0; int doneprint = 0; - FILE *fout = (synch == 2) ? stdout : shout ? shout : stderr; + FILE *fout = (synch == 2 || !shout) ? stdout : shout; if (oldjobtab != NULL) job = jn - oldjobtab; @@ -886,8 +886,8 @@ /* print if necessary: ignore option state on explicit call to `jobs'. */ - if (synch == 2 || - (jobbing && + if (synch == 2 || + (interact && jobbing && ((jn->stat & STAT_STOPPED) || sflag || job != thisjob))) { int len2, fline = 1; /* use special format for current job, except in `jobs' */ @@ -1380,7 +1380,7 @@ } else if (prevjob == -1 || !(jobtab[prevjob].stat & STAT_STOPPED)) prevjob = thisjob; if (jobbing && jobtab[thisjob].procs) { - FILE *fout = shout ? shout : stderr; + FILE *fout = shout ? shout : stdout; fprintf(fout, "[%d]", thisjob); for (pn = jobtab[thisjob].procs; pn; pn = pn->next) fprintf(fout, " %ld", (long) pn->pid); @@ -1908,8 +1908,7 @@ printjob(jobtab + job, (stopped) ? -1 : lng, 1); if (func != BIN_BG) { /* fg or wait */ if (jobtab[job].pwd && strcmp(jobtab[job].pwd, pwd)) { - FILE *fout = (func == BIN_JOBS) ? stdout : shout ? - shout : stderr; + FILE *fout = (func == BIN_JOBS || !shout) ? stdout : shout; fprintf(fout, "(pwd : "); fprintdir(jobtab[job].pwd, fout); fprintf(fout, ")\n"); -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070