codehenry / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

XMonad.Prompt.Shell does not open a prompt if a directory in PATH is inaccessible #547

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add a directory to PATH that user does not have permission to access.
2. Try to open a shell prompt.

What is the expected output? What do you see instead?
The prompt does not appear. I would expect a prompt to open, although tab 
completion obviously will not know about commands below the inaccessible 
directory.

What version of the product are you using? On what operating system?
xmonad-0.11, xmonad-contrib-0.11.1

Solution:
If a directory in the PATH is inaccessible, getDirectoryContents will throw an 
exception. The exception prevents the tab completion list from being compiled 
and the prompt from being opened. If an exception is encountered accessing any 
element of PATH for any reason, I think the response should simply be to return 
an empty list of commands for that element. I am attaching a patch that does 
exactly that.

Original issue reported on code.google.com by ttue...@gmail.com on 15 Jun 2013 at 10:50

Attachments:

GoogleCodeExporter commented 8 years ago
Is it enough to catch IOExceptions? If so, maybe it would be good to blend in 
with the surrounding style and use "`E.catch` econst []" instead of defining 
errHandler.

Other than that, the patch looks good to me.

Original comment by daniel.w...@gmail.com on 16 Jun 2013 at 2:25

GoogleCodeExporter commented 8 years ago
You're quite right, there seems to be no reason to catch other exceptions. 
Here's a new patch.

Original comment by ttue...@gmail.com on 16 Jun 2013 at 11:08

Attachments:

GoogleCodeExporter commented 8 years ago
Applied, thanks!

Original comment by daniel.w...@gmail.com on 17 Jun 2013 at 3:01