Re: date --date "4:59:54 1 hour 53 min 46 sec ago"

2009-01-29 Thread Ondřej Vašík
Eric Blake wrote: 
> Bauke Jan Douma  xs4all.nl> writes:
> 
> > >   ~ $ date --date "4:59:54 1 hour 53 min 46 sec ago"
> > >   Wed Jan 28 06:52:08 CST 2009
> I've verified that the parse is unchanged between 6.10 and now (7.0+).
> It's got to be one of these gnulib patches:
> git log 30ffdfc..81e61b -- lib/getdate.y

Just as additional info - tried with basic 5.97 (without our patches)
and the different parsing is already there ... so I would say between
5.2.1 and 5.97 (to reduce number of commits to check)

Greetings,
  Ondrej


signature.asc
Description: Toto je digitálně	 podepsaná část	 zprávy
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


misc maint.mk improvements

2009-01-29 Thread Jim Meyering
FYI, I've just pushed these:

>From 60ca9e1599ed5c9a1a06130d915438cbb32ab391 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Thu, 29 Jan 2009 10:44:10 +0100
Subject: [PATCH 1/3] maint: factor syntax-check rules

* maint.mk (_ignore_case): New macro.
(_prohibit_regexp): Use it.
Factor many existing syntax-check rules to use $(_prohibit_regexp).
---
 maint.mk |   40 
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/maint.mk b/maint.mk
index 4b449d8..38724c2 100644
--- a/maint.mk
+++ b/maint.mk
@@ -62,8 +62,6 @@ release_archive_dir ?= ../release
 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
 export LC_ALL = C

-
-
 ## --- ##
 ## Sanity checks.  ##
 ## --- ##
@@ -92,6 +90,10 @@ syntax-check: $(local-check)
 #  exit 1; } || :
 # FIXME: don't allow `#include .strings\.h' anywhere

+# By default, _prohibit_regexp does not ignore case.
+export ignore_case =
+_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
+
 # There are many rules below that prohibit constructs in this package.
 # If the offending construct can be matched with a grep-E-style regexp,
 # use this macro.  The shell variables "re" and "msg" must be defined.
@@ -99,7 +101,7 @@ define _prohibit_regexp
   dummy=; : so we do not need a semicolon before each use  \
   test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
   test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
-  grep -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
+  grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
 { echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
 endef

@@ -175,13 +177,12 @@ sc_error_message_period:
exit 1; } || :

 sc_file_system:
-   @grep -ni 'file''system' $$($(VC_LIST_EXCEPT)) &&   \
- { echo '$(ME): found use of "file''system";'  \
-   'rewrite to use "file system"' 1>&2;\
-   exit 1; } || :
+   @re=file''system ignore_case=1  \
+   msg='found use of "file''system"; spell it "file system"'   \
+ $(_prohibit_regexp)

 # Don't use cpp tests of this symbol.  All code assumes config.h is included.
-sc_no_have_config_h:
+sc_prohibit_have_config_h:
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
  { echo '$(ME): found use of HAVE''_CONFIG_H; remove'  \
1>&2; exit 1; } || :
@@ -278,10 +279,9 @@ sc_prohibit_root_dev_ino_without_use:
  $(_header_without_use)

 sc_obsolete_symbols:
-   @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
-$$($(VC_LIST_EXCEPT)) &&   \
- { echo '$(ME): do not use HAVE''_FCNTL_H or O''_NDELAY'   \
-   1>&2; exit 1; } || :
+   @re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'   \
+   msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
+ $(_prohibit_regexp)

 # FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ

@@ -320,14 +320,14 @@ sc_require_test_exit_idiom:
fi

 sc_the_the:
-   @grep -ni '\' $$($(VC_LIST_EXCEPT)) &&  \
- { echo '$(ME): found use of "the ''the";' 1>&2;   \
-   exit 1; } || :
+   @re='\' \
+   ignore_case=1 msg='found use of "the ''the";'   \
+ $(_prohibit_regexp)

 sc_trailing_blank:
-   @grep -n '[  ]$$' $$($(VC_LIST_EXCEPT)) &&  \
- { echo '$(ME): found trailing blank(s)'   \
-   1>&2; exit 1; } || :
+   @re='[   ]$$'   \
+   ignore_case=1 msg='found trailing blank(s)' \
+ $(_prohibit_regexp)

 # Match lines like the following, but where there is only one space
 # between the options and the description:
@@ -358,8 +358,8 @@ sc_useless_cpp_parens:

 # Require the latest GPL.
 sc_GPL_version:
-   @grep -n 'either ''version [^3]' $$($(VC_LIST_EXCEPT)) &&   \
- { echo '$(ME): GPL vN, N!=3' 1>&2; exit 1; } || :
+   @re='either ''version [^3]' msg='GPL vN, N!=3'  \
+ $(_prohibit_regexp)

 cvs_keywords = \
   Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
--
1.6.1.1.423.gc2891


>From 61a42e37431928b861e69b236b9d6ad04fafbdc3 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Thu, 29 Jan 2009 10:44:25 +0100
Subject: [PATCH 2/3] maint: silence some syntax-check rules

* cfg.mk (sc_strftime_check): Silence the rule.
(sc_tight_scope): Likewise.
* src/Makefile.am (check-AUTHORS): Likewise.
---
 cfg.mk  |6 +++---
 src/Makefile.am |   12 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cfg.mk b/cfg.mk

Re: [PATCH] cp/mv: xattr support

2009-01-29 Thread Jim Meyering
Jim Meyering  wrote:
> Kamil Dudka  wrote:
>> New version of patch is attached.
...
>   copy.c:153: error: unused parameter 'str'
>   make[3]: *** [copy.o] Error 1
>
> I'll fold the following into your patch and test
> a little more tomorrow.
>
> Also ran "make distcheck" and fixed the two failures that provoked:
>   - a spelling nit: s/filesystem/file system/
>   - added the new verror.c to po/POTFILES.in
> I'll fold them in too.

I've pushed the result:

http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=0889381c


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


Re: Question on sort

2009-01-29 Thread Jim Meyering
Glen Lenker  wrote:
> I noticed that 'avoid_trashing_input' only avoids trashing the first
> input file that matchs the output file. Should sort only protect the
> people who shoot themselves in the foot once, but not twice or more?

Hi Glen,

It seems to be testing each input file.
If you have found a way to make it misbehave, please demonstrate.


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


[PATCH, resend] document sort --ignore-case --unique interaction

2009-01-29 Thread jidanni
Signed-off-by: jidanni 
---
No reply last time so resending.

 doc/coreutils.texi |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d8df107..06b259c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3742,6 +3742,10 @@ is a space or a tab, but the @env{LC_CTYPE} locale can 
change this.
 Fold lowercase characters into the equivalent uppercase characters when
 comparing so that, for example, @samp{b} and @samp{B} sort as equal.
 The @env{LC_CTYPE} locale determines character types.
+When used with @option{--unique} those lower case equivalent lines are
+thrown away. (There is currently no way to throw away the upper case
+equivalent instead. (Any @option{--reverse} given would only affect
+the final result, after the throwing away.))
 
 @item -g
 @itemx --general-numeric-sort
-- 
1.6.0.6


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


[PATCH,resend] date doc: warn at -d about LC_TIME

2009-01-29 Thread jidanni
We also warn here about LC_TIME, so the user will know even if he
doesn't look in the @xref{Date input formats}.

Signed-off-by: jidanni 
---
Also no reply last time. Resending.
 doc/coreutils.texi |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d8df107..35d98b2 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -13470,6 +13470,11 @@ format.  It can contain month names, time zones, 
