Re: [PATCH] split: --chunks option

2010-02-05 Thread Jim Meyering
Pádraig Brady wrote:

> I got a bit of time for the review last night...
>
> This was your last interface change for this:
>
>-b, --bytes=SIZEput SIZE bytes per output file\n\
> +  -b, --bytes=/N  generate N output files\n\
> +  -b, --bytes=K/N print Kth of N chunks of file\n\
>-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\
> +  -l, --lines=/N  generate N eol delineated output files\n\
> +  -l, --lines=K/N print Kth of N eol delineated chunks\n\
> +  -n, --number=N  same as --bytes=/N\n\
> +  -n, --number=K/Nsame as --bytes=K/N\n\
> +  -r, --round-robin=N generate N eol delineated output files using\n\
> +round-robin style distribution.\n\
> +  -r. --round-robin=K/N   print Kth of N eol delineated chunk as -rN would\n\
> +have generated.\n\
> +  -t, --term=CHAR specify CHAR as eol. This will also convert\n\
> +-b to its line delineated equivalent (-C if\n\
> +splitting normally, -l if splitting by\n\
> +chunks). C escape sequences are accepted.\n\
>
> Thinking more about it, I think adding 2 modes of operation to the
> already slightly complicated -bCl options is too confusing.
> Since this is a separate mode of operation; i.e. one would be
> specifying a particular number of files for a different reason
> than a particular size, it would be better as a separate option.
>   So I changed -n to operate as follows. This is more general if
> we want to add new split methods in future, and also compatible with
> the existing BSD -n without needing a redundant option.

I like it.

> -n N   split into N files based on size of input
> -n K/N output K of N to stdout

s/K/Kth/ removes an ambiguity (and two more, below)

> -n l/N split into N files while maintaining lines

s/while maintaining/without splitting/ (and below)

> -n l/K/N   output K of N to stdout while maintaining lines
> -n r/N like `l' but use round robin distribution instead of size
> -n r/K/N   likewise but only output K of N to stdout
>
> Other changes I made in the attached version are:
>
> Removed the -t option as that's separate.
> Removed erroneous 'c' from getopt() parameters.
> Use K/N in code rather than M/N to match user instructions.
> Added suffix len setter/checker based on N so that
>   we fail immediately if the wrong -a is specified, or
>   if -a is not specified we auto set it.
> Flagged 0/N as an error, rather than treating like /N.
> Changed r/K/N to buffer using stdio for much better performance (see below)
> Fixed up the errno on some errors()
> Normalized all "write error" messages so that all of these commands
> output a single translated error message, of the form:
> "split: write error: No space left on device"
>   split -n 1/10 $(which split) >/dev/full
>   stdbuf -o0 split -n 1/10 $(which split) >/dev/full
>   seq 10 | split -n r/1/10 >/dev/full
>   seq 10 | stdbuf -o0 split -n r/1/10 >/dev/full

Nice.

> Re the performance of the round robin implementation;
> using stdio helps a LOT as can be seen with:
> ---
> $ time yes | head -n1000 | ./split-fwrite -n r/1/1 | wc -l
> 1000
>
> real0m1.568s
> user0m1.486s
> sys 0m0.072s
>
> $ time yes | head -n1000 | ./split-write -n r/1/1 | wc -l
> 1000
>
> real0m50.988s
> user0m7.548s
> sys 0m43.250s

Indeed.  We don't see a 32-x speed-up (esp. non-algorithmic) very often.

> I still need to look at the round robin implementation when
> outputting to file rather than stdout. I may default to using
> stdio, but give an option to flush each line. I'm testing
> with this currently which is performing badly just doing write()
> ---
> #create fifos
> yes | head -n4 | ../split -n r/4 fifo
> for f in x*; do rm $f && mkfifo $f; done
>
> #consumer
> (for f in x*; do md5sum $f& done) > md5sum.out
>
> #producer
> seq 10 | split -n r/4
> ---
>
> BTW, other modes perform well with write()
> ---
> $ yes | head -n1000 > 10m.txt
> $ time ./split -n l/1/1 <10m.txt | wc -l
> 1000
>
> real0m0.201s
> user0m0.145s
> sys 0m0.043s
>
> $ time ./split -n 1/1 <10m.txt | wc -l
> 1000
>
> real0m0.199s
> user0m0.154s
> sys 0m0.041s
>
> $ time ./split -n 1 <10m.txt
>
> real0m0.088s
> user0m0.000s
> sys 0m0.081s
> ---
>
> Here is stuff I intend TODO before checking in:
>  s/pread()/dd::skip()/ or at least add pread to bootstrap.conf
>  fix info docs for reworked interface
>  try

Re: modify chmod

2010-02-05 Thread jeff.liu


Ubuntu stty

2010-02-05 Thread Tom Lake
I'm using Ubuntu 9.10 (32-bit).
I have an ASR-33 Teletype on ttyS0 which can only output uppercase
characters that I'm trying to use as a serial console.  My getty
specifies -U to allow for uppercase terminals.  stty -F/dev/ttyS0 shows
this:

speed 110 baud; line = 0;
lnext = ; min = 1; time = 0;
-brkint -icrnl ixoff iuclc -imaxbel
olcuc
-icanon -iexten -echo xcase

As you can see, iuclc is clearly in effect but
the conversion from uppercase to lowercase isn't being done.
No commands work, and I had to create a user with an uppercase-only
password just to be able to log in at all.
I tried the following to see what I'm getting from the Teletype:

cp /dev/ttyS0 test

When I terminate the command, the file test has all uppercase in it.
Shouldn't stty have converted the uppercase input to lowercase?

If I set iuclc on tty0 (the normal console) it works as expected and
I can turn on Caps Lock and still execute commands and cp tty0 test
does put lowercase characters in test regardless of the state of Caps
Lock.  Is this a bug in stty?  If so, I'd like to get a fix so I can use
my terminals in a local antique computer museum.

Thank you for your time.

Tom Lake





Re: modify chmod

2010-02-05 Thread jeff.liu


Re: modify chmod

2010-02-05 Thread Eric Blake
According to jeff.liu on 2/5/2010 7:44 AM:
> +++ b/gnulib
> @@ -1 +1 @@
> -Subproject commit 2eb5a8a0ff8348149a9ca985e2ccbfb03bc8de53
> +Subproject commit 4b93a2579fb567b9fbbeb24439770d814dac95cd

Why are you modifying the gnulib submodule?

> 
> +/* Some systems only have , other systems also
> + * have , where the former includes the latter.
> + * So it seems including the former is the best choice. */
> +#include "fs.h"
> +#if HAVE_SYS_VFS_H
> +# include 
> +#else
> +# include 
> +#endif

Hmm.  POSIX standardized , not .  Maybe a better
approach would be to propose a patch to gnulib that guarantees that
 provides everything we need, so that we don't have to ever
worry about  in coreutils.

> 
> +/* Return true if the file resides on NFS filesystem.
> + * limit this optimization to systems that provide statfs. */

This comment formatting is not consistent with other comments in the file.


> +
> +static bool
> +may_have_nfsacl(const char *file)

Missing a space between the function name and the (.  And coreutils
prefers 'char const *' over the synonymous 'const char *'.

> +{
> +# if HAVE_SYS_VFS_H && HAVE_SYS_STATFS_H && HAVE_STRUCT_STATFS_F_TYPE
> + struct statfs buf;
> +
> + /* If statfs fails, assume we can't use the optimization. */
> + if (statfs (file, &buf) < 0)
> + return true;
> +
> + return buf.f_type == S_MAGIC_NFS;
> +#endif
> +
> + return true;

Rather than have #ifdefs inside the function body, this seems like it
would be better to do:

#ifdef ...
function
#else
# define may_have_nfsacl(ignored) true
#else

> +}
> +
> /* Change the mode of FILE.
> Return true if successful. This function is called
> once for every file system object that fts encounters. */
> @@ -257,18 +290,38 @@ process_file (FTS *fts, FTSENT *ent)
> old_mode = file_stats->st_mode;
> new_mode = mode_adjust (old_mode, S_ISDIR (old_mode) != 0, umask_value,
> change, NULL);
> -
> - if (! S_ISLNK (old_mode))
> +
> + /* Do not touch the inode if the new file mode is the same as it was
> before;
> + * This is an optimization for some cases. However, the new behavior
> must be
> + * disabled for filesystems that support NFSv4 ACLs.
> + * The idea suggested by Paul Eggert refer to FreeBSD chmod(1).
> + * it uses pathconf(2)/lpathconf(2) to determine whether this is the case.
> + * but on linux, we lack of them. Instead, calling statfs(2) and
> compare the
> + * f_type we can still do optimization at least its not NFS. */

Again, inconsistent comment formatting.

> + if (file_stats->st_uid != euid && euid != 0)
> + error (0, 0, _("changing permissions of %s: Operation not permitted"),
> + quote (file_full_name));

Indentation in this patch looks wrong; did it get munged?  Also, typically
the "Operation not permitted" is provided for free by passing the
appropriate errno to error(), rather than open-coding it into the error
string.

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

Eric Blake e...@byu.net



signature.asc
Description: OpenPGP digital signature


Re: modify chmod

2010-02-05 Thread jeff.liu
A tiny patch, make chmod do not touch the inode if the new file
permission mode is same as it was before.

>From c7bc43a05e4f021db8047ecd390b4fb75368f558 Mon Sep 17 00:00:00 2001
From: Jeff Liu 
Date: Fri, 5 Feb 2010 20:45:41 +0800
Subject: [PATCH 1/1] Modify chmod v1
do not touch the inode if the new file permission bits is identical to
it was before.

Signed-off-by: Jie Liu 
---
gnulib | 2 +-
src/chmod.c | 75 +++
2 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/gnulib b/gnulib
index 2eb5a8a..4b93a25 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 2eb5a8a0ff8348149a9ca985e2ccbfb03bc8de53
+Subproject commit 4b93a2579fb567b9fbbeb24439770d814dac95cd
diff --git a/src/chmod.c b/src/chmod.c
index 3dab92e..30802d7 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -20,6 +20,7 @@
#include 
#include 
#include 
+#include 

#include "system.h"
#include "dev-ino.h"
@@ -32,6 +33,16 @@
#include "root-dev-ino.h"
#include "xfts.h"

+/* Some systems only have , other systems also
+ * have , where the former includes the latter.
+ * So it seems including the former is the best choice. */
+#include "fs.h"
+#if HAVE_SYS_VFS_H
+# include 
+#else
+# include 
+#endif
+
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "chmod"

@@ -83,6 +94,9 @@ static enum Verbosity verbosity = V_off;
Otherwise NULL. */
static struct dev_ino *root_dev_ino;

+/* The effective user ID of the caller process. */
+static uid_t euid;
+
/* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
@@ -170,6 +184,25 @@ describe_change (const char *file, mode_t mode,
(unsigned long int) (mode & CHMOD_MODE_BITS), &perms[1]);
}

+/* Return true if the file resides on NFS filesystem.
+ * limit this optimization to systems that provide statfs. */
+
+static bool
+may_have_nfsacl(const char *file)
+{
+# if HAVE_SYS_VFS_H && HAVE_SYS_STATFS_H && HAVE_STRUCT_STATFS_F_TYPE
+ struct statfs buf;
+
+ /* If statfs fails, assume we can't use the optimization. */
+ if (statfs (file, &buf) < 0)
+ return true;
+
+ return buf.f_type == S_MAGIC_NFS;
+#endif
+
+ return true;
+}
+
/* Change the mode of FILE.
Return true if successful. This function is called
once for every file system object that fts encounters. */
@@ -257,18 +290,38 @@ process_file (FTS *fts, FTSENT *ent)
old_mode = file_stats->st_mode;
new_mode = mode_adjust (old_mode, S_ISDIR (old_mode) != 0, umask_value,
change, NULL);
-
- if (! S_ISLNK (old_mode))
+
+ /* Do not touch the inode if the new file mode is the same as it was
before;
+ * This is an optimization for some cases. However, the new behavior
must be
+ * disabled for filesystems that support NFSv4 ACLs.
+ * The idea suggested by Paul Eggert refer to FreeBSD chmod(1).
+ * it uses pathconf(2)/lpathconf(2) to determine whether this is the case.
+ * but on linux, we lack of them. Instead, calling statfs(2) and
compare the
+ * f_type we can still do optimization at least its not NFS. */
+
+ if ((old_mode & CHMOD_MODE_BITS) == new_mode &&
+ !may_have_nfsacl (file_full_name))
{
- if (chmodat (fts->fts_cwd_fd, file, new_mode) == 0)
- chmod_succeeded = true;
+ if (file_stats->st_uid != euid && euid != 0)
+ error (0, 0, _("changing permissions of %s: Operation not permitted"),
+ quote (file_full_name));
else
- {
- if (! force_silent)
- error (0, errno, _("changing permissions of %s"),
- quote (file_full_name));
- ok = false;
- }
+ chmod_succeeded = true;
+ }
+ else
+ {
+ if (! S_ISLNK (old_mode))
+ {
+ if (chmodat (fts->fts_cwd_fd, file, new_mode) == 0)
+ chmod_succeeded = true;
+ else
+ {
+ if (! force_silent)
+ error (0, errno, _("changing permissions of %s"),
+ quote (file_full_name));
+ ok = false;
+ }
+ }
}
}

@@ -545,6 +598,8 @@ main (int argc, char **argv)
root_dev_ino = NULL;
}

+ euid = geteuid ();
+
ok = process_files (argv + optind,
FTS_COMFOLLOW | FTS_PHYSICAL | FTS_DEFER_STAT);

-- 
1.5.4.3




Re: modify chmod

2010-02-05 Thread jeff.liu


Re: modify chmod

2010-02-05 Thread jeff.liu
Sorry for the inconvenient, looks my email body was filtered somehow, :-(




Re: modify chmod

2010-02-05 Thread jeff.liu
>From c7bc43a05e4f021db8047ecd390b4fb75368f558 Mon Sep 17 00:00:00 2001
From: Jeff Liu 
Date: Fri, 5 Feb 2010 20:45:41 +0800
Subject: [PATCH 1/1] Modify chmod v1
 do not touch the inode if the new file permission bits is identical to it was before.

Signed-off-by: Jie Liu 
---
 gnulib  |2 +-
 src/chmod.c |   75 +++
 2 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/gnulib b/gnulib
index 2eb5a8a..4b93a25 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 2eb5a8a0ff8348149a9ca985e2ccbfb03bc8de53
+Subproject commit 4b93a2579fb567b9fbbeb24439770d814dac95cd
diff --git a/src/chmod.c b/src/chmod.c
index 3dab92e..30802d7 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "system.h"
 #include "dev-ino.h"
@@ -32,6 +33,16 @@
 #include "root-dev-ino.h"
 #include "xfts.h"
 
+/* Some systems only have , other systems also
+ * have , where the former includes the latter.
+ * So it seems including the former is the best choice.  */
+#include "fs.h"
+#if HAVE_SYS_VFS_H
+#  include 
+#else
+#  include 
+#endif
+
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "chmod"
 
@@ -83,6 +94,9 @@ static enum Verbosity verbosity = V_off;
Otherwise NULL.  */
 static struct dev_ino *root_dev_ino;
 
+/* The effective user ID of the caller process.  */
+static uid_t euid;
+
 /* For long options that have no equivalent short option, use a
non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
 enum
@@ -170,6 +184,25 @@ describe_change (const char *file, mode_t mode,
   (unsigned long int) (mode & CHMOD_MODE_BITS), &perms[1]);
 }
 
+/* Return true if the file resides on NFS filesystem.
+ * limit this optimization to systems that provide statfs.  */
+
+static bool
+may_have_nfsacl(const char *file)
+{
+# if HAVE_SYS_VFS_H && HAVE_SYS_STATFS_H && HAVE_STRUCT_STATFS_F_TYPE
+  struct statfs buf;
+
+  /* If statfs fails, assume we can't use the optimization.  */
+  if (statfs (file, &buf) < 0)
+  return true;
+
+  return buf.f_type == S_MAGIC_NFS;
+#endif
+
+  return true;
+}
+
 /* Change the mode of FILE.
Return true if successful.  This function is called
once for every file system object that fts encounters.  */
@@ -257,18 +290,38 @@ process_file (FTS *fts, FTSENT *ent)
   old_mode = file_stats->st_mode;
   new_mode = mode_adjust (old_mode, S_ISDIR (old_mode) != 0, umask_value,
   change, NULL);
-
-  if (! S_ISLNK (old_mode))
+
+ /* Do not touch the inode if the new file mode is the same as it was before;
+  * This is an optimization for some cases. However, the new behavior must be
+  * disabled for filesystems that support NFSv4 ACLs.
+  * The idea suggested by Paul Eggert refer to FreeBSD chmod(1).
+  * it uses pathconf(2)/lpathconf(2) to determine whether this is the case.
+  * but on linux, we lack of them. Instead, calling statfs(2) and compare the
+  * f_type we can still do optimization at least its not NFS.   */
+
+  if ((old_mode & CHMOD_MODE_BITS) == new_mode &&
+  !may_have_nfsacl (file_full_name))
 {
-  if (chmodat (fts->fts_cwd_fd, file, new_mode) == 0)
-chmod_succeeded = true;
+  if (file_stats->st_uid != euid && euid != 0)
+error (0, 0, _("changing permissions of %s: Operation not permitted"),
+   quote (file_full_name));
   else
-{
-  if (! force_silent)
-error (0, errno, _("changing permissions of %s"),
-   quote (file_full_name));
-  ok = false;
-}
+chmod_succeeded = true;
+}
+  else
+{
+  if (! S_ISLNK (old_mode))
+  {
+if (chmodat (fts->fts_cwd_fd, file, new_mode) == 0)
+  chmod_succeeded = true;
+else
+  {
+if (! force_silent)
+  error (0, errno, _("changing permissions of %s"),
+ quote (file_full_name));
+ok = false;
+  }
+	  }
 }
 }
 
@@ -545,6 +598,8 @@ main (int argc, char **argv)
   root_dev_ino = NULL;
 }
 
+  euid = geteuid ();
+
   ok = process_files (argv + optind,
   FTS_COMFOLLOW | FTS_PHYSICAL | FTS_DEFER_STAT);
 
-- 
1.5.4.3



Re: [PATCH] split: --chunks option

2010-02-05 Thread Pádraig Brady

I got a bit of time for the review last night...

This was your last interface change for this:

   -b, --bytes=SIZEput SIZE bytes per output file\n\
+  -b, --bytes=/N  generate N output files\n\
+  -b, --bytes=K/N print Kth of N chunks of file\n\
   -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\
+  -l, --lines=/N  generate N eol delineated output files\n\
+  -l, --lines=K/N print Kth of N eol delineated chunks\n\
+  -n, --number=N  same as --bytes=/N\n\
+  -n, --number=K/Nsame as --bytes=K/N\n\
+  -r, --round-robin=N generate N eol delineated output files using\n\
+round-robin style distribution.\n\
+  -r. --round-robin=K/N   print Kth of N eol delineated chunk as -rN would\n\
+have generated.\n\
+  -t, --term=CHAR specify CHAR as eol. This will also convert\n\
+-b to its line delineated equivalent (-C if\n\
+splitting normally, -l if splitting by\n\
+chunks). C escape sequences are accepted.\n\

Thinking more about it, I think adding 2 modes of operation to the
already slightly complicated -bCl options is too confusing.
Since this is a separate mode of operation; i.e. one would be
specifying a particular number of files for a different reason
than a particular size, it would be better as a separate option.
  So I changed -n to operate as follows. This is more general if
we want to add new split methods in future, and also compatible with
the existing BSD -n without needing a redundant option.

-n N   split into N files based on size of input
-n K/N output K of N to stdout
-n l/N split into N files while maintaining lines
-n l/K/N   output K of N to stdout while maintaining lines
-n r/N like `l' but use round robin distribution instead of size
-n r/K/N   likewise but only output K of N to stdout

Other changes I made in the attached version are:

Removed the -t option as that's separate.
Removed erroneous 'c' from getopt() parameters.
Use K/N in code rather than M/N to match user instructions.
Added suffix len setter/checker based on N so that
  we fail immediately if the wrong -a is specified, or
  if -a is not specified we auto set it.
Flagged 0/N as an error, rather than treating like /N.
Changed r/K/N to buffer using stdio for much better performance (see below)
Fixed up the errno on some errors()
Normalized all "write error" messages so that all of these commands
output a single translated error message, of the form:
"split: write error: No space left on device"
  split -n 1/10 $(which split) >/dev/full
  stdbuf -o0 split -n 1/10 $(which split) >/dev/full
  seq 10 | split -n r/1/10 >/dev/full
  seq 10 | stdbuf -o0 split -n r/1/10 >/dev/full


Re the performance of the round robin implementation;
using stdio helps a LOT as can be seen with:
---
$ time yes | head -n1000 | ./split-fwrite -n r/1/1 | wc -l
1000

real0m1.568s
user0m1.486s
sys 0m0.072s

$ time yes | head -n1000 | ./split-write -n r/1/1 | wc -l
1000

real0m50.988s
user0m7.548s
sys 0m43.250s
---


I still need to look at the round robin implementation when
outputting to file rather than stdout. I may default to using
stdio, but give an option to flush each line. I'm testing
with this currently which is performing badly just doing write()
---
#create fifos
yes | head -n4 | ../split -n r/4 fifo
for f in x*; do rm $f && mkfifo $f; done

