]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Avoid consuming too much seekable input when yesno is used.
authorEric Blake <ebb9@byu.net>
Mon, 20 Aug 2007 15:01:18 +0000 (17:01 +0200)
committerJim Meyering <jim@meyering.net>
Mon, 20 Aug 2007 15:03:45 +0000 (17:03 +0200)
* bootstrap.conf (gnulib_modules): Grab closein.
* src/system.h (includes): Also include closein.h.
* src/mv.c (main): Use close_stdin, not close_stdout.
* src/cp.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/rm.c (main): Likewise.
* src/install.c (main): Likewise.
* NEWS: Document the fix.

15 files changed:
ChangeLog
NEWS
bootstrap.conf
lib/.cvsignore
lib/.gitignore
m4/.cvsignore
m4/.gitignore
po/ChangeLog
po/POTFILES.in
src/cp.c
src/install.c
src/ln.c
src/mv.c
src/rm.c
src/system.h

index a477f3d1089ee27e6cc65e99a396b741c8b1fecc..6462d9e0c3b378d47a16d5679aa4da7b55e8d533 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-08-19  Eric Blake  <ebb9@byu.net>
+
+       Avoid consuming too much seekable input when yesno is used.
+       * bootstrap.conf (gnulib_modules): Add closein.
+       * src/system.h (includes): Also include closein.h.
+       * src/mv.c (main): Use close_stdin, not close_stdout.
+       * src/cp.c (main): Likewise.
+       * src/ln.c (main): Likewise.
+       * src/rm.c (main): Likewise.
+       * src/install.c (main): Likewise.
+       * NEWS: Document the fix.
+
 2007-08-18  Jim Meyering  <jim@meyering.net>
 
        Use new "idcache.h" header.
diff --git a/NEWS b/NEWS
index 91149ebb6e6feab7fa3036661f52463af76212ca..edbf3b49daba5d5aa0403e8a2eae0d85a72a62ba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -72,6 +72,9 @@ GNU coreutils NEWS                                    -*- outline -*-
 
   "cp -i --update older newer" no longer prompts; same for mv
 
+  "cp -i" now detects read errors on standard input, and no longer consumes
+  too much seekable input; same for ln, install, mv, and rm.
+
   cut now diagnoses a range starting with zero (e.g., -f 0-2) as invalid;
   before, it would treat it as if it started with 1 (-f 1-2).
 
index 58a32573809755fd2aa07c273c7aefa06fe01789..68896c77be88db5b65713cba9ff464d8c031c84a 100644 (file)
@@ -40,7 +40,7 @@ gnulib_modules="
        c-strcase c-strtod
        c-strtold calloc canon-host canonicalize chown cloexec
        config-h configmake
-       closeout
+       closein closeout
        crypto/md5 crypto/sha1
        cycle-check
        d-ino d-type diacrit dirfd dirname dup2
index ae85b19f61b67bd9597c3291da06905f03166454..fd17849ffca75a4768538a0ddd9e3c27300be37c 100644 (file)
@@ -42,6 +42,8 @@ cloexec.c
 cloexec.h
 close-stream.c
 close-stream.h
+closein.c
+closein.h
 closeout.c
 closeout.h
 concatpath.c
@@ -83,6 +85,7 @@ fcntl-safer.h
 fcntl.h
 fcntl_.h
 fd-safer.c
+fflush.c
 file-has-acl.c
 file-type.c
 file-type.h
@@ -103,6 +106,10 @@ fnmatch_loop.c
 fopen-safer.c
 fprintftime.c
 fprintftime.h
+fpurge.c
+fpurge.h
+freading.c
+freading.h
 free.c
 fseeko.c
 fstatat.c
index b716aa8e9fe919744548f7837d4a7a3b1a1df165..f44081dea95157fa30fe11fd2344376b14abe772 100644 (file)
@@ -39,6 +39,8 @@ cloexec.c
 cloexec.h
 close-stream.c
 close-stream.h
+closein.c
+closein.h
 closeout.c
 closeout.h
 concatpath.c
@@ -78,6 +80,7 @@ fcntl-safer.h
 fcntl.h
 fcntl_.h
 fd-safer.c
+fflush.c
 file-has-acl.c
 file-type.c
 file-type.h
@@ -98,6 +101,10 @@ fnmatch_loop.c
 fopen-safer.c
 fprintftime.c
 fprintftime.h
+fpurge.c
+fpurge.h
+freading.c
+freading.h
 free.c
 fseeko.c
 fstatat.c
