Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp138568ybp; Tue, 8 Oct 2019 15:26:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmrVx+kzK1mZy48+h7RtR0W1bxEEWc6QPkDtz82Cll2h7cxTE2LasuOdnyggAa4vKz03j0 X-Received: by 2002:aa7:c895:: with SMTP id p21mr335059eds.38.1570573581970; Tue, 08 Oct 2019 15:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570573581; cv=none; d=google.com; s=arc-20160816; b=HRR51fvvJLMLgECzd9qLlBzMD23Aa2qNapQhR9ZaUa8PVOeUWrV5g5Hv5pJC4+3p9d giEA473m0eS1niRxgV61NZi7Oa63/GEwWbxiheYs4trT2/yL4E3YQZ8ufCb2+B9RqoH4 O+5yflKbABP+tQTWLUe2/ZjMS8jpUS9dqgshO7ufsStCFYunqiTHl5M6vCaYIGyo1DoT ax5id2pqCCQssQ7OX/VsNM9scbm/ezqWHzvJk+/ONxzzAH5kLjg978tOXZHmQfnYmIZV 5/ygOmoqpUPPTyLiwg2Dx1z1mUVI+Gvz1kMyX/goCHD2uxPc4zGONmpMpbYphSTlbd+5 qKQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=u4tftPbCrv3Ywdv/Yr7lGlylwby5ziOgn4R8Izjj4JY=; b=vZ19crmg/RX+D3yU7cnV1RZGIEZWmblGWSSzV+arg3hWQZ2bz/Ib581x/t0qrA7dW+ xaizYREdPdu8SJK/GLJ/0hRslXpZzRVFVst4+uJZG0Eh+8qb3ogmWgCU9ACSPYJv+dw7 eWorHIs/m9VMGMfHFnagc3m4+D7EzuNNf6jyX9/R82B3ntwxOuLnROxte2bIdDyRmIEW 5H82gxs7VE6rCi+zL082mEUMnuk2K7uZ3syICaaQqFsYV5M/+ppF/izFD8m84YODUqmS JwyISiCn7ewFO1d64KJgfZPPKqEl2O65EZtsDr95D9c9vsPoOxaXW2xrbQCgarlM8uUQ fmIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZLi8SVXF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si154981edq.221.2019.10.08.15.25.39; Tue, 08 Oct 2019 15:26:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZLi8SVXF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729600AbfJHWVm (ORCPT + 99 others); Tue, 8 Oct 2019 18:21:42 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:46551 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfJHWVm (ORCPT ); Tue, 8 Oct 2019 18:21:42 -0400 Received: by mail-io1-f67.google.com with SMTP id c6so425828ioo.13 for ; Tue, 08 Oct 2019 15:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u4tftPbCrv3Ywdv/Yr7lGlylwby5ziOgn4R8Izjj4JY=; b=ZLi8SVXF0W7jPNHHCEk2AUCffy+7zMrgf0XWhZS7LbFvNSuPfTRfCpgfafY+GDGc1S gvMSvpsBQ00YM+ZXcT24vvny2NYdRTh9ZM+Nb11hw2fYcf2WKkl3yANCI2NUvjeXX+rM eQijQ+fVF6zxiHRtsHL1nGLB4Iy3EXAkasznY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u4tftPbCrv3Ywdv/Yr7lGlylwby5ziOgn4R8Izjj4JY=; b=oWluw/5Gcio9TsCakyngKyMqxxA8urvZH+X0JvfC2Sdj/H7ZoozXTqjkj5K7aHV4t2 TB8/+g5Q9YQl97ZE9t6/Lt46NpiFNtpR5TPDXaMJQzpDUrOYSeorULlQ686/F5zv/qws W5SJgXQsfODNh+cKiGFY4GAOjDtVCEbpQXaaC2OAj8zERzbTv8Yx9od4NcOATGdD8m6c EowNbO5pTbhjbzuOF+UD8K8jpNZ2ZKTv3XYx4XPI6wv+ccsTjEHtQwAKV6BIY+cmoR7Y LVC0XocQ2HjvLnP60JKpO5tXvizpA1F/iA1317T4iI7EtuSaDTOEug339w7jH6x/3wG9 YfdA== X-Gm-Message-State: APjAAAVKHpeYHUC+DsPWsB93o+XfUvCVFkxoMYF+KxUtAGpqmGNOy/2c aRxnK4f5kOtDoCH83/+nPAoJ2Eh618g= X-Received: by 2002:a02:bb85:: with SMTP id g5mr301626jan.7.1570573301282; Tue, 08 Oct 2019 15:21:41 -0700 (PDT) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com. [209.85.166.44]) by smtp.gmail.com with ESMTPSA id v70sm232043ilk.58.2019.10.08.15.21.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Oct 2019 15:21:40 -0700 (PDT) Received: by mail-io1-f44.google.com with SMTP id w12so455552iol.11 for ; Tue, 08 Oct 2019 15:21:40 -0700 (PDT) X-Received: by 2002:a02:b691:: with SMTP id i17mr300479jam.132.1570573300103; Tue, 08 Oct 2019 15:21:40 -0700 (PDT) MIME-Version: 1.0 References: <20191008132043.7966-1-daniel.thompson@linaro.org> <20191008132043.7966-6-daniel.thompson@linaro.org> In-Reply-To: <20191008132043.7966-6-daniel.thompson@linaro.org> From: Doug Anderson Date: Tue, 8 Oct 2019 15:21:28 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/5] kdb: Tweak escape handling for vi users To: Daniel Thompson Cc: Jason Wessel , kgdb-bugreport@lists.sourceforge.net, LKML , Patch Tracking Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Oct 8, 2019 at 6:21 AM Daniel Thompson wrote: > > Currently if sequences such as "\ehelp\r" are delivered to the console then > the h gets eaten by the escape handling code. Since pressing escape > becomes something of a nervous twitch for vi users (and that escape doesn't > have much effect at a shell prompt) it is more helpful to emit the 'h' than > the '\e'. I have no objection to this change. > We don't simply choose to emit the final character for all escape sequences > since that will do odd things for unsupported escape sequences (in > other words we retain the existing behaviour once we see '\e['). It's not like it handles unsupported escape sequences terribly well anyway, of course. As soon as if finds something it doesn't recognize then it stops processing the escape sequence and will just interpret the rest of it verbatim. Like if I press Ctrl-Home on my keyboard I see "5H" spit out, for instance. > Signed-off-by: Daniel Thompson > --- > kernel/debug/kdb/kdb_io.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c > index 288dd1babf90..b3fb88b1ee34 100644 > --- a/kernel/debug/kdb/kdb_io.c > +++ b/kernel/debug/kdb/kdb_io.c > @@ -158,8 +158,8 @@ static int kdb_getchar(void) > > *pbuf++ = key; > key = kdb_read_handle_escape(buf, pbuf - buf); > - if (key < 0) /* no escape sequence; return first character */ > - return buf[0]; > + if (key < 0) /* no escape sequence; return best character */ > + return buf[pbuf - buf != 2 ? 0 : 1]; optional nit: for me the inverse is easier to conceptualize, AKA: buf[pbuf - buf == 2 ? 1 : 0]; -Doug