[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Findutils-patches] [PATCH] bug 20273
From: |
Eric Blake-1 |
Subject: |
[Findutils-patches] [PATCH] bug 20273 |
Date: |
Wed, 27 Jun 2007 11:10:04 -0700 (PDT) |
OK to apply? The bulk of the patch is a new test in the testsuite,
which required some tweaks to get xargs_start to run a subshell
with multiple commands, rather than just xargs. I then validated
that the new test fails prior to the xargs.c changes and passes
afterwards on the Linux machine where I originally reported the bug.
Should I use the name savannah-20273, or sv-bug-20273 (both
naming formats are in use in the xargs testsuite)?
Since this is a bug fix, is it worth backporting this to the
4.2 branch?
2007-06-27 Eric Blake <address@hidden>
Fix Savannah bug #20273, xargs -E with seekable stdin.
* import-gnulib.config (modules): Sort, add closein.
* xargs/testsuite/Makefile.am (EXTRA_DIST_EXP, EXTRA_DIST_XO)
(EXTRA_DIST_XI): Add new test.
* xargs/testsuite/config/unix.exp (xargs_start): Support optional
argument to allow test to run a subshell.
* xargs/testsuite/inputs/savannah-20273.xi: New file.
* xargs/testsuite/xargs.posix/savannah-20273.xo: Likewise.
* xargs/testsuite/xargs.posix/savannah-20273.exp: Likewise.
* xargs/xargs.c (main): Use close_stdin, not close_stdout.
* NEWS: Document the fix.
Index: import-gnulib.config
===================================================================
RCS file: /sources/findutils/findutils/import-gnulib.config,v
retrieving revision 1.18
diff -u -p -r1.18 import-gnulib.config
--- import-gnulib.config 26 Jun 2007 16:56:42 -0000 1.18
+++ import-gnulib.config 27 Jun 2007 17:51:33 -0000
@@ -1,3 +1,5 @@
+# findutils gnulib.config -*- sh -*-
+
# What version of gnulib to use?
gnulib_version="2007-06-20"
@@ -18,13 +20,63 @@ build-aux/texinfo.tex
# Modules needed for findutils.
# We need regex to ensure that we can build on platforms like
# Solaris which lack those functions.
-modules="\
-alloca argmatch assert dirname error fchdir fileblocks fnmatch-gnu \
-fopen-safer fts \
-getdate getline getopt human idcache inline lstat malloc \
-mbscasestr mbsstr memcmp memset mktime \
-modechange pathmax quotearg realloc regex rpmatch savedir \
-stpcpy strdup strftime c-strstr strtol strtoul strtoull strtoumax \
-xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno human filemode
\
-getline stpcpy canonicalize mountlist closeout gettext stat-macros
stat-time \
-strcasestr sys_stat timespec verify wcwidth xstrtod"
+modules='
+alloca
+argmatch
+assert
+c-strstr
+canonicalize
+closein
+closeout
+dirname
+error
+fchdir
+fileblocks
+filemode
+fnmatch-gnu
+fopen-safer
+fts
+getdate
+getline
+getopt
+gettext
+human
+idcache
+inline
+lstat
+malloc
+mbscasestr
+mbsstr
+memcmp
+memset
+mktime
+modechange
+mountlist
+pathmax
+quotearg
+realloc
+regex
+rpmatch
+savedir
+stat-macros
+stat-time
+stpcpy
+strcasestr
+strdup
+strftime
+strtol
+strtoul
+strtoull
+strtoumax
+sys_stat
+timespec
+verify
+wcwidth
+xalloc
+xalloc-die
+xgetcwd
+xstrtod
+xstrtol
+xstrtoumax
+yesno
+'
Index: NEWS
===================================================================
RCS file: /sources/findutils/findutils/NEWS,v
retrieving revision 1.187
diff -u -p -r1.187 NEWS
--- NEWS 26 Jun 2007 08:24:18 -0000 1.187
+++ NEWS 27 Jun 2007 17:51:34 -0000
@@ -8,6 +8,11 @@ ordering comparison of function pointers
#20139: find -[acm]time -N (wrongly) includes files from N days ago,
as well as (correctly) from less than N days ago.
+#20273: Fix xargs to correctly restore the file location when stdin is
+seekable and xargs exits successfully without consuming all input, on
+platforms where exit() does not already do this according to POSIX
+rules.
+
** Documentation Fixes
Point out more explicitly that the subsecond timestamp support
Index: xargs/xargs.c
===================================================================
RCS file: /sources/findutils/findutils/xargs/xargs.c,v
retrieving revision 1.71
diff -u -p -r1.71 xargs.c
--- xargs/xargs.c 26 Jun 2007 08:24:19 -0000 1.71
+++ xargs/xargs.c 27 Jun 2007 17:51:35 -0000
@@ -163,7 +163,7 @@ typedef int boolean;
#endif
#include <xalloc.h>
-#include "closeout.h"
+#include "closein.h"
#include "gnulib-version.h"
void error PARAMS ((int status, int errnum, char *message,...));
@@ -419,7 +419,7 @@ main (int argc, char **argv)
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- atexit (close_stdout);
+ atexit (close_stdin);
atexit (wait_for_proc_all);
/* xargs is required by POSIX to allow 2048 bytes of headroom
Index: xargs/testsuite/Makefile.am
===================================================================
RCS file: /sources/findutils/findutils/xargs/testsuite/Makefile.am,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile.am
--- xargs/testsuite/Makefile.am 13 Jan 2007 18:17:55 -0000 1.20
+++ xargs/testsuite/Makefile.am 27 Jun 2007 17:51:35 -0000
@@ -77,6 +77,7 @@ xargs.posix/s47.exp \
xargs.posix/s48.exp \
xargs.posix/s6.exp \
xargs.posix/savannah-11865.exp \
+xargs.posix/savannah-20273.exp \
xargs.posix/space.exp \
xargs.posix/space-I.exp \
xargs.posix/sv-bug-18714.exp \
@@ -163,6 +164,7 @@ xargs.posix/s470.xo \
xargs.posix/s47.xo \
xargs.posix/s48.xo \
xargs.posix/savannah-11865.xo \
+xargs.posix/savannah-20273.xo \
xargs.posix/space.xo \
xargs.posix/sv-bug-18714.xo \
xargs.posix/sv-bug-18714b.xo \
@@ -227,6 +229,7 @@ inputs/noeof-0.xi \
inputs/noeof.xi \
inputs/Pdata.xi \
inputs/quotes.xi \
+inputs/savannah-20273.xi \
inputs/space.xi \
inputs/stairs-0.xi \
inputs/stairs2-0.xi \
Index: xargs/testsuite/config/unix.exp
===================================================================
RCS file: /sources/findutils/findutils/xargs/testsuite/config/unix.exp,v
retrieving revision 1.10
diff -u -p -r1.10 unix.exp
--- xargs/testsuite/config/unix.exp 15 Apr 2007 18:58:31 -0000 1.10
+++ xargs/testsuite/config/unix.exp 27 Jun 2007 17:51:35 -0000
@@ -1,17 +1,17 @@
# -*- TCL -*-
# Test-specific TCL procedures required by DejaGNU.
-# Copyright (C) 1994, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2005, 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
@@ -68,7 +68,7 @@ proc xargs_version {} {
# Run xargs and leave the output in $comp_output.
# Called by individual test scripts.
-proc xargs_start { passfail options {infile ""} {errh ""} } {
+proc xargs_start { passfail options {infile ""} {errh ""} {command ""} } {
global verbose
global XARGS
global XARGSFLAGS
@@ -102,14 +102,18 @@ proc xargs_start { passfail options {inf
}
if {[string match "s*" $errh]} then {
- set errfile ""
+ set errfile ""
} else {
set errfile "$testbase.xe"
}
catch "exec rm -f xargs.out xargs.err"
- set cmd "$XARGS $XARGSFLAGS $options < $infile > xargs.out 2>
xargs.err"
+ if {$command != ""} then {
+ set cmd "$command < $infile > xargs.out 2> xargs.err"
+ } else {
+ set cmd "$XARGS $XARGSFLAGS $options < $infile > xargs.out 2> xargs.err"
+ }
send_log "$cmd\n"
if $verbose>1 then {
send_user "Spawning \"$cmd\"\n"
Index: xargs/testsuite/inputs/savannah-20273.xi
===================================================================
RCS file: xargs/testsuite/inputs/savannah-20273.xi
diff -N xargs/testsuite/inputs/savannah-20273.xi
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ xargs/testsuite/inputs/savannah-20273.xi 27 Jun 2007 17:51:35 -0000
@@ -0,0 +1,3 @@
+1
+2
+3
Index: xargs/testsuite/xargs.posix/savannah-20273.exp
===================================================================
RCS file: xargs/testsuite/xargs.posix/savannah-20273.exp
diff -N xargs/testsuite/xargs.posix/savannah-20273.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ xargs/testsuite/xargs.posix/savannah-20273.exp 27 Jun 2007 17:51:35
-0000
@@ -0,0 +1 @@
+xargs_start p "" savannah-20273.xi "" "sh -c {$XARGS $XARGSFLAGS -E2; cat}"
Index: xargs/testsuite/xargs.posix/savannah-20273.xo
===================================================================
RCS file: xargs/testsuite/xargs.posix/savannah-20273.xo
diff -N xargs/testsuite/xargs.posix/savannah-20273.xo
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ xargs/testsuite/xargs.posix/savannah-20273.xo 27 Jun 2007 17:51:35
-0000
@@ -0,0 +1,2 @@
+1
+3
--
View this message in context:
http://www.nabble.com/-PATCH--bug-20273-tf3989966.html#a11329594
Sent from the GNU - FindUtils - Patches mailing list archive at Nabble.com.
- [Findutils-patches] [PATCH] bug 20273,
Eric Blake-1 <=