index 88f1d88aa84ec13e632922ec090b8aaef4f57327..648715ba50136ebcef7690d21905c4bba0548c69 100644 (file)
@@ -19,6 +19,7 @@ chown.m4
 clock_time.m4
 cloexec.m4
 close-stream.m4
+closein.m4
 closeout.m4
 codeset.m4
 config-h.m4
@@ -41,6 +42,7 @@ extensions.m4
 fchdir.m4
 fcntl-safer.m4
 fcntl_h.m4
+fflush.m4
 file-type.m4
 fileblocks.m4
 filemode.m4
@@ -51,6 +53,8 @@ float_h.m4
 fnmatch.m4
 fpending.m4
 fprintftime.m4
+fpurge.m4
+freading.m4
 free.m4
 fseeko.m4
 fstypename.m4
index 17ff10048e266e7d5d10425bd3fc3a6925f1690f..10524078479082839918381da28c4083ce12b4bb 100644 (file)
@@ -18,6 +18,7 @@ chown.m4
 clock_time.m4
 cloexec.m4
 close-stream.m4
+closein.m4
 closeout.m4
 codeset.m4
 config-h.m4
@@ -40,6 +41,7 @@ extensions.m4
 fchdir.m4
 fcntl-safer.m4
 fcntl_h.m4
+fflush.m4
 file-type.m4
 fileblocks.m4
 filemode.m4
@@ -50,6 +52,8 @@ float_h.m4
 fnmatch.m4
 fpending.m4
 fprintftime.m4
+fpurge.m4
+freading.m4
 free.m4
 fseeko.m4
 fstypename.m4
index 366ca7489152e6d56924cbaefcfc497164872102..247a76a2a0ca1e2b1db9cb9ad65b3b9039b6dd49 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-19  Eric Blake  <ebb9@byu.net>
+
+       * POTFILES.in: Add lib/closein.c.
+
 2007-08-08  Jim Meyering  <jim@meyering.net>
 
        Adapt to gnulib's latest xstrtol change.
 
        -----
 
-       Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software
+       Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software
        Foundation, Inc.
 
        Copying and distribution of this file, with or without
index 61f6501f78e04f815130d3e5e3cb6f27605d4440..7f4d5c2a534e37f0a8c33e111896458b2d0d7b43 100644 (file)
@@ -4,6 +4,7 @@
 # These are nominally temporary...
 lib/acl.c
 lib/argmatch.c
+lib/closein.c
 lib/closeout.c
 lib/error.c
 lib/euidaccess-stat.c
index 2ea74cd14fd001e8e2fafc9581532565bce8d577..254923759a87c5988d2c61f3be965b49574fd92e 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -867,7 +867,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  atexit (close_stdout);
+  atexit (close_stdin);
 
   selinux_enabled = (0 < is_selinux_enabled ());
   cp_option_init (&x);
index 28e2dd50a26ba824b9a07d809f29de7abacb1729..34f61ffba38413212b2e1572531a7d90ece2dde8 100644 (file)
@@ -290,7 +290,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  atexit (close_stdout);
+  atexit (close_stdin);
 
   cp_option_init (&x);
 
index aec8b36b32f17275e89d1379ed366e201b425923..3ddcfdfff0b89e1f59f1e9556ed58a9dc999755a 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -1,5 +1,5 @@
 /* `ln' program to create links between files.
-   Copyright (C) 1986, 1989-1991, 1995-2006 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1989-1991, 1995-2007 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -398,7 +398,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  atexit (close_stdout);
+  atexit (close_stdin);
 
   /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
      we'll actually use backup_suffix_string.  */
index fdf328393b6373cb1af4549a67a0f01ee4f66d06..1834f4c6489f46a201624a8df5030f9b20019f0d 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -357,7 +357,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  atexit (close_stdout);
+  atexit (close_stdin);
 
   cp_option_init (&x);
 
index 17493298725977b8a43387360968c48ca23df1c8..820646f36ab899dfb0d896c8c80bb446c48c1522 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -238,7 +238,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  atexit (close_stdout);
+  atexit (close_stdin);
 
   rm_option_init (&x);
 
index 3c7f49d1010bcb01fced409eff2b129529ecc7f7..2c4bfd345133e169feffea82553a8a619a96b776 100644 (file)
@@ -419,6 +419,7 @@ enum
 #define VERSION_OPTION_DESCRIPTION \
   _("      --version  output version information and exit\n")
 
+#include "closein.h"
 #include "closeout.h"
 #include "version-etc.h"