targetcli aborts with the error message "NameError: name 'readline' is not defined" when running in interactive shell mode

Bug #1776761 reported by Matt Coleman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-configshell-fb (Debian)
Fix Released
Unknown
python-configshell-fb (Ubuntu)
Undecided
Unassigned
Bionic
High
Unassigned

Bug Description

Reproduced with python3-configshell-fb 1.1.20-1 on fully-updated Ubuntu Server 18.04 by attempting to run targetcli via PHP using Symfony Process:

Test script (in a directory with Symfony 3.4.1 pulled in via Composer)
------------------------------------------------------------
<?php
include 'vendor/autoload.php';

$process = new \Symfony\Component\Process\Process('targetcli');
$process->setInput('ls');

$process->mustRun();

var_dump($process->getOutput());
------------------------------------------------------------

Actual output
------------------------------------------------------------
PHP Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessFailedException: The command "targetcli" failed.

Exit Code: 1(General error)

Working directory: /home/matt/reproduce

Output:
================
targetcli shell version 2.1.fb43
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

Error Output:
================
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 893, in run_interactive
    old_completer = readline.get_completer()
NameError: name 'readline' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/targetcli", line 121, in <module>
    main()
  File "/usr/bin/targetcli", line 111, in main
    shell.run_interactive()
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 899, in run_interactive
    readline.set_completer(old_completer)
NameError: name 'readline' is not defined
 in /home/matt/reproduce/vendor/symfony/ in /home/matt/reproduce/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php on line 239
------------------------------------------------------------

Expected output
------------------------------------------------------------
string(1324) "targetcli shell version 2.1.fb43
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 0]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 0]
  o- loopback ......................................................................................................... [Targets: 0]
  o- vhost ............................................................................................................ [Targets: 0]
/> exit
"
------------------------------------------------------------

I assume the package version 1.1.20 correpsonds to the project's 1.1fb20 tag on GitHub.

This bug was fixed in this commit and released in 1.1fb23: https://github.com/open-iscsi/configshell-fb/commit/82f79eb2f967ecd820d531488d0b64d6015b1aaf

The latest tagged version is 1.1fb24.

Revision history for this message
Matt Coleman (mcoleman) wrote :

I filed a bug with Debian, as well. It turns out they've already got a package 1.1.24-1 package pending upload to universe. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901484#17

Revision history for this message
Matt Coleman (mcoleman) wrote :

Correcting my last comment: Debian's updated package version is 1.1.20-2 (up from 1.1.20-1), in which the fix has been backported from the upstream commit.

https://sources.debian.org/patches/python-configshell-fb/1.1.20-2/

Revision history for this message
Matt Coleman (mcoleman) wrote :

I see that Cosmic now includes Debian's fixed 1.1.20-2 package. Can it be updated for Bionic, as well?

Changed in python-configshell-fb (Debian):
status: Unknown → Fix Released
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Fixed in 1.1.20-2 which means >= Ubuntu 19.04.

Changed in python-configshell-fb (Ubuntu):
status: New → Fix Released
no longer affects: targetcli-fb (Ubuntu Bionic)
no longer affects: targetcli-fb (Ubuntu)
James Page (james-page)
Changed in python-configshell-fb (Ubuntu Bionic):
status: New → Triaged
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.