Public bug reported:

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)

** Affects: bash-completion (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug zesty

** Patch added: "Possible fix for pname completion (doesn't handle spaces in 
process name but I haven't seen spaces in yet in exes)"
   
https://bugs.launchpad.net/bugs/1702767/+attachment/4910472/+files/fix_windows_names_for_pname_completion.patch

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

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1702767/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to