Bug 196713

Summary: shells/bash-completion: Tab on empty line: words: bad array subscript
Product: Ports & Packages Reporter: gnudalf
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: Closed FIXED    
Severity: Affects Many People CC: marino
Priority: --- Flags: bugzilla: maintainer-feedback? (adamw)
Version: Latest   
Hardware: Any   
OS: Any   

Description gnudalf 2015-01-14 10:20:43 UTC
As in ubuntu bug report, TAB on empty line produces an unneded error message:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1289597

patch can be found in bug report. (https://code.launchpad.net/~j/bash-completion/bug1289597/+merge/210089)
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-14 10:20:43 UTC
Auto-assigned to maintainer adamw@FreeBSD.org
Comment 2 John Marino freebsd_committer freebsd_triage 2015-01-20 09:43:12 UTC
Hi Adam,
This boils down to a 1 line (2 character) patch:

--- bash_completion.orig
+++ bash_completion
@@ -707,7 +707,7 @@ _init_completion()
         fi
     done
 
-    [[ $cword -eq 0 ]] && return 1
+    [[ $cword -le 0 ]] && return 1
     prev=${words[cword-1]}
 
     [[ ${split-} ]] && _split_longopt && split=true


If you are busy, I could apply this for you.  This ticket was originally posted for dports, but I requested that it be elevated to ports so FreeBSD would benefit too.
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-01-20 16:22:20 UTC
A commit references this bug:

Author: adamw
Date: Tue Jan 20 16:22:18 UTC 2015
New revision: 377528
URL: https://svnweb.freebsd.org/changeset/ports/377528

Log:
  Add a patch to fix tab on an empty line producing:
  	$ bash: words: bad array subscript

  PR:		196713
  Submitted by:	gnudalf@yandex.com
  Obtained from:	upstream bug #1289597

Changes:
  head/shells/bash-completion/Makefile
  head/shells/bash-completion/files/patch-bash__completion
Comment 4 Adam Weinberger freebsd_committer freebsd_triage 2015-01-20 16:23:06 UTC
Committed, thanks.

And thanks for the reminder, John.