[Bug 251275] shells/ksh2020 "complete -F" doesn't work unless the prefix length is exactly 3

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 20 16:10:57 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251275

            Bug ID: 251275
           Summary: shells/ksh2020 "complete -F" doesn't work unless the
                    prefix length is exactly 3
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: cy at FreeBSD.org
          Reporter: endian.sign at gmail.com
             Flags: maintainer-feedback?(cy at FreeBSD.org)
          Assignee: cy at FreeBSD.org

Created attachment 219832
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=219832&action=edit
Don't reassign the "len" variable and compute the exact spaces needed

Hi,

The programmable completion of ksh2020 doesn't work as expected unless the
prefix length is exactly 3.  The following example illustrates the problem:

$ set -o emacs
$ _foo()
> {
> COMPREPLY=( hello world )
> }
$ complete -F _foo foo
$ foo <tab> # Nothing is displayed.
$ foo hel<tab> # This one works as expected.

The problem is caused by a reassignment of the prefix length.  Moreover, we
might overwrite data on the heap if the total length of all completion strings
is big enough.  The attached patch fixes the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list