[minicom-Bugs][312517] scripts never exit -- minicom hangs

minicom-bugs at alioth.debian.org minicom-bugs at alioth.debian.org
Tue Jun 1 18:37:43 UTC 2010


Bugs item #312517, was changed at 2010-05-27 15:05 by Jesse Gilles
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=100031&aid=312517&group_id=30018

Status: Open
Priority: 3
Submitted By: Jesse Gilles (gillesj-guest)
Assigned to: Nobody (None)
Summary: scripts never exit -- minicom hangs 
Category: None
Group: None
Resolution: None


Initial Comment:
If you run a script from within minicom while attached to a serial port, the script doesn't exit when finished. Minicom hangs indefinitely, until the user hits CTRL-C. Then the script exits and control is returned to minicom as normal. Also, any output from the commands executed by the script are only printed after the user presses CTRL-C. Adding an expiclit "exit 0" command to the script makes no difference.

This seems to be a new bug in minicom 2.4 -- I had no problems running scripts with minicom 2.3.

----------------------------------------------------------------------

Comment By: Jesse Gilles (gillesj-guest)
Date: 2010-06-01 13:37

Message:
I tested the repository version and can confirm the fix.  Thanks!

----------------------------------------------------------------------

Comment By: Adam Lackorzynski (al-guest)
Date: 2010-05-30 15:40

Message:
Thanks for the patch! I've added a slightly different fix. Could you please try the repository version? Thanks.

----------------------------------------------------------------------

Comment By: Chris Simmonds (chrissimmonds-guest)
Date: 2010-05-30 04:06

Message:
<PRE>
Hmm.. the last post doesn't look pretty. Here it is again, hopefully readable this time.


The problem is in the handling of the call to poll in updown.c. The patch below fixes it.

Bye for now
Chris.

--- minicom-2.4/src/updown.c	2010-05-30 09:55:26.754320642 +0100
+++ minicom-2.4-devel/src/updown.c	2010-05-30 09:58:35.014335459 +0100
@@ -665,7 +649,11 @@
   fds[1].fd     = STDIN_FILENO; /* stdin */
   fds[1].events = POLLIN;
   script_running = 1;
-  while (script_running && poll(fds, 2, -1) > 0)
+  while (script_running && poll(fds, 2, -1) > 0) {
+    /* Bail on events other than POLLIN from pipefd.
+       Fixes bug #312517. Chris Simmonds,  chris at 2net.co.uk */
+    if ((fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)))
+	break;
     for (i = 0; i < 2; i++)
       if ((fds[i].revents & POLLIN)
           && (n = read(fds[i].fd, buf, sizeof(buf)-1)) > 0) {
@@ -678,6 +666,7 @@
         timer_update();
         mc_wflush();
       }
+  }
 
   /* Collect status, and clean up. */
   m_wait(&status);
</PRE>

----------------------------------------------------------------------

Comment By: Chris Simmonds (chrissimmonds-guest)
Date: 2010-05-30 04:03

Message:
The problem is in the handling of the call to poll in updown.c. The patch below fixes it.

Bye for now
Chris.

--- minicom-2.4/src/updown.c	2010-05-30 09:55:26.754320642 +0100
+++ minicom-2.4-devel/src/updown.c	2010-05-30 09:58:35.014335459 +0100
@@ -665,7 +649,11 @@
   fds[1].fd     = STDIN_FILENO; /* stdin */
   fds[1].events = POLLIN;
   script_running = 1;
-  while (script_running && poll(fds, 2, -1) > 0)
+  while (script_running && poll(fds, 2, -1) > 0) {
+    /* Bail on events other than POLLIN from pipefd.
+       Fixes bug #312517. Chris Simmonds,  chris at 2net.co.uk */
+    if ((fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)))
+	break;
     for (i = 0; i < 2; i++)
       if ((fds[i].revents & POLLIN)
           && (n = read(fds[i].fd, buf, sizeof(buf)-1)) > 0) {
@@ -678,6 +666,7 @@
         timer_update();
         mc_wflush();
       }
+  }
 
   /* Collect status, and clean up. */
   m_wait(&status);


----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=100031&aid=312517&group_id=30018



More information about the minicom-devel mailing list