Re: [PATCH] Implement join --check-order and --nocheck-order.

2008-03-25 Thread Jim Meyering
"Dmitry V. Levin" <[EMAIL PROTECTED]> wrote:
> On Tue, Feb 19, 2008 at 03:44:00PM +0100, Jim Meyering wrote:
>> James Youngman <[EMAIL PROTECTED]> wrote:
>> > This is a consolidated patch including all the previous changes,
>> > implementing order checking in join by default.  "make distcheck"
>> > works (if I move distcheck-hook from Makefile.am to GNUmakefile).
>> >
>> > 2008-02-16  James Youngman  <[EMAIL PROTECTED]>
>> >
>> >* src/join.c: Support --check-order and --nocheck-order.
>> >New variables check_input_order, seen_unpairable and
>> >issued_disorder_warning[]. For --check-order, verify that the
>> ...
>>
>> Thanks again.
>> I've just pushed that.
>
> Looks like this commit v6.10-70-ga1e7156 introduces a regression:
>
> $ printf '%s\n%s\n' '1 b' '2 a' | sort -k2,2 | join -12 -21 - /dev/null
> join: File 1 is not in sorted order
> $ echo $?
> 1
> $ join --version |grep join
> join (GNU coreutils) 6.10.133-677610

Thanks again.
I've pushed the patch:

join bug fix: adapt keycmp to work with new order-checking feature

* src/join.c (keycmp): Add two join-field parameters.
(check_order, join): Update callers.
Reported by Dmitry V. Levin in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/12731/focus=13017
* tests/join/Test.pm (chkodr-7): New test for this fix.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH] Generalize GNUmakefile, ...

2008-03-25 Thread Jim Meyering
Eric Blake <[EMAIL PROTECTED]> wrote:
> According to Jim Meyering on 3/20/2008 7:58 AM:
> |> Here's stage 1 of the sync for coreutils.  The patch looks big, but that's
> |> due to how 'git format-patch' handles renames.
>
> I just learned 'git config --global diff.renames true' to make renaming
> patches default to their more compact representation.

Thanks for the tip.

> |>  Once gnulib is further
> |> fixed to dump GNUmakefile into the top directory, stage 2 would be using
> |> the gnulib module rather than synchronizing the files.
>
> As follows.
...
>>From bb003f7e035fab9a8c4e8dc6d0c5c945f48952f1 Mon Sep 17 00:00:00 2001
> From: Eric Blake <[EMAIL PROTECTED]>
> Date: Mon, 24 Mar 2008 05:51:10 -0600
> Subject: [PATCH] Use new gnulib gnumakefile module.
>
> * bootstrap.conf (gnulib_modules): Pull in new module.
> * GNUmakefile: Remove from version control.
> * .gitignore: Update.
> * configure.ac (AC_CONFIG_LINKS): Delete; rely on gnulib to do
> this now.
> * Makefile.am (EXTRA_DIST, distclean-local): Likewise.

Thanks.  Perfect ;-)
Applied verbatim.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Problems on darwin with coreutils-6.10.133-677610

2008-03-25 Thread Jim Meyering
Peter Fales <[EMAIL PROTECTED]> wrote:
> Trying to build http://meyering.net/cu/coreutils-6.10.133-677610.tar.gz
> and getting test failures on darwin (Mac OS/X), as  "id -G" is returning
> incorrect values.  It seems that in id.c, we have
>
>   214   user_name = pwd ? pwd->pw_name : NULL;
>
> where user_name caches a value returned by getpwuid().  However, down
> in print_group_list() at line 43, getpwuid() is called again, and it
> causes the value pointed to by username to be corrupted.   I've attached
> a patch which appears to help.
...
> diff -ur coreutils-6.10.133-677610/src/id.c 
> coreutils-6.10.133-677610.new/src/id.c
> --- coreutils-6.10.133-677610/src/id.c2008-03-13 18:09:44.0 
> -0500
> +++ coreutils-6.10.133-677610.new/src/id.c2008-03-24 11:38:14.0 
> -0500
> @@ -211,7 +211,7 @@
>struct passwd const *pwd;
>euid = geteuid ();
>pwd = getpwuid (euid);
> -  user_name = pwd ? pwd->pw_name : NULL;
> +  user_name = pwd ? strdup(pwd->pw_name) : NULL;

Thanks a lot!
I'm applying this patch:

