pname (Process name) completion script fails to handle wine generated path names

Bug #1702767 reported by Pauli
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'm playing The Witcher 3 in wine. The game plays mostly fine except it deadlocks when trying to exit. To clear the deadlocked memory hog process I need to kill it manually. I tried to use killall with tab completion to clear the process but then I noticed pname completion function in /usr/share/bash-completion/bash_completion doesn't handle windows paths at all.

There is two problems in windows names:
1. It may use backslashes (but wine supports also unix paths if application is launched from terminal)
2. There is often spaces in the directory path

Attached possible fix is fairly simple addition to sed replace script to handle windows names first before anything else. It only handles .exe files but script could be modified to handle other extensions like -e "s:.*[\\\\\/]\([^ ]*\\.\\(exe\\|bat\\)\\):\\1:". But I didn't want to add any other extensions because I haven't seen them used.

The possible fix still has a weakness if command line arguments include filenames with exe extension. I just don't see how to write a simple script that handles spaces in directory path and arguments having exe extension. If wanting to handle the extension in argument list corner case it could be done using multi step completion involving parsing /proc/<pid>/cmdline that has list of null terminate strings making it much simpler to separate arguments from directory path. Too bad ps tool doesn't already offer option to display that information instead of /proc/<pid>/comm that truncates long command names.

I tried to use single quotes to reduces backslashes but that didn't work in completion script. That forced me to choose double quotes and doubled backslashes.

I tested the patch in my system completion script directly. killall completion now allows me to complete both windows and native process names without any issues yet.

ProblemType: Bug
DistroRelease: Ubuntu 17.04
Package: bash-completion 1:2.1-4.3ubuntu1
ProcVersionSignature: Ubuntu 4.10.0-26.30-generic 4.10.17
Uname: Linux 4.10.0-26-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.4-0ubuntu4.1
Architecture: amd64
CurrentDesktop: LXDE
Date: Thu Jul 6 23:12:43 2017
InstallationDate: Installed on 2037-12-25 (-7476 days ago)
InstallationMedia: Lubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
PackageArchitecture: all
SourcePackage: bash-completion
UpgradeStatus: Upgraded to zesty on 2017-06-06 (30 days ago)

Revision history for this message
Pauli (paniemin) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Possible fix for pname completion (doesn't handle spaces in process name but I haven't seen spaces in yet in exes)" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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