zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: fg call in function: bug?
Date: Mon, 6 Nov 2006 12:27:10 +0000	[thread overview]
Message-ID: <20061106122710.f1376134.pws@csr.com> (raw)
In-Reply-To: <17393e3e0611031715m7a189c43t46f5b0807490f129@mail.gmail.com>

"Matt Wozniski" <godlygeek@gmail.com> wrote:
> Ok, I have an even weirder test case for the "job control in cursh
> construct" bug... No arguments, %-, %+, and even %2 work as expected,
> but %1 doesn't?
> 
> ~>{ jobs %1 }
> ~>jobs %1
> jobs: %1: no such job

Just to complete the story...  "jobs" on its own is simply a builtin and
doesn't cause the special logic to create a pseudojob, while in braces it
becomes a construct that gets special handling.  It's usually job 1 because that's
the first that's free; as it's special it doesn't cause %- or %+ to be set.

This is fixed by the patch that I just posted, but I noticed that the form
of error is different for no good reason, so I'll put that right, too.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.104
diff -u -r1.104 exec.c
--- Src/exec.c	17 Sep 2006 19:28:46 -0000	1.104
+++ Src/exec.c	6 Nov 2006 12:24:04 -0000
@@ -2265,7 +2265,7 @@
 	/* This is a current shell procedure that didn't need to fork.    *
 	 * This includes current shell procedures that are being exec'ed, *
 	 * as well as null execs.                                         */
-	jobtab[thisjob].stat |= STAT_CURSH;
+	jobtab[thisjob].stat |= STAT_CURSH|STAT_NOPRINT;
     } else {
 	/* This is an exec (real or fake) for an external command.    *
 	 * Note that any form of exec means that the subshell is fake *
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.49
diff -u -r1.49 jobs.c
--- Src/jobs.c	3 Nov 2006 19:44:47 -0000	1.49
+++ Src/jobs.c	6 Nov 2006 12:24:05 -0000
@@ -1771,7 +1771,7 @@
 	}
 	if (!(jobtab[job].stat & STAT_INUSE) ||
 	    (jobtab[job].stat & STAT_NOPRINT)) {
-	    zwarnnam(name, "no such job: %d", job);
+	    zwarnnam(name, "%%%d: no such job", job);
 	    unqueue_signals();
 	    return 1;
 	}

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


  parent reply	other threads:[~2006-11-06 12:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-04  0:39 Matt Wozniski
2006-11-04  1:15 ` Matt Wozniski
2006-11-04  2:50   ` Bart Schaefer
     [not found]     ` <17393e3e0611031856v21f9bc19k9a9f25ff5ef002ba@mail.gmail.com>
2006-11-04  2:57       ` Matt Wozniski
2006-11-04 18:10         ` Bart Schaefer
2006-11-06 12:27   ` Peter Stephenson [this message]
2006-11-06 12:22 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061106122710.f1376134.pws@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).