@samp{am} and @samp{pm},
 14:19:13.489392193 +0530"} specifies the instant of time that is
 489,392,193 nanoseconds after February 27, 2004 at 2:19:13 PM in a
 time zone that is 5 hours and 30 minutes east of @acronym{ut...@*
+Note: input currently must be in locale independent format. E.g., the
+LC_TIME=C below is needed to print back the correct date in many locales:
+...@example
+date -d "$(LC_TIME=C date)"
+...@end example
 @xref{Date input formats}.
 
 @item -f @var{datefile}
-- 
1.6.0.6


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


Feature request: gzip/bzip support for split

2009-01-29 Thread Chandrakumar Muthaiah

I would like to propose a feature that allows to gzip/bzip on its way
out during the split and I am also including the patch for the same.

I believe this is going to be really useful when we are dealing with
very large of files. I hope that it will be useful for people out there.

Below is the patch for coreutils 6.9

--- split.c2007-03-18 17:36:43.0 -0400
+++ ../../coreutils-6/src/split.c2009-01-28 22:26:45.0 -0500
@@ -75,6 +76,9 @@
output file is opened. */
 static bool verbose;

+/* gzip/bzip2 the output file. */
+static int zipoutfile = 0;
+
 /* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -82,6 +86,14 @@
   VERBOSE_OPTION = CHAR_MAX + 1
 };

+struct strvars
+{
+const char *val;
+};
+
+static struct strvars const zsuffixes[] = {{""},  {".gz"}, {".bz2"}};
+static struct strvars const zipcmds[]   = {{""},  {"gzip"}, {"bzip2"}};
+
 static struct option const longopts[] =
 {
   {"bytes", required_argument, NULL, 'b'},
@@ -90,6 +102,8 @@
   {"suffix-length", required_argument, NULL, 'a'},
   {"numeric-suffixes", no_argument, NULL, 'd'},
   {"verbose", no_argument, NULL, VERBOSE_OPTION},
+  {"gzip", no_argument, NULL, 'z'},
+  {"bzip2", no_argument, NULL, 'j'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
@@ -122,6 +136,8 @@
   -C, --line-bytes=SIZE   put at most SIZE bytes of lines per output
file\n\
   -d, --numeric-suffixes  use numeric suffixes instead of alphabetic\n\
   -l, --lines=NUMBER  put NUMBER lines per output file\n\
+  -z, --gzip  gzip output files\n\
+  -j, --bzip2 bzip2 output files\n\
 "), DEFAULT_SUFFIX_LENGTH);
   fputs (_("\
   --verbose   print a diagnostic to standard error just\n\
@@ -194,21 +210,136 @@
 }
 }

-/* Write BYTES bytes at BP to an output file.
-   If NEW_FILE_FLAG is true, open the next output file.
-   Otherwise add to the same output file already in use.  */
+/* Opens a new fd based on the file type seletion
+ */

-static void
-cwrite (bool new_file_flag, const char *bp, size_t bytes)
+#define EXIT_FAILURE 1
+#define O_BINARY 0
+
+static int
+fdpopen ( const char *command, const char *mode)
 {
-  if (new_file_flag)
+int parent_end, child_end;
+int pipe_fds[2];
+pid_t child_pid;
+
+int do_read = 0;
+int do_write = 0;
+int do_cloexec = 0;
+
+while (*mode != '\0')
+{
+switch (*mode++)
+{
+case 'r':
+do_read = 1;
+break;
+case 'w':
+do_write = 1;
+break;
+case 'e':
+do_cloexec = 1;
+break;
+default:
+errout:
+errno = EINVAL;
+return -1;
+}
+}
+
+if ((do_read ^ do_write) == 0)
+goto errout;
+
+if (pipe (pipe_fds) < 0)
+return -1;
+
+if (do_read)
+{
+parent_end = pipe_fds[0];
+child_end = pipe_fds[1];
+}
+else
+{
+parent_end = pipe_fds[1];
+child_end = pipe_fds[0];
+}
+child_pid = fork ();
+
+if (child_pid == 0)
 {
+int child_std_end = do_read ? 1 : 0; /* Make this as the
stdin/stdout file descriptor */
+close (parent_end);
+
+if (child_end != child_std_end)
+ {
+ dup2 (child_end, child_std_end);
+close (child_end);
+}
+
+execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+_exit (127);
+}
+
+close (child_end);
+if (child_pid < 0)
+{
+close (parent_end);
+return -1;
+}
+
+if (do_cloexec)
+fcntl (parent_end, F_SETFD, FD_CLOEXEC);
+
+ return parent_end;
+}
+
+static void
+new_fd_pipe()
+{
+const char* zipcmd = zipcmds[zipoutfile].val;
+const char* zsuf   = zsuffixes[zipoutfile].val;
+
+/* 'gzip > /1/2/3/4/5/outputfile.gz' */
+
+  size_t outzlength = strlen (zipcmd);
+  size_t outlength  = strlen (outfile);
+size_t zsuflength = strlen (zsuf);
+size_t tlength= outzlength + outlength + zsuflength + 3;
+
+char* outfilez= xmalloc (tlength + 1);
+char* ptrpos = outfilez;
+
+memcpy (ptrpos, zipcmd, outzlength);
+ptrpos += outzlength;
+memcpy (ptrpos, " > ", 3);
+ptrpos += 3;
+memcpy (ptrpos, outfile, outlength);
+ptrpos += outlength;
+memcpy (ptrpos, zsuf, zsuflength);
+outfile[tlength] = 0;
+
+  if (verbose)
+fprintf (stderr, _("creating file %s\n"), quote (outfilez));
+
+output_desc = fdpopen ( outfilez, "we");
+
+  if (output_desc < 0)
+error (EXIT_FAILURE, errno, "%s", outfilez);
+}
+
+static void
+new_fd_file()
+{
   if (output_desc >= 0 && close (output_desc) < 0)
 error (EXIT_FAILURE, errno, "%s", outfile);

   next_file_name ();
+
+  if(!zipoutfile)
+{
   if (verbose)
 fprintf (stderr, _("crea