[gnu.bash.bug] Asynchronous notify in bash V1.04.

bin@ic.cmc.ca (Local Utilities) (12/04/89)

	This bug report falls into the category of a "philosophical",
since my complains are with the way asynchronous notify works in
bash.  One of the things I don't like happens when a process stops
(for tty output, input, etc).  Bash informs me that the current
directory is the working directory of the job (if different from
the current working directory), only to have it tell me immediately
after that I am back into my original directory.  The other complaint
I have is that when a process stops, bash doesn't make the stopped
process the current process (so you can use %+ to bring it to the
foreground).  I know it is the way the csh works, but I find it
very useful.

	I have enclosed context diffs for "jobs.c" (version 1.04
of bash).  The fixes seem to achieve the desired effect.

					Bruce Keats
					Dept. of Electrical Engineering
					Queen's University
					bruce@eleceng.ee.queensu.ca
					bruce@ic.cmc.ca (preferred)


===================================================================
RCS file: RCS/jobs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1a07221	Sun Dec  3 20:12:42 1989
--- /tmp/,RCSt2a07221	Sun Dec  3 20:12:43 1989
***************
*** 539,545 ****
  
        fprintf (stream, "%s", p->command);
  
!       if (p->next == jobs[index]->pipe) 
  	{
  	  if (JOBSTATE (index) == JRUNNING && jobs[index]->foreground == 0)
  	    fprintf (stream, " &");
--- 539,545 ----
  
        fprintf (stream, "%s", p->command);
  
!       if (p->next == jobs[index]->pipe && JOBSTATE(index) != JSTOPPED) 
  	{
  	  if (JOBSTATE (index) == JRUNNING && jobs[index]->foreground == 0)
  	    fprintf (stream, " &");
***************
*** 1241,1246 ****
--- 1241,1248 ----
  			{
  			  jobs[job]->state = JSTOPPED;
  			  jobs[job]->foreground = 0;
+ 			  /* make the stopped job the current job */
+ 			  set_current_job(job);
  			}
  		      else
  			{
***************
*** 1314,1322 ****
--- 1316,1326 ----
  	    case JSTOPPED:
  	      fprintf (stderr, "\n");
  	      pretty_print_job (job, 0, stderr);
+ #ifdef notdef
  	      if (dir && (strcmp (dir, jobs[job]->wd) != 0))
  		fprintf (stderr,
  			 "(wd now: %s)\n", polite_directory_format (dir));
+ #endif /* notdef */
  	      jobs[job]->notified = 1;
  	      break;