NetBSD Problem Report #53985

From www@NetBSD.org  Sat Feb 16 07:17:23 2019
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B98667A10D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 16 Feb 2019 07:17:23 +0000 (UTC)
Message-Id: <20190216071723.0DF917A1F8@mollari.NetBSD.org>
Date: Sat, 16 Feb 2019 07:17:23 +0000 (UTC)
From: armihu@gmail.com
Reply-To: armihu@gmail.com
To: gnats-bugs@NetBSD.org
Subject: libedit: file name completion for ..
X-Send-Pr-Version: www-1.0

>Number:         53985
>Category:       lib
>Synopsis:       libedit: file name completion for ..
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 16 07:20:00 +0000 2019
>Originator:     Arto Huusko
>Release:        
>Organization:
>Environment:
>Description:
libedit filecomplete functionality should complete ".." into "../"

Not all shells do this, but many do. It speeds up directory traversal a lot with keyboard mappings where / is hard to type.
>How-To-Repeat:
in sh prompt write cd .. and press tab.
>Fix:
patch for libedit/filecomplete.c:

@@ -343,9 +343,10 @@
 	/* find the match */
 	while ((entry = readdir(dir)) != NULL) {
 		/* skip . and .. */
-		if (entry->d_name[0] == '.' && (!entry->d_name[1]
-		    || (entry->d_name[1] == '.' && !entry->d_name[2])))
-			continue;
+		if (entry->d_name[0] == '.' && !entry->d_name[1])
+            continue;
+        if (entry->d_name[0] == '.' && entry->d_name[1] == '.' && !entry->d_name[2] && filename_len == 0)
+            continue;
 		if (filename_len == 0)
 			break;
 		/* otherwise, get first entry where first */

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.