Re: [PATCH] timeout: fix failure if timeout's parent has ignored SIGCHLD

2009-12-08 Thread Pádraig Brady
I'm a bit worried about doing the following in this patch.
It seems to work but I can see ignoring CHLD being
problematic for some shells/situations.
I'll probably push without the test.

--- a/tests/misc/timeout
+++ b/tests/misc/timeout
@@ -23,6 +23,7 @@ fi

 . $srcdir/test-lib.sh

+trap '' CHLD # ensure `timeout` is immune to parent's SIGCHLD handler




[PATCH] sort: fix failure if sort's parent has ignored SIGCHLD

2009-12-08 Thread Pádraig Brady
The same issue as with the previous `timeout` patch.
The attached includes at test, but I'll probably remove
it because of the previously mentioned concerns.

cheers,
Pádraig.




Re: stty & stty-row-col test failures

2009-12-08 Thread Pádraig Brady
I'm going with this unless there are objections

>From bb0ae98acca9fe2b27eb5ccadf57d4842cab5d8f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= 
Date: Tue, 8 Dec 2009 08:00:37 +
Subject: [PATCH] tests: fix stty-row-col failure on small fixed terminals

* tests/misc/stty-row-col: Linux virtual consoles at least,
issue an error if you try to increase their size, so skip the
test if we can't increase the dimensions of the tty by 1 cell.
Reported by Matthew Burgess.
---
 tests/misc/stty-row-col |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
index 5efc7dd..943565f 100755
--- a/tests/misc/stty-row-col
+++ b/tests/misc/stty-row-col
@@ -60,6 +60,15 @@ set $tests
 saved_size=`stty size` && test -n "$saved_size" \
   || skip_test_ "can't get window size"

+# Linux virtual consoles issue an error if you
+# try to increase their size.  So skip in that case.
+if ! test "x$saved_size" = "x0 0"; then
+  srow=`echo $saved_size | cut -d ' ' -f1`
+  scol=`echo $saved_size | cut -d ' ' -f2`
+  stty rows `expr $srow + 1` cols `expr $scol + 1` ||
+skip_test_ "can't increase window size"
+fi
+
 while :; do
   test_name=$1
   args=$2
-- 
1.6.2.5





Re: stty & stty-row-col test failures

2009-12-08 Thread Jim Meyering
Pádraig Brady wrote:

> I'm going with this unless there are objections
>
>>From bb0ae98acca9fe2b27eb5ccadf57d4842cab5d8f Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= 
> Date: Tue, 8 Dec 2009 08:00:37 +
> Subject: [PATCH] tests: fix stty-row-col failure on small fixed terminals
>
> * tests/misc/stty-row-col: Linux virtual consoles at least,
> issue an error if you try to increase their size, so skip the
> test if we can't increase the dimensions of the tty by 1 cell.
> Reported by Matthew Burgess.
> ---
>  tests/misc/stty-row-col |9 +
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
> index 5efc7dd..943565f 100755
> --- a/tests/misc/stty-row-col
> +++ b/tests/misc/stty-row-col
> @@ -60,6 +60,15 @@ set $tests
>  saved_size=`stty size` && test -n "$saved_size" \
>|| skip_test_ "can't get window size"
>
> +# Linux virtual consoles issue an error if you
> +# try to increase their size.  So skip in that case.
> +if ! test "x$saved_size" = "x0 0"; then
> +  srow=`echo $saved_size | cut -d ' ' -f1`
> +  scol=`echo $saved_size | cut -d ' ' -f2`
> +  stty rows `expr $srow + 1` cols `expr $scol + 1` ||
> +skip_test_ "can't increase window size"
> +fi

Hi Pádraig,

Thanks for tracking that down!
Would you please use "!=" in that test
and $(...) rather than `...` ?

if test "x$saved_size" != "x0 0"; then
  srow=$(echo $saved_size | cut -d ' ' -f1)
  scol=$(echo $saved_size | cut -d ' ' -f2)
  stty rows $(expr $srow + 1) cols $(expr $scol + 1) ||
skip_test_ "can't increase window size"
fi




Re: stty & stty-row-col test failures

2009-12-08 Thread Jim Meyering
Pádraig Brady wrote:

