[xmonad] Two dashes freeze shellPrompt

Dunric dunric29a at gmail.com
Thu Aug 18 11:02:51 CEST 2011


Hi,

just took a peek into XMonad.Prompt.Shell source and found the cause of 
dysfunction.
To get a list of possible command completions, shellPrompt makes use of 
bash internal function "compgen" but end of options mark (yes, it is the 
double-dash) is omitted.
So if completion function is supplied with "--", bash call cannot finish 
because compgen expects another argument which never receives so it hangs.

Patch for darcs version of xmonad-contrib (0.10):

--- XMonad/Prompt/Shell.hs.orig    2011-08-18 10:26:24.816992530 +0200
+++ XMonad/Prompt/Shell.hs    2011-08-18 10:28:32.301992723 +0200
@@ -88,7 +88,7 @@
  getShellCompl :: [String] -> String -> IO [String]
  getShellCompl cmds s | s == "" || last s == ' ' = return []
                       | otherwise                = do
-    f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file " 
++ encodeString s ++ "\n")
+    f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file 
--" ++ encodeString s ++ "\n")
      files <- case f of
                 [x] -> do fs <- getFileStatus x
                           if isDirectory fs then return [x ++ "/"]

Take care


David

> I'm running the darcs version and can't reproduce this.  Entering any number of
> dashes doesn't seem to do anything on my machine.  From that I would suspect
> that some post-0.9.2 patch must have fixed the issue.  So in my opinion the
> right course of action would be to upgrade to a later xmonad version, not to
> file a bug report.
>
> Cheers,
> Norbert
>
> Ivan Lazar Miljenovic [2011.08.16 0838 +1000]:
>> On 16 August 2011 08:01, Dunric<dunric29a at gmail.com>  wrote:
>>> Hi,
>>>
>>> does anybody else experienced the strange shellPrompt lockup after two
>>> consecutive dashes are entered ?
>>>
>>> 1) invoke XMonad.Prompt.Shell.shellPrompt with defaultXPConfig
>>> 2) type anywhere two dashes ("--") in Run: prompt
>>> 3) prompt stalls and stops responding
>>>
>>> Just asking if somebody can confirm so I may fill a bug report.
>> Yeah, I think I've had this for a while (this box doesn't have xmonad
>> so I can't double-check).  I believe it came about when some encoding
>> bug was fixed or something...
>>
>> -- 
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic at gmail.com
>> IvanMiljenovic.wordpress.com
>>
>> _______________________________________________
>> xmonad mailing list
>> xmonad at haskell.org
>> http://www.haskell.org/mailman/listinfo/xmonad
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad




More information about the xmonad mailing list