Opened 5 years ago

Closed 5 years ago

#18401 closed defect (fixed)

maple command broken through ssh

Reported by: vdelecroix Owned by:
Priority: major Milestone: sage-6.7
Component: interfaces Keywords:
Cc: Merged in:
Authors: Vincent Delecroix Reviewers: Leif Leonhardy
Report Upstream: N/A Work issues:
Branch: dab09f3 (Commits) Commit: dab09f30938b2a3bfdba285f757dd2664667a4bf
Dependencies: Stopgaps:

Description (last modified by leif)

The maple command does contain some options. Our pexpect interface does not work when this is used through ssh. The command used to launch maple through a ssh tunnel by pexpect is

$ sage-native-execute ssh -t REMOTE \
 maple -t -c "interface(screenwidth=infinity,errorcursor=false)"

But this does not work because the double quotes get removed before sending the command to the remote server.

Using instead

$ sage-native-execute ssh -t REMOTE \
 'maple -t -c "interface(screenwidth=infinity,errorcursor=false)"'

works as a charm.

We modify sage/interfaces/expect.py by adding single quotes to guard the command when an intermediate server is involved.

Change History (10)

comment:1 Changed 5 years ago by vdelecroix

  • Branch set to u/vdelecroix/18401
  • Commit set to 1c71a060202783324a3b5ce1d0e143aacc81a14e
  • Status changed from new to needs_review

New commits:

1c71a06Trac #18401: fix command for interfaces through ssh

comment:2 Changed 5 years ago by leif

Yep, expect.py is to fix, not maple.py. (Otherwise a local maple would no longer work.)

The problem when using ssh (or likewise, sh -c ...) is that the parameters get interpreted twice; once by the local shell, and a second time by the remote (or sub-) shell.

The local one removes the double quotes, passing literally maple -t -c interface(screenwidth=infinity,errorcursor=false) to the remote shell, which gives a syntax error since the parentheses are no longer quoted nor escaped to avoid interpretation.

sh -c 'maple -t -c interface(screenwidth=infinity,errorcursor=false)'

would give exactly the same error, while

sh -c 'maple -t -c interface\(screenwidth=infinity,errorcursor=false\)'

would work.

(So it does not depend on the computer, unless the remote shell were some strange non-standard one not treating the parentheses as special characters...)

comment:3 Changed 5 years ago by leif

I'd still use either single quotes or double quotes in both cases, the difference being where environment variables would be evaluated.

comment:4 Changed 5 years ago by git

  • Commit changed from 1c71a060202783324a3b5ce1d0e143aacc81a14e to dab09f30938b2a3bfdba285f757dd2664667a4bf

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

dab09f3Trac #18401: fix expect.py to work through ssh

comment:5 Changed 5 years ago by vdelecroix

  • Description modified (diff)
  • Summary changed from maple command broken (on some computer) to maple command broken through ssh

comment:6 Changed 5 years ago by vdelecroix

Hi Leif,

Thanks for your clarification!

I added simple quotes to both cases when ssh is involved (with or without ulimit). I also added the option ulimit to our maple interface. Both works for me (even with a gate in between).

Vincent

comment:7 Changed 5 years ago by leif

  • Description modified (diff)
  • Reviewers set to Leif Leonhardy
  • Status changed from needs_review to positive_review

comment:8 Changed 5 years ago by leif

  • Description modified (diff)

comment:9 Changed 5 years ago by vdelecroix

Thanks!

comment:10 Changed 5 years ago by vbraun

  • Branch changed from u/vdelecroix/18401 to dab09f30938b2a3bfdba285f757dd2664667a4bf
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.