Bug 196713 - shells/bash-completion: Tab on empty line: words: bad array subscript
Summary: shells/bash-completion: Tab on empty line: words: bad array subscript
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-14 10:20 UTC by gnudalf
Modified: 2015-01-20 16:23 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (adamw)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.