>From f7d1c59c224f81a8bab5fa2afcaf815988f50467 Mon Sep 17 00:00:00 2001
From: Peter Fales <[EMAIL PROTECTED]>
Date: Tue, 25 Mar 2008 22:44:01 +0100
Subject: [PATCH] id bug fix: don't point to potentially clobbered static storage

On at least Mac OS, when calling getpwuid twice with the same UID,
the static storage containing results from the first call is
invalidated by the second call.
* src/id.c (main): Point to a copy of the user name string.

Signed-off-by: Jim Meyering <[EMAIL PROTECTED]>
---
 src/id.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/id.c b/src/id.c
index 9ee52e1..a178714 100644
--- a/src/id.c
+++ b/src/id.c
@@ -211,7 +211,7 @@ of a different user"));
   struct passwd const *pwd;
   euid = geteuid ();
   pwd = getpwuid (euid);
-  user_name = pwd ? pwd->pw_name : NULL;
+  user_name = pwd ? xstrdup (pwd->pw_name) : NULL;
   ruid = getuid ();
   egid = getegid ();
   rgid = getgid ();
--
1.5.5.rc0.22.g467c


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


FYI: mkdir -Z no-such-context DIR segfaults

2008-03-25 Thread Jim Meyering
FYI, Daniel Dunbar, Cristian Cadar and Dawson Engler
discovered that "mkdir -Z no-such-context DIR" segfaults.
Here's the fix and a new test:

>From 72d052896a9092b811961a8f3e6ca5d151a59be5 Mon Sep 17 00:00:00 2001
From: Daniel Dunbar <[EMAIL PROTECTED]>
Date: Wed, 26 Mar 2008 00:51:47 +0100
Subject: [PATCH] mkdir -Z x d: don't segfault when diagnosing invalid context 
"x" (tiny change)

* src/mkdir.c (main): Use "scontext", not NULL optarg in diagnostic.
Reported by Cristian Cadar, Daniel Dunbar and Dawson Engler.
* NEWS: Mention the bug fix.

Signed-off-by: Jim Meyering <[EMAIL PROTECTED]>
---
 NEWS|2 ++
 src/mkdir.c |2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index 43d80ca..5250ed8 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ GNU coreutils NEWS-*- 
outline -*-
   ls no longer segfaults on files in /proc when linked with an older version
   of libselinux.  E.g., ls -l /proc/sys would dereference a NULL pointer.

+  "mkdir -Z x dir" no longer segfaults when diagnosing invalid context "x"
+
   mv would mistakenly unlink a destination file before calling rename,
   when the destination had two or more hard links.  It no longer does that.
   [bug introduced in coreutils-5.3.0]
