[Bug 1945661] Re: openstack commands fail with GTK3 error

Mauricio Faria de Oliveira 1945661 at bugs.launchpad.net
Fri Aug 30 20:25:45 UTC 2024


Hi Tom,

Thanks for the work on the bug and debdiff!

Some changes are needed, please. Thanks!

Focal:
	
- d/changelog:

        - Version: FIX

	+cmd2 (0.8.5-2.1ubuntu1) focal; urgency=medium
	 cmd2 (0.8.5-2.1) unstable; urgency=medium
	 
	Increment by `0.1` for stable releases (`1` is for the devel release).
	Please read [1].

        - LP bug closing tag: OK

- d/control:

	Maintainer: OK, nice touch (run `update-maintainer` script when `ubuntu...` local version suffix is added)
	
- d/p/lp1945661.patch:

	- DEP-3 headers: FIX
	
	The 'optional' (but strongly recommended, and best/regular practice) headers are present: GREAT!
	But the _required_ ones are missing (Description or Subject).
	
	If you start with the git patch (e.g., `git format-patch` or download from `https://git/.../commit.patch`)
	you should only add `Origin/Bug-Ubuntu`, which you already have.
	
	- `Origin`: OK;
	  Note: it would be nice (optional) to clarify that with one of the prefixes (see DEP-3 [2]):
	  1) 'upstream' (clean cherry-pick from an upstream branch), 
	  2)'backport' (changes needed from an upstream branch), or
	  3) 'vendor' (patch from us/debian/other vendor; not the case); 

	In this case, it's clearly a backport: e.g,.
		README.md changes removed; 
		cmd2/clipboard.py's changes are in cmd2/cmd2.py
		some string changes removed/not present.
		
	Please also add a backport description (similar to the above, not too detailed,
	but just to capture it for future maintainers; it helps in 10/12-year support! :)
	
	You can put it after the commit message, like:
	"[tom-tom: backport: description of the changes]"
	Some people even use an extended (X) header type (not required, though) like this:
	"X-Backport-Note: tom-tom: description of the changes"
	This one is up to you.
			
Backport: FIX

	The semantic change of the patch is, add an exception catch _only_ for `Value Error`.
	However, the backport _also_ added `FileNotFoundError`, which is part of the _context_
	in the upstream patch, but not the _changes_.
	```
	+-except PyperclipException:
	++except (PyperclipException, FileNotFoundError, ValueError):
	```
		
	The code comments in the upstream version clarify the other Error type is unrelated
	(i.e., not needed; and might possibly cause regressions).
	```
	# NOTE: FileNotFoundError is for Windows Subsystem for Linux (WSL) when Windows paths are removed from $PATH
	# NOTE: ValueError is for headless Linux systems without Gtk installed
	```
	
d/p/series: OK

[0] https://github.com/python-cmd2/cmd2/commit/693ec59719edc4384739392a0daea73c922b91c3	
[1] https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging
[2] https://dep-team.pages.debian.net/deps/dep3/

** Changed in: cmd2 (Ubuntu Focal)
   Importance: Undecided => Medium

** Changed in: cmd2 (Ubuntu Focal)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to cmd2 in Ubuntu.
https://bugs.launchpad.net/bugs/1945661

Title:
  openstack commands fail with GTK3 error

Status in cmd2 package in Ubuntu:
  Fix Released
Status in cmd2 source package in Focal:
  Incomplete

Bug description:
  [ Impact ]

   * There is a bug in cmd2 v0.8.5 where an exception is thrown when GTK3
     libraries are not installed. This causes Python applications using
     cmd2 to crash unexpectedly

   * This patch backports a fix from upstream that handles that expection
     gracefully, allowing applications to function properly.

   * The workaround to this was to install GTK3, which is not ideal as the
     Python applications are command line tools, not graphical

  [ Test Plan ]

   * Deploy focal

   * Install an application that has cmd2 as a dependency
     e.g. python3-openstackclient

   * Run command that uses cmd2: `openstack server list`

  [ Where problems could occur ]

   * This changes the error handling for a library that is used by many
     Python applications. Some of these applications could rely on the 
     existing behavior (a ValueError exception being thrown) to detect
     certain configurations and change their behavior accordingly.

   * This would result in those applications failing under certain use
     cases. For example, the configuration in question is a headless
     Linux system without GTK libraries installed.

  [ Original bug description ]

  Openstack release: Wallaby
  OS: Ubuntu 20.04 server edition
  After installation of python3-openstackclient from apt, while setting up user, roles and project, I executed following command:
  openstack domain create --description "An Example Domain" example

  Error:
  Traceback (most recent call last):
    File "/usr/bin/openstack", line 6, in <module>
      from openstackclient.shell import main
    File "/usr/lib/python3/dist-packages/openstackclient/shell.py", line 23, in <module>
      from osc_lib import shell
    File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
      from cliff import app
    File "/usr/lib/python3/dist-packages/cliff/app.py", line 22, in <module>
      import cmd2
    File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
      _ = pyperclip.paste()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 667, in lazy_load_stub_paste
      copy, paste = determine_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 558, in determine_clipboard
      return init_gi_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 167, in init_gi_clipboard
      gi.require_version('Gtk', '3.0')
    File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
      raise ValueError('Namespace %s not available' % namespace)

  Had to install GTK3 to make openstack commands work but it is taking
  huge time to get a response to the commands. The wait time after
  firing any openstack cli command is around 30 seconds.

  Anybody faced the issue? What is the fix for it if it exists?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cmd2/+bug/1945661/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list