[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: yesno module consumes too much input

From: Paul Eggert
Subject: Re: yesno module consumes too much input
Date: Fri, 17 Aug 2007 15:38:05 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Eric Blake-1 <address@hidden> writes:

> 2007-08-17  Eric Blake  <address@hidden>
>       Don't consume too much input when stdin is seekable.
>       * lib/yesno.c (yesno): Flush seekable stdin.
>       * modules/yesno (Depends-on): Add fflush.

Won't this patch result in lots of unnecessary system calls for a
program that reads a lot of 'y's and 'n'n from a file?

> The closein module is capable of resolving this problem.
> However, rather than fix all of the affected applications
> one-by-one (the list includes, but is not limited to,
> coreutils' cp, ln, mv, rm, and remove; and findutils' find),
> it would be nicer to fix this just once in yesno.

(There is no 'remove' command.)

I see another problem with the proposed approach, other than the
performance issue.  If a program like 'mv' has read from standard
input, but then the fseeko fails at the end, then 'mv' should report
an error to the user.

My kneejerk reaction is that a modified 'closein' is a better way to
go here.  That is, the affected programs (and there are not that many
of them) should invoke close_stdin if they have attempted to read
anything from stdin and have not read end-of-file.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]