> Matthew Burgess wrote:
>> Hi,
>>
>> The stty & stty-row-col tests fail for me, but I can't figure out why. I
>> wonder whether it's because I'm in a VirtualBox host and it's somehow
>> interfering with the tests?  Anyway, I've attached the logs from a
>> verbose run of both tests.  If someone wouldn't mind taking a look for
>> me please, I'd appreciate it.
>>
>> This is with Coreutils-8.1 on a Kubuntu 9.10 guest under a
>> VirtualBox-3.1.0 VM on a Windows XP host.
>>
>> If you need any more information or debug output then I'll be more than
>> happy to provide it.
>
> I asked for a kernel version before preparing a patch
> for this previously reported issue:
> http://lists.gnu.org/archive/html/bug-coreutils/2009-11/msg00059.html
> Since you've mentioned Karmic I'm going to apply the following.
>
> cheers,
> Pádraig.
>
> diff --git a/tests/misc/stty b/tests/misc/stty
> index cb3fee5..e8b2a9a 100755
> --- a/tests/misc/stty
> +++ b/tests/misc/stty
> @@ -63,8 +63,10 @@ options=`stty -a | tr -s ';' '\n' | sed "s/^ 
> //;$sed_del;s/-//g"`
>  for opt in $options; do
># `stty parenb' and `stty -parenb' fail with this message
># stty: standard input: unable to perform all requested operations
> -  # on Linux 2.2.0-pre4 kernels, so skip those tests.
> -  test $opt = parenb && continue
> +  # on Linux 2.2.0-pre4 kernels.  Also since Linux 2.6.31 the
> +  # other serial control settings give the same error. So skip them.
> +  case $opt in parenb|parodd|cstopb|crtscts) continue;; esac

Thanks!  This has been a long-standing intermittent problem.




Re: stty & stty-row-col test failures

2009-12-08 Thread Pádraig Brady
Jim Meyering wrote:
> Thanks for tracking that down!
> Would you please use "!=" in that test
> and $(...) rather than `...` ?

Sure, I was wary because of the mention of sunos in the test.






Re: new snapshot available: coreutils-8.1.24-7a2b0

2009-12-08 Thread Jim Meyering
Matthew Burgess wrote:
> I get a 403 Forbidden error trying to download the latest ss tarballs
> from both meyering.net & people.redhat.com.

Hi Matthew.

Rats.  Thanks for the heads up.
I've just fixed the permissions on both.
That was fall-out from my switching a shell to a umask of 077.
My upload procedure depended on the prior 022 setting.  Must fix.

> What timescales did you envisage for the 8.2 release?

It should be tomorrow or Thursday.
Later if there are too many changes.

> I'll try to run
> through an LFS build with it prior to the release so I can report any
> issues I see *before* one of your stable releases for a change :-)

Thanks!




Re: [PATCH] sort: fix failure if sort's parent has ignored SIGCHLD

2009-12-08 Thread Pádraig Brady
Pádraig Brady wrote:
> The same issue as with the previous `timeout` patch.
> The attached includes at test, but I'll probably remove
> it because of the previously mentioned concerns.

really attached this time. sorry
>From 33904143eab537385ce1af58ea15c1876da402c7 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= 
Date: Tue, 8 Dec 2009 08:48:34 +
Subject: [PATCH] sort: fix failure if sort's parent has ignored SIGCHLD

* src/sort.c (main): Reset the SIGCHLD handler to the default
as otherwise wait() could return an error.
* tests/misc/sort-compress: Set the CHLD handler to SIG_IGN to ensure
the sort command resets it to SIG_DFL.
* NEWS: Mention the fix.
---
 NEWS |4 
 src/sort.c   |1 +
 tests/misc/sort-compress |2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 19cca5b..528eedc 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,10 @@ GNU coreutils NEWS-*- outline -*-
   the presence of the empty string argument.
   [bug introduced in coreutils-8.0]
 
+  sort is now immune to the signal handling of its parent.
+  Specifically sort now doesn't exit with an error message
+  if it uses helper processes for compression and its parent
+  ignores CHLD signals. [bug introduced in coreutils-6.9]
 
 * Noteworthy changes in release 8.1 (2009-11-18) [stable]
 
diff --git a/src/sort.c b/src/sort.c
index 8709e53..70e0bbb 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -3254,6 +3254,7 @@ main (int argc, char **argv)
 }
 #endif
   }
+  signal (SIGCHLD, SIG_DFL); /* Don't inherit CHLD handling from parent.  */
 
   /* The signal mask is known, so it is safe to invoke exit_cleanup.  */
   atexit (exit_cleanup);
diff --git a/tests/misc/sort-compress b/tests/misc/sort-compress
index 7e4278e..e923e64 100755
--- a/tests/misc/sort-compress
+++ b/tests/misc/sort-compress
@@ -23,6 +23,8 @@ fi
 
 . $srcdir/test-lib.sh
 