diff --git a/src/mkdir.c b/src/mkdir.c
index 3952594..d3d76ad 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -192,7 +192,7 @@ main (int argc, char **argv)
   if (scontext && setfscreatecon (scontext) < 0)
 error (EXIT_FAILURE, errno,
   _("failed to set default file creation context to %s"),
-  quote (optarg));
+  quote (scontext));

   if (options.make_ancestor_function || specified_mode)
 {
--
1.5.5.rc0.22.g467c


>From 0e5381fe9357d89806dded3e8538dcb932ae3cac Mon Sep 17 00:00:00 2001
From: Jim Meyering <[EMAIL PROTECTED]>
Date: Wed, 26 Mar 2008 01:11:16 +0100
Subject: [PATCH] Test for mkdir bug fix.

* tests/mkdir/selinux: New file: test for today's fix.
* tests/mkdir/Makefile.am (TESTS): Add selinux.

Signed-off-by: Jim Meyering <[EMAIL PROTECTED]>
---
 tests/mkdir/Makefile.am |1 +
 tests/mkdir/selinux |   38 ++
 2 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100755 tests/mkdir/selinux

diff --git a/tests/mkdir/Makefile.am b/tests/mkdir/Makefile.am
index 617abcf..ee8bfb8 100644
--- a/tests/mkdir/Makefile.am
+++ b/tests/mkdir/Makefile.am
@@ -1,5 +1,6 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-.
 TESTS = \
+  selinux \
   p-1 \
   p-2 \
   p-3 \
diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux
new file mode 100755
index 000..9bfd090
--- /dev/null
+++ b/tests/mkdir/selinux
@@ -0,0 +1,38 @@
+#!/bin/sh
+# ensure that an invalid context doesn't cause a segfault
+
+# Copyright (C) 2008 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 3 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, see .
+
+if test "$VERBOSE" = yes; then
+  set -x
+  mkdir --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
+
+c=invalid-selinux-context
+
+fail=0
+mkdir -Z $c dir-arg 2> out && fail=1
+cat < exp || fail=1
+mkdir: failed to set default file creation context to \`$c': Invalid argument
+EOF
+
+compare out exp || fail=1
+
+(exit $fail); exit $fail
--
1.5.5.rc0.22.g467c


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


od bug

2008-03-25 Thread Steve Frampton
Hello,

Linux appears to swap the bytes within the words:

[EMAIL PROTECTED] ~]$ uname -a
Linux bgr-7r4ved1l.soi.com 2.6.18-53.1.4.el5 #1 SMP Fri Nov 30 00:45:16
EST 2007 i686 i686 i386 GNU/Linux
[EMAIL PROTECTED] ~]$ od --version
od (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the
terms of
the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.
[EMAIL PROTECTED] ~]$ echo "abcdefgh" | od -x
000 6261 6463 6665 6867 000a
011
[EMAIL PROTECTED] ~]$  



HPUX od shown as a baseline:

/home/sframpto--> uname -a
HP-UX soi_prod B.10.20 A 9000/800 1279364181 two-user license
/home/sframpto--> echo "abcdefgh" | od -x
000 6162 6364 6566 6768 0a00
011
/home/sframpto-->


Best,

Steve



Confidentiality Notice:  This transmission (including any attachments)  is 
privileged, confidential, and intended only for the party for whom it is 
addressed; any other use is prohibited.  If you have received it in error 
please notify the sender and delete all copies.

Tax Notice:  To ensure compliance with Treasury Department Circular 230 please 
note that nothing contained in this communication (including any attachments) 
is to be considered tax advice, nor is it intended or written to be used, nor 
may it be used, for the purpose of avoiding penalties under the Internal 
Revenue Code or any other tax law. 

Nothing in this email or attachments hereto creates, modifies, is a part of, or 
supersedes any contract including, without limitation, any service agreement.  
Only written agreements by officers with actual authority may do so.



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: od bug

2008-03-25 Thread Eric Blake

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Steve Frampton on 3/25/2008 3:46 PM:
| Hello,
|
| Linux appears to swap the bytes within the words:

Because it's little-endian.

|
| HPUX od shown as a baseline:

Because it's big-endian.

In short, this is not a bug.  -x is short for -tx2, but you probably want
to use -tx1.

|
| Confidentiality Notice:  This transmission (including any attachments)
is privileged,

Note that it is considered bad netiquette to send email with unenforceable
legal disclaimers appended on, since the post is now publicly archived.
Some people refuse to reply to such mail on principle.  Consider using a
free email account.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfpoVMACgkQ84KuGfSFAYAOzACfd+Z9BkONUW9hmdAAgZ9cblAn
fV8An2Z5VnKf9o3sxFa2P7/j5ymYuvPQ
=IMA/
-END PGP SIGNATURE-


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: od bug

2008-03-25 Thread Bob Proulx
Steve Frampton wrote:
> Linux appears to swap the bytes within the words:

Most Linux kernel based systems are little endian.  So are many
others.  Here is are two references that explains this in some detail.

  http://en.wikipedia.org/wiki/Endianness

  http://www.ietf.org/rfc/ien/ien137.txt

> [EMAIL PROTECTED] ~]$ echo "abcdefgh" | od -x
> 000 6261 6463 6665 6867 000a

That is the correct output on little endian systems.

> HPUX od shown as a baseline:

HP-UX is a big endian system.  The order of bytes within the word will
be opposite that of a little endian system.

> /home/sframpto--> uname -a
> HP-UX soi_prod B.10.20 A 9000/800 1279364181 two-user license

I am convinced that HP-UX 10.20 which was released in 1996 and is now
12 years old will never die.

> /home/sframpto--> echo "abcdefgh" | od -x
> 000 6162 6364 6566 6768 0a00

That is the correct output on big endian systems.

At the root of your confusion is that you are asking od to print
two-byte units (ala PDP-11 16-bit words) with -x.  Using -x is the
same as -tx2.  Words are printed in native byte order.  This is
required by long term legacy and standardized by POSIX.

I would guess what you are wanting is to print bytes.  To print bytes
you would need to use -tx1.

  echo "abcdefgh" | od -tx1
  000 61 62 63 64 65 66 67 68 0a

See the FAQ for more information.

  http://www.gnu.org/software/coreutils/faq/

Look for "The 'od -x' command prints bytes in the wrong order." for
the section on your question.

> Confidentiality Notice: This transmission (including any
> attachments) is privileged, confidential, and intended only for the
> ...

Those disclaimers are useless.  Many people on public mailing lists
refuse to answer questions posted that included them.  If your company
insists on this annoying behavior then please in the future send your
questions from one of the many free email services provided on the
Internet that does not include this bad behavior.

  http://goldmark.org/jeff/stupid-disclaimers/

Bob



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: Problems on darwin with coreutils-6.10.133-677610

2008-03-25 Thread Eric Blake

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Jim Meyering on 3/25/2008 3:47 PM:
| -  user_name = pwd ? pwd->pw_name : NULL;
| +  user_name = pwd ? xstrdup (pwd->pw_name) : NULL;

Doesn't this leak memory?

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEUEARECAAYFAkfprQwACgkQ84KuGfSFAYD1fACXRdkw2I+N4yTejkEgiBRQuBbW
1wCfUHLMIBg5UsSpaY8h0KR/3AT2KNw=
=oSCJ
-END PGP SIGNATURE-


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: configure fails on Maemo/OS2008 (sed: no previous regexp)

2008-03-25 Thread Eric Blake

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Jim Meyering on 3/22/2008 12:20 PM:
|>> $ busybox sed -n '/^g''l_INCLUDE_EXCLUDE_PROG(.*
\[\(.*\)\])/{s//\1/;s/,/ /gp
|>> }' configure.ac
|>> sed: No previous regexp.
|>> [Exit 1]
|
| This appears to be a busybox "limitation".
| I expect to work around it with this patch:
|
|   portability: work around a "busybox sed" limitation
|   * configure.ac: While every other sed tested supports usage like
|   '/\(re\)/{s//\1/;...}', and POSIX appears to requires this,
|   busybox's sed does not support it.  So duplicate the regexp:
|   '/\(re\)/{s/\(re\)/\1/;...}'.  Reported by Vincent Lefevre:
|   .

Thanks for this portability analysis.  I agree that it is a violation of
POSIX; perhaps someone should report this to the busybox maintainers.
Meanwhile, I'm documenting it for future reference:

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfpw3EACgkQ84KuGfSFAYC6OQCeOw1cPdjBE2ZwH++iVkpXn48j
0icAn0SljIY336+ZkVroD9J4EY7QJHu5
=ZYIO
-END PGP SIGNATURE-
>From 5c55fb1f4db4ce31263d71744014eddde28071fd Mon Sep 17 00:00:00 2001
From: Eric Blake <[EMAIL PROTECTED]>
Date: Tue, 25 Mar 2008 21:19:58 -0600
Subject: [PATCH] Document busybox sed bug.

* doc/autoconf.texi (Limitations of Usual Tools): Mention
restrictions when using back-references.
Reported by Vincent Lefevre:
.

Signed-off-by: Eric Blake <[EMAIL PROTECTED]>
---
 ChangeLog |6 ++
 doc/autoconf.texi |   14 ++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0aab398..7f82ee2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-03-26  Eric Blake  <[EMAIL PROTECTED]>
 
+   Document busybox sed bug.
+   * doc/autoconf.texi (Limitations of Usual Tools): Mention
+   restrictions when using back-references.
+   Reported by Vincent Lefevre:
+   .
+
Document Automake interaction with AC_CONFIG_MACRO_DIR.
* doc/autoconf.texi (Input): Mention ACLOCAL_AMFLAGS for automake
users.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 17b9045..b72d875 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15389,6 +15389,20 @@ flushleft
indented
 @end example
 
+Posix requires that with an empty regular expression, the last non-empty
+regular expression from either an address specification or substitution
+command is applied.  However, busybox 1.6.1 complains when using a
+substitution command with a replacement containing a back-reference to
+an empty regular expression; the workaround is repeating the regular
+expression.
+
[EMAIL PROTECTED]
[EMAIL PROTECTED] {echo abc | busybox sed '/a\(b\)c/ s//\1/'}
+sed: No previous regexp.
[EMAIL PROTECTED] {echo abc | busybox sed '/a\(b\)c/ s/a\(b\)c/\1/'}
+b
[EMAIL PROTECTED] example
+
 
 @item @command{sed} (@samp{t})
 @c ---
-- 
1.5.4

___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils