Re: seq bug -- out of bounds read (off by one)

2008-03-24 Thread Jim Meyering
Daniel Dunbar <[EMAIL PROTECTED]> wrote:
> Thanks for the quick reply on the ptx bug.
>
> We have found another minor bug (non-crashing) in seq. An example problem 
> input
> is:
> --
> [EMAIL PROTECTED]:src$ ./seq -f %0 1
> ./seq: memory exhausted
> --
>
> The problem is in seq.c:213 (in 6.10 source),
>   if (! strchr ("efgaEFGA", fmt[i]))
> which I believe should be
>   if (!fmt[i] || ! strchr ("efgaEFGA", fmt[i]))

Thanks for the report.
However that particular problem was fixed a few weeks ago:

  "seq -f % 1" would issue the erroneous diagnostic "seq: memory exhausted"
  rather than reporting the invalid string format.
  [bug introduced in coreutils-6.0]

You can get the very latest sources via:

  git clone git://git.sv.gnu.org/coreutils

or a slightly older snapshot from here:

  http://meyering.net/cu/coreutils-ss.tar.gz8.6 MB
  http://meyering.net/cu/coreutils-ss.tar.lzma  3.6 MB
  http://meyering.net/cu/coreutils-ss.tar.gz.sig
  http://meyering.net/cu/coreutils-ss.tar.lzma.sig


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


Re: [PATCH] Generalize GNUmakefile, ...

2008-03-24 Thread Eric Blake

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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.

|>  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.

- --
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

iEYEARECAAYFAkfnlloACgkQ84KuGfSFAYBY/QCffxkfSN0urLDFRG4yIezxGET7
i4wAn3lE3QP1KHXYjfZj2FA6H4VWKEw4
=4DwV
-END PGP SIGNATURE-
>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.

Signed-off-by: Eric Blake <[EMAIL PROTECTED]>
---
 .gitignore |2 +
 GNUmakefile|   86 
 Makefile.am|7 +
 bootstrap.conf |2 +-
 configure.ac   |   14 -
 5 files changed, 4 insertions(+), 107 deletions(-)
 delete mode 100644 GNUmakefile

diff --git a/.gitignore b/.gitignore
index b5c507e..c5d7a01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 .version
 ABOUT-NLS
 ChangeLog
+GNUmakefile
 ID
 INSTALL
 Makefile
@@ -50,6 +51,7 @@ lib/libcoreutils.a
 lib/printf.c
 lib/progname.c
 lib/progname.h
+lib/selinux
 m4/.cvsignore
 m4/.gitignore
 po/*.gmo
diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 100644
index 38dd126..000
--- a/GNUmakefile
+++ /dev/null
@@ -1,86 +0,0 @@
-# Having a separate GNUmakefile lets me `include' the dynamically
-# generated rules created via cfg.mk (package-local configuration)
-# as well as maint.mk (generic maintainer rules).
-# This makefile is used only if you run GNU Make.
-# It is necessary if you want to build targets usually of interest
-# only to the maintainer.
-
-# Copyright (C) 2001, 2003, 2006-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 .
-
-# Systems where /bin/sh is not the default shell need this.  The $(shell)
-# command below won't work with e.g. stock DOS/Windows shells.
-ifeq ($(wildcard /bin/s[h]),/bin/sh)
-SHELL = /bin/sh
-else
-# will be used only with the next shell-test line, then overwritten
-# by a configured-in value
-SHELL = sh
-endif
-
-# If the user runs GNU make but has not yet run ./configure,
-# give them a diagnostic.
-_have-Makefile := $(shell test -f Makefile && echo yes)
-ifeq ($(_have-Makefile),yes)
-
-# Make tar archive easier to reproduce.
-export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
-
-include Makefile
-
-# Some projects override e.g., _autoreconf here.
--include $(srcdir)/cfg.mk
-include $(srcdir)/maint.mk
-
-# Allow cfg.mk to override these.
-_build-aux ?= build-aux
-_autoreconf ?= autoreconf
-
-# Ensure that $(VERSION) is up to date for dist-related targets, but not
-# for others: rerunning autoreconf and recompiling everything isn't cheap.
-_have-git-version-gen := \
-  $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
-ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
-  _is-dist-target = $(filter-out %clean, \
-$(filter dist% alpha beta major,$(MAKECMDGOALS)))
-  ifneq (,$(_is-dist-target))
-_curr-ver := $(shell cd $(srcdir) && ./$(_build-aux)/git-version-gen \
-   $(srcdir)/.tarball-version)
-ifneq ($(_curr-ver),$(VERSION))
-  $(info INFO: running autoreconf for new version string: $(_curr-ver))
-  _dummy := $(shell cd $(srcdir) && rm -rf autom4te.cache && 
$(_autoreconf)))
-endif
-  endif
-endif
-
-else
-
-.DEFAULT_GOAL := abort-due-to-no-makefile
-
-# The package can override .DEFAULT_GOAL to run actions like autoreconf.
--include ./cfg.mk
-include ./maint.mk
-
-a

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

2008-03-24 Thread Elbert Pol

Hello all,

I wonder why on this question is a verry quick response, and i posted 2 
times a same sort of question and i got no response at all...


Is this because i use os/2 ?

checking for getspnam... no
checking for library containing crypt... none required
configure: error: internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, 
arch hostn

ame su,
   does not match the list of default-not-installed 
programs

) also recorded in ./src/Makefile.am
#

Hope some one is responding ..



Vincent Lefevre wrote:

When configuring coreutils 6.10 on my Nokia N810 (Linux Maemo/OS2008,
using BusyBox v1.6.1), I get:

[...]
checking for getspnam... yes
checking for library containing crypt... -lcrypt
sed: no previous regexp
configure: error: internal error: g'l_INCLUDE_EXCLUDE_PROG's 2nd arg, ,
   does not match the list of default-not-installed programs
   (arch hostname su) also recorded in ./src/Makefile.am




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


Patch against src/remove.c for correct handling of negative error codes

2008-03-24 Thread Axel Dörfler
Hi,

the enclosed patch changes the following (remove.c against HEAD):

* write_protected_non_symlink() now returns -1 for error (errno will be
set accordingly), 0 for everything fine, and 1 if it's a write
protected file.
* prompt() now deals with the changed semantics of the above function.

It's needed because error codes are expressed with negative values on
some platforms like Haiku, and BeOS; previously, the code incorrectly
assumed error codes would always be positive.

Kind Regards,
   Axel Dörfler.

diff --git a/src/remove.c b/src/remove.c
index 9c6dc9e..61bc935 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -728,9 +728,9 @@ AD_is_removable (Dirstack_state const *ds, char const *file)
   return ! (top->unremovable && hash_lookup (top->unremovable, file));
 }
 
-/* Return -1 if FILE is an unwritable non-symlink,
-   0 if it is writable or some other type of file,
-   a positive error number if there is some problem in determining the answer.
+/* Return 1 if FILE is an unwritable non-symlink, 0 if it is writable or some
+   other type of file.
+   Returns -1 and sets errno if there is some problem in determining the 
answer.
Set *BUF to the file status.
This is to avoid calling euidaccess when FILE is a symlink.  */
 static int
@@ -742,7 +742,7 @@ write_protected_non_symlink (int fd_cwd,
   if (can_write_any_file ())
 return 0;
   if (cache_fstatat (fd_cwd, file, buf, AT_SYMLINK_NOFOLLOW) != 0)
-return errno;
+return -1;
   if (S_ISLNK (buf->st_mode))
 return 0;
   /* Here, we know FILE is not a symbolic link.  */
@@ -799,15 +799,18 @@ write_protected_non_symlink (int fd_cwd,
   = obstack_object_size (&ds->dir_stack) + strlen (file);
 
 if (MIN (PATH_MAX, 8192) <= file_name_len)
-  return - euidaccess_stat (buf, W_OK);
+  return ! euidaccess_stat (buf, W_OK);
 if (euidaccess (xfull_filename (ds, file), W_OK) == 0)
   return 0;
 if (errno == EACCES)
-  return -1;
+  {
+   errno = 0;
+   return 1;
+  }
 
 /* Perhaps some other process has removed the file, or perhaps this
is a buggy NFS client.  */
-return errno;
+return -1;
   }
 }
 
@@ -839,15 +842,18 @@ prompt (int fd_cwd, Dirstack_state const *ds, char const 
*filename,
   if (x->interactive == RMI_NEVER)
 return RM_OK;
 
+  errno = 0;
+
   if (!x->ignore_missing_files
   && ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
   && dirent_type != DT_LNK)
 write_protected = write_protected_non_symlink (fd_cwd, filename, ds, sbuf);
 
-  if (write_protected || x->interactive == RMI_ALWAYS)
+  if (write_protected || errno || x->interactive == RMI_ALWAYS)
 {
-  if (write_protected <= 0 && dirent_type == DT_UNKNOWN)
+  if (errno == 0 && dirent_type == DT_UNKNOWN)
{
+ /* Might fail, e.g., for `rm '''.  */
  if (cache_fstatat (fd_cwd, filename, sbuf, AT_SYMLINK_NOFOLLOW) == 0)
{
  if (S_ISLNK (sbuf->st_mode))
@@ -857,14 +863,9 @@ prompt (int fd_cwd, Dirstack_state const *ds, char const 
*filename,
  /* Otherwise it doesn't matter, so leave it DT_UNKNOWN.  */
  *pdirent_type = dirent_type;
}
- else
-   {
- /* This happens, e.g., with `rm '''.  */
- write_protected = errno;
-   }
}
 
-  if (write_protected <= 0)
+  if (errno == 0)
switch (dirent_type)
  {
  case DT_LNK:
@@ -875,15 +876,15 @@ prompt (int fd_cwd, Dirstack_state const *ds, char const 
*filename,
 
  case DT_DIR:
if (!x->recursive)
- write_protected = EISDIR;
+ errno = EISDIR;
break;
  }
 
   char const *quoted_name = quote (full_filename (filename));
 
-  if (0 < write_protected)
+  if (errno != 0)
{
- error (0, write_protected, _("cannot remove %s"), quoted_name);
+ error (0, errno, _("cannot remove %s"), quoted_name);
  return RM_ERROR;
}
 
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils