From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YCrrW-0007eO-P4 for mharc-grub-devel@gnu.org; Sun, 18 Jan 2015 10:34:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YCrrU-0007ZG-0A for grub-devel@gnu.org; Sun, 18 Jan 2015 10:34:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YCrrQ-0007QP-RY for grub-devel@gnu.org; Sun, 18 Jan 2015 10:33:59 -0500 Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]:56100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YCrrQ-0007QJ-Ir for grub-devel@gnu.org; Sun, 18 Jan 2015 10:33:56 -0500 Received: by mail-la0-f47.google.com with SMTP id hz20so25210144lab.6 for ; Sun, 18 Jan 2015 07:33:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=RBColxEirBkmwF0Ul/qMveFHVxtwNCPoDwFbVeQ5CvA=; b=p8GZzRZeFlAQPy31CarVxF7cRjDrUJOz+fBqRZDK0D5m10LcCP7cZuNG3kRhaoMASt +ciQO12qH6nttZztnJbM7z2N2abKpa2wt959r/vIbKRhdye0uYu+Qj4CN4bXGpjnFBgc GSmwg+Be+9UoMon3Kv2nvsAiL5pxvYCF4xQYsiZqzRSSUhh84++SabOXNuOV7moyqtC+ b+kaubW+ZYsACn/D2iw6JN6SbhuwLl/Dro7odMI5AxgSlSw2S6MrawX09FJrAY6JOxyD 9d6OfVS3LvtVf/ztAH3SX32Myd4OVkFePxIuDjCoXr/Wp8j7MQpAEIWvXaS/2TRBlwcs jbpQ== X-Received: by 10.112.154.70 with SMTP id vm6mr25364208lbb.18.1421595235659; Sun, 18 Jan 2015 07:33:55 -0800 (PST) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id l1sm2960968lag.11.2015.01.18.07.33.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jan 2015 07:33:54 -0800 (PST) Date: Sun, 18 Jan 2015 18:33:52 +0300 From: Andrei Borzenkov To: Valentin Dornauer Subject: Re: Support abort of 'cat' even if in paging mode Message-ID: <20150118183352.4801e706@opensuse.site> In-Reply-To: <20150114104957.GA14476@unimplemented.org> References: <20150114104957.GA14476@unimplemented.org> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22f Cc: grub-devel@gnu.org, ehrhardt@genua.de X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jan 2015 15:34:01 -0000 =D0=92 Wed, 14 Jan 2015 11:49:57 +0100 Valentin Dornauer =D0=BF=D0=B8=D1=88=D0=B5=D1= =82: > Hello, > we needed a way for GRUB to show a rather large text file in pager > mode (set pager=3D1) while still allowing the user to abort without > scrolling all the way to the bottom of the file. >=20 > From the original commit message: > [...] The reason is that "cat" scans for key strokes but does not > block waiting for them. This results in a race between the pager > that eats all the keystrokes and "cat" that scans for them in > non-blocking mode. >=20 > To fix this, we let the pager report if a keypress was ESC, 'q' > or 'Q'. The caller can check for this and stop the printing of > data. The behaviour of the pager itself is not affected by this. >=20 > Please note that this is a rather quick fix and there might be a > better solution (possibly entirely inside the term layer?). If anyone > has a better solution, please let me know. Otherwise I could submit > a proper patch using this fix. >=20 It is not limited to cat; just try to run lsefi on any real system (or even VM). Even simple "ls -l" could be quite time consuming. For this reasons I would suggest having common grub_output_interrupted() function that could be used in all commands doing long term output. The we could start adding it to each command. The idea is to minimize impact on existing commands and to abstract away how we actually signal termination of output. > Original patch by Christian Ehrhardt . >=20 > Thanks > Valentin