Opened 12 years ago

Closed 7 years ago

#8471 closed defect (duplicate)

Upgrade or patch pexpect

Reported by: saliola Owned by: saliola
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: interfaces Keywords: pexpect
Cc: Merged in:
Authors: Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Specifying the full path of a command to Expect hits a bug in the pexpect module shipped with Sage:

karkwa: which sage

karkwa: sage
| Sage Version 4.3.3, Release Date: 2010-02-21                       |
| Type notebook() for the GUI, and license() for information.        |
sage: from sage.interfaces.expect import Expect
sage: s = Expect('sage', 'sage> ', command='/home/saliola/Applications/bin/sage')
sage: s.is_running()
sage: s._start()
UnboundLocalError                         Traceback (most recent call last)

/home/saliola/Applications/sage-4.3.3/data/extcode/sage/<ipython console> in <module>()

/home/saliola/Applications/sage-4.3.3/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in _start(self, alt_message, block_during_init)
    447                 c = 'sage-native-execute  ssh %s "nohup sage -cleaner"  &'%self._server
    448                 os.system(c)
--> 449             self._expect = pexpect.spawn(cmd, logfile=self.__logfile)
    450             if self._do_cleaner():
    451                 cleaner.cleaner(, cmd)

/home/saliola/Applications/sage-4.3.3/local/lib/python2.6/site-packages/pexpect.pyc in __init__(self, command, args, timeout, maxread, searchwindowsize, logfile)
    324             self.command = command
--> 326         command_with_path = which(self.command)
    327         if command_with_path == None:
    328             raise ExceptionPexpect ('The command was not found or was not executable: %s.' % self.command)

/home/saliola/Applications/sage-4.3.3/local/lib/python2.6/site-packages/pexpect.pyc in which(filename)
   1131     # Special case where filename already contains a path.

   1132     if os.path.dirname(filename) != '':
-> 1133         if os.access (filename, os.X_OK) and not os.path.isdir(f):
   1134             return filename

UnboundLocalError: local variable 'f' referenced before assignment

Note that this is a bug in the pexpect Python module shipped with Sage.

sage: import pexpect
sage: pexpect.__version__

It appears to be fixed in the newest version of pexpect (version 2.3).

Should we patch pexpect or upgrade?

Change History (10)

comment:1 Changed 12 years ago by saliola

  • Owner changed from was to saliola

We discussed this a bit on sage-devel:

Some highlights:

  • William Stein pointed out that pexpect was rewritten after 2.0 and has had some performance issues; it is worth trying the latest version of pexpect to see if the situation has improved.
  • Robert Bradshaw pointed out that we need to add a blurb to pexpect's SPKG.txt explaining this issue.

So these should be addressed appropriately by this ticket.

comment:2 Changed 12 years ago by saliola

The file at #8380 contains a reference to this ticket. When this issues is resolved, the comment in that file should be changed appropriately.

comment:3 Changed 12 years ago by saliola

  • Work issues set to address the second comment

comment:4 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:5 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:6 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:8 Changed 7 years ago by leif

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

Duplicate of #10295.

comment:9 Changed 7 years ago by vdelecroix

  • Reviewers set to Vincent Delecroix
  • Status changed from needs_review to positive_review
  • Work issues address the second comment deleted

comment:10 Changed 7 years ago by vbraun

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.