[Bash-completion-devel] Bug#497597: bash-completion: gdb argument completions returns error

Morita Sho morita-pub-en-debian at inz.sakura.ne.jp
Sun Sep 7 04:56:35 UTC 2008


Hi,

On 09/07/2008 01:05 PM, Kevin Mitchell wrote:
> Ok, well it probably should have occured to me to actually include my
> $PATH variable:
> 
> $ echo $PATH
> :/home/kevmitch/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
> 
> Note the preceding ":" which should include the current directory in
> accordance with bash(1):
> 
>        PATH   The  search  path for commands.  It is a colon-separated
> list of directories in which the
>               shell looks for commands (see COMMAND EXECUTION below).
> A zero-length  (null)  directory
>               name  in  the  value  of PATH indicates the current
> directory.  A null directory name may
>               appear as two adjacent colons, or as an initial or
> trailing colon. . .
> 
> If I turn that into
> $PATH=.$PATH
> $IFS=":"
> $path_array=( $(echo "$PATH") )
> $IFS=$'\n'
> $find "${path_array[@]}" . -mindepth 1 -maxdepth 1 -not -type d
> -executable -printf "%f\\n" > /dev/null
> $
> then we're good to go. I still can't say I completely understand this,
> I guess because I don't really understand what's happening in 'find
> "${path_array[@]}"'. I guess I would have expected this bug to show up
> as find not searching the current directory. Is there a
> straightforward way to search and replace an empty field with "." for
> find's benefit other than a for/sed?

I guess removing any zero-length directory name before splitting the PATH 
variable solves the problem.

A patch is attached.

I hope this helps,

-- 
Morita Sho <morita-pub-en-debian at inz.sakura.ne.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-zero-length-directory-name.patch
Type: text/x-patch
Size: 504 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20080907/470fe6ad/attachment-0003.bin 


More information about the Bash-completion-devel mailing list