NetBSD Problem Report #40640

From apb@cequrux.com  Sat Feb 14 09:55:11 2009
Return-Path: <apb@cequrux.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 8AA0763C17C
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 14 Feb 2009 09:55:11 +0000 (UTC)
Message-Id: <20090214085641.3AA62E933D8@apb-laptoy.apb.alt.za>
Date: Sat, 14 Feb 2009 08:56:41 +0000 (UTC)
From: apb@cequrux.com
To: gnats-bugs@gnats.NetBSD.org
Subject: /bin/sh tab completion doesn't handle commands
X-Send-Pr-Version: 3.95

>Number:         40640
>Category:       bin
>Synopsis:       /bin/sh tab completion doesn't handle commands
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 14 10:00:00 +0000 2009
>Originator:     Alan Barrett
>Release:        NetBSD 5.99.7
>Organization:
Not much
>Environment:
System: NetBSD 5.99.7  i386
>Description:
	Tab completion in /bin/sh can be enabled with "set -o tabcomplete".

	In most shells, tab completion is syntax sensitive, at least to the
	extent that it offers different completions for commands and
	non-commands.  In /bin/sh, tab completion always attempts to
	complete a file name.

>How-To-Repeat:
	For example, in ksh:

		ksh$ set -o emacs
		ksh$ cd /tmp ; touch pw1 pw2 pw3
		# type "pw" then press TAB
		ksh$ pw[TAB]
		# ksh displays some command names starting with "pw"
		pwd       pwd_mkdb  pwhash    pwhich
		ksh$ pw

	but in /bin/sh, the tab completion is much less useful:

		sh$ set -o emacs ; set -o tabcomplete
		sh$ cd /tmp ; touch pw1 pw2 pw3
		# type "pw" then press TAB
		sh$ pw[TAB]
                # sh attempts to treat "pw" as the start of a file name,
                # not as the start of a command name.  It changes the
                # "pw" to "./pw".  Press TAB again. and ./pw is expanded
                # to a list of file names:
		sh$ ./pw[TAB]
		./pw1  ./pw2  ./pw3
		sh$ ./pw

>Fix:
	Make tab completion work with command names, not file names,
	for the first word on a line, the first word after ';', '|',
	'||', '&&', and any other contexts where it's known that
	the word must be a command.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.