#consumer
(for f in x*; do md5sum $f& done) > md5sum.out

#producer
seq 10 | split -n r/4
---

BTW, other modes perform well with write()
---
$ yes | head -n1000 > 10m.txt
$ time ./split -n l/1/1 <10m.txt | wc -l
1000

real0m0.201s
user0m0.145s
sys 0m0.043s

$ time ./split -n 1/1 <10m.txt | wc -l
1000

real0m0.199s
user0m0.154s
sys 0m0.041s

$ time ./split -n 1 <10m.txt

real0m0.088s
user0m0.000s
sys 0m0.081s
---

Here is stuff I intend TODO before checking in:
 s/pread()/dd::skip()/ or at least add pread to bootstrap.conf
 fix info docs for reworked interface
 try to refactor duplicated code

cheers,
Pádraig.
>From 8a7fe06170ad8bb3050c4b6a43c9e51eb0ec22a7 Mon Sep 17 00:00:00 2001
From: Chen Guo 
Date: Fri, 8 Jan 2010 03:42:27 -0800
Subject: [PATCH] split: add --number to generate a particular number of files

* doc/coreutils.texi: update documentation of split.
* src/split.c (usage, long_options, main): New options --number.
(set_suff

diffutils release imminent

2010-02-05 Thread Jim Meyering
For those not subscribed to the bug-diffutils mailing list,
you may be interested in this snapshot:

  http://thread.gmane.org/gmane.comp.gnu.diffutils.bugs/11

I expect to make a release next week, so any
patches, testing or feedback would be most welcome.




[PATCH] sync with gnulib

2010-02-05 Thread Jim Meyering
This syncs with gnulib for two changes:
newer regcomp.c and avoid a warning in test-gettimeofday.c.
The former required an adjustment to the patch we use in gl/lib:
It lets me removes two chunks.

>From 69cc8d5cb711823fd97992076494a5888c20da10 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Wed, 3 Feb 2010 21:57:24 +0100
Subject: [PATCH] sync with gnulib

* gl/lib/regcomp.c.diff: Update to apply to changed version in gnulib.
* gnulib: Update submodule to latest.
---
 gl/lib/regcomp.c.diff |   39 ++-
 gnulib|2 +-
 2 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/gl/lib/regcomp.c.diff b/gl/lib/regcomp.c.diff
index a31c39f..63fc187 100644
--- a/gl/lib/regcomp.c.diff
+++ b/gl/lib/regcomp.c.diff
@@ -1,17 +1,8 @@
-diff --git c/lib/regcomp.c i/lib/regcomp.c
-index 6472ff6..665b2ab 100644
 c/lib/regcomp.c
-+++ i/lib/regcomp.c
-@@ -18,6 +18,8 @@
-with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-+#include "intprops.h"
-+#include "verify.h"
- static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
- size_t length, reg_syntax_t syntax);
- static void re_compile_fastmap_iter (regex_t *bufp,
-@@ -541,7 +543,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
+diff --git a/lib/regcomp.c b/lib/regcomp.c
+index d5968bd..4926676 100644
+--- a/lib/regcomp.c
 b/lib/regcomp.c
+@@ -541,7 +541,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
  size_t errbuf_size;
  #else /* size_t might promote */
  size_t
@@ -20,7 +11,7 @@ index 6472ff6..665b2ab 100644
  char *_Restrict_ errbuf, size_t errbuf_size)
  #endif
  {
-@@ -1375,7 +1377,7 @@ calc_first (void *extra, bin_tree_t *node)
+@@ -1383,7 +1383,7 @@ calc_first (void *extra, bin_tree_t *node)

  /* Pass 2: compute NEXT on the tree.  Preorder visit.  */
  static reg_errcode_t
@@ -29,17 +20,7 @@ index 6472ff6..665b2ab 100644
  {
switch (node->token.type)
  {
-@@ -2571,7 +2573,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
-   /* This loop is actually executed only when end != REG_MISSING,
-  to rewrite {0,n} as ((...?)?)?...  We have
-  already created the start+1-th copy.  */
--  if ((Idx) -1 < 0 || end != REG_MISSING)
-+  verify (! TYPE_SIGNED (Idx));
-+  if (end != REG_MISSING)
- for (i = start + 2; i <= end; ++i)
-   {
-   elem = duplicate_tree (elem, dfa);
-@@ -2731,7 +2734,8 @@ static reg_errcode_t
+@@ -2744,7 +2744,8 @@ static reg_errcode_t
  internal_function
  build_collating_symbol (bitset_t sbcset,
  # ifdef RE_ENABLE_I18N
@@ -49,7 +30,7 @@ index 6472ff6..665b2ab 100644
  # endif
const unsigned char *name)
  {
-@@ -3309,7 +3313,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,
+@@ -3323,7 +3324,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, 
re_token_t *token,

  static reg_errcode_t
  parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
@@ -59,7 +40,7 @@ index 6472ff6..665b2ab 100644
   reg_syntax_t syntax, bool accept_hyphen)
  {
  #ifdef RE_ENABLE_I18N
-@@ -3396,8 +3401,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t 
*regexp,
+@@ -3410,8 +3412,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t 
*regexp,

  static reg_errcode_t
  #ifdef RE_ENABLE_I18N
@@ -71,7 +52,7 @@ index 6472ff6..665b2ab 100644
  #else /* not RE_ENABLE_I18N */
  build_equiv_class (bitset_t sbcset, const unsigned char *name)
  #endif /* not RE_ENABLE_I18N */
-@@ -3798,7 +3804,7 @@ free_token (re_token_t *node)
+@@ -3816,7 +3819,7 @@ free_token (re_token_t *node)
 and its children. */

  static reg_errcode_t
diff --git a/gnulib b/gnulib
index 2eb5a8a..de4d0a3 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 2eb5a8a0ff8348149a9ca985e2ccbfb03bc8de53
+Subproject commit de4d0a383be20eb6cbeb09ecbd66a5514779b914
--
1.7.0.rc1.204.gb96e




Re: BUG: date 7.1 - reading date string

2010-02-05 Thread Klaus Bramstedt

Dear Sven, Bob, Philip,

thank a lot for your hints! The daylight saving time (DST) is indeed the 
problem, so I have to use the '-u' option of date for proper working of my 
script.
Sorry for bothering, I should have thought myself about this. Maybe an 
additional hint in the error message to the DST problem would help other 
users (like (DST gap))?


thanks again

Klaus


On Thu, 4 Feb 2010, Sven Joachim wrote:

Am 04.02.2010 um 14:45 schrieb Klaus Bramstedt:


I used the command
 date -d "$DATE"
for almost all dates between Aug 2002 end Jan 2010 in a script.
Date has a format like this
   "2003-03-30 02:08:17"
However, 7 of 42048 randomly distributed dates in the list failed:

date: ungültiges Datum „2003-03-30 02:08:17“
date: ungültiges Datum „2003-03-30 02:25:58“
date: ungültiges Datum „2005-03-27 02:08:41“
date: ungültiges Datum „2006-03-26 02:41:44“
date: ungültiges Datum „2008-03-30 02:08:09“
date: ungültiges Datum „2009-03-29 02:09:26“
date: ungültiges Datum „2007-03-25 02:03:47“

For me, this seems to be a bug in the date reading part. The critical
combination seems to be end of March and '02' as hour.


Yes, it's the non-existent hour during DST adjustment on the last Sunday
in March.  These dates are indeed invalid in the German timezone.

Sven