+trap '' CHLD # ensure `sort` is immune to parent's SIGCHLD handler
+
 seq -w 2000 > exp || framework_failure
 tac exp > in || framework_failure
 SORT="$abs_top_builddir/src/sort"
-- 
1.6.2.5



Re: stty & stty-row-col test failures

2009-12-08 Thread Jim Meyering
Pádraig Brady wrote:
> Jim Meyering wrote:
>> Thanks for tracking that down!
>> Would you please use "!=" in that test
>> and $(...) rather than `...` ?
>
> Sure, I was wary because of the mention of sunos in the test.

The configure-time test for a posix shell should cover us in the tests,
since each is invoked via an explicit $(SHELL) from test/check.mk:

TESTS_ENVIRONMENT = \
  . $(srcdir)/lang-default; \
  tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
  . $(srcdir)/envvar-check; \
  TMPDIR=$$tmp__; export TMPDIR;\
  ...
  $(SHELL) "$$1";   \
fi; \
  ...




Re: [PATCH] timeout: fix failure if timeout's parent has ignored SIGCHLD

2009-12-08 Thread Pádraig Brady
Pádraig Brady wrote:
> I'm a bit worried about doing the following in this patch.
> It seems to work but I can see ignoring CHLD being
> problematic for some shells/situations.
> I'll probably push without the test.

Oh it looks like tests/install/trap already addresses
the portability concerns I was worrying about.
I'll use that method to run the test.

http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=tests/install/trap;hb=HEAD

cheers,
Pádraig.




Re: [PATCH] timeout: fix failure if timeout's parent has ignored SIGCHLD

2009-12-08 Thread Jim Meyering
Pádraig Brady wrote:
> Pádraig Brady wrote:
>> I'm a bit worried about doing the following in this patch.
>> It seems to work but I can see ignoring CHLD being
>> problematic for some shells/situations.
>> I'll probably push without the test.
>
> Oh it looks like tests/install/trap already addresses
> the portability concerns I was worrying about.
> I'll use that method to run the test.
>
> http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=tests/install/trap;hb=HEAD

Ahhh.  Good. I'd forgotten about that.
Same for the test of your sort fix, I presume.




mv -v, cp -v messages should be different

2009-12-08 Thread jidanni
Gentlemen, I object. The messages for these two commands should be different.
$ cp -v f g
`f' -> `g'
$ mv -v f g
`f' -> `g'
Exactly how different etc. I leave up to you. Maybe even just => for the
latter instead of ->.




Re: mv -v, cp -v messages should be different

2009-12-08 Thread Pádraig Brady
jida...@jidanni.org wrote:
> Gentlemen, I object. The messages for these two commands should be different.
> $ cp -v f g
> `f' -> `g'
> $ mv -v f g
> `f' -> `g'
> Exactly how different etc. I leave up to you. Maybe even just => for the
> latter instead of ->.

I think it's fine from the context as is?
If one was going to change it I'd have:

file == file_copy
file -> file_rename
file => file_copy_unlink

But I don't see the need TBH.

cheers,
Pádraig.




Re: build: distcheck: do not leave a $TMPDIR/coreutils directory behind

2009-12-08 Thread Jim Meyering
Jim Meyering wrote:
> FYI, I should be pushing these soon, and then making a snapshot
> within a couple hours:
>
> [PATCH 1/2] build: distcheck: do not leave a $TMPDIR/coreutils directory 
> behind

aka, http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=ae034822c535fa5

Now that there's a public BZ mentioning the security impact,
http://bugzilla.redhat.com/545439, I will note that the above
change also fixes a security-related flaw.  Any user running
"make distcheck" with TMPDIR unset or set to a world-writable
directory like /tmp, is vulnerable to arbitrary code execution.

So either don't run "make distcheck", with coreutils-8.1 or earlier,
or be sure that TMPDIR is not a world-writable directory.

I'll add something like the above to NEWS.




Re: git coreutils 'make check' hangs

2009-12-08 Thread Ralf Wildenhues
Hi Pádraig,

* Pádraig Brady wrote on Tue, Dec 08, 2009 at 02:00:20AM CET:
> Ralf Wildenhues wrote:
> > for some time now, 'make check' in the git coreutils tree hangs for me:
[...]
> I think it may be a gdb issue:
> http://lists.gnu.org/archive/html/bug-coreutils/2009-12/msg00025.htm
> For the moment we've marked that test as "very expensive"
> so that it will not be run by default.

Ah, ok, I didn't see that thread.  Sorry about the noise then.

Thanks,
Ralf




new snapshot available: coreutils-8.1.30-0f8bb

2009-12-08 Thread Jim Meyering
This should be the final snapshot before coreutils-8.2,
due tomorrow or Thursday.

coreutils snapshot: (.gz files are here, too)
  http://meyering.net/cu/coreutils-ss.tar.xz  4.3 MB
  http://meyering.net/cu/coreutils-ss.tar.xz.sig
  http://meyering.net/cu/coreutils-8.1.30-0f8bb.tar.xz

There are .gz and .sig files here, too:
  http://people.redhat.com/meyering/cu/coreutils-ss.tar.xz
  http://people.redhat.com/meyering/cu/coreutils-8.1.30-0f8bb.tar.xz

Changes in coreutils since 8.1.24-7a2b0:

Jim Meyering (1):
  build: update gnulib submodule to latest

Pádraig Brady (5):
  tests: fix stty failure with serial control settings
  tests: fix stty-row-col failure on small fixed terminals
  timeout: fix failure if timeout's parent has ignored SIGCHLD
  sort: fix failure if sort's parent has ignored SIGCHLD
  maint: remove an erroneous comment


Changes in gnulib since 8.1.24-7a2b0:

* gnulib 3e035a5...5aad650 (22):
  > init.sh: avoid Solaris 10 /bin/sh portability problem
  > Document pty.h functions.
  > fchdir: fix logic bugs
  > dup2: fix logic bugs
  > unlink: fix m4 detection
  > unistd-safer: add unit test
  > cloexec: preserve text vs. binary across dup_cloexec
  > mgetgroups: reduce duplicate listings
  > cloexec: Fix possible compilation error.
  > prognam: Add diagnostic.
  > pipe2-safer: new module
  > stdlib-safer: preserve cloexec flag for mkostemp[s]
  > unistd-safer: allow preservation of cloexec status via flag
  > test-dup2: enhance test
  > cloexec: add dup_cloexec
  > test-xalloc-die: fix test for mingw
  > test-fseeko: fix test for mingw
  > autoupdate
  > progname: Clarify specification.
  > maint.mk: backslash-escape parens in default regexp
  > maint.mk: news-check: use grep -E
  > maintainer-makefile: allow customization of NEWS entry format




Re: git coreutils 'make check' hangs

2009-12-08 Thread Alan Curry
Ralf Wildenhues writes:
> 
> Hi Pádraig,
> 
> * Pádraig Brady wrote on Tue, Dec 08, 2009 at 02:00:20AM CET:
> > Ralf Wildenhues wrote:
> > > for some time now, 'make check' in the git coreutils tree hangs for me:
> [...]
> > I think it may be a gdb issue:
> > http://lists.gnu.org/archive/html/bug-coreutils/2009-12/msg00025.htm
> > For the moment we've marked that test as "very expensive"
> > so that it will not be run by default.
> 
> Ah, ok, I didn't see that thread.  Sorry about the noise then.
> 

If yours is caused by the same thing (gdb failing to kill its child process
and exit) could you tell me your uname -a? I'd like to be sure it's not just
an arch-dependent kernel bug before reporting it as a man page bug. Something
still needs to get fixed, even if coreutils no longer cares about it.

-- 
Alan Curry




Re: new snapshot available: coreutils-8.1.30-0f8bb

2009-12-08 Thread Pádraig Brady
   Passed Skipped Failed
  \-
Fedora core 5 x86 |   363  48  0
Fedora 11 x86 |   362  49  0
Solaris 10 x86|   342  69  0
FreeBSD 6 x86 |   338  73  0





touching "-"

2009-12-08 Thread antonio

$ touch - && echo ok
ok

$ ls -
ls: cannot access -: No such file or directory

$ touch -- - && echo ok
ok

$ ls -
ls: cannot access -: No such file or directory

$ : > -

$ ls -
-





Re: touching "-"

2009-12-08 Thread Eric Blake
> $ touch - && echo ok
> ok

Not a bug - you successfully touched stdout (in this case,
your terminal).  Remember, many commands special case - to
mean stdin or stdout if they operate well on a single file.

> 
> $ ls -
> ls: cannot access -: No such file or directory

ls is not one of those commands.  So rather than listing
stdin or stdout (neither of which makes sense), it tries
to list ./- and fails.

If you really must touch ./-, then say so:

touch ./-

-- 
Eric Blake