Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Joel E. Denny wrote:

 Hi Jim.

 On Fri, 26 Jun 2009, Jim Meyering wrote:

 From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Fri, 26 Jun 2009 13:33:59 +0200
 Subject: [PATCH] maint: add a rule to automate the annual 
 copyright-year-update process

 * build-aux/update-copyright: New file.
 * Makefile.am (changelog_etc): Add update-copyright.
 (update-copyright): New rule.

Hi Joel,

 I'd like to use this in Bison.  Would you consider contributing
 build-aux/update-copyright to gnulib so we don't maintain separate copies?

Sure.
First, here's a change to catch the extra cases you noted,
but without concatenating lines.

From 9d87a45b2fb0fcf5239227b71345a507933636c0 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 10:25:24 +0200
Subject: [PATCH] maint: make update-copyright handle more cases

* build-aux/update-copyright: Handle cases in which the final
year number and copyright holder are on separate lines.
Prompted by a report from Joel E. Denny.
Also, do not invoke localtime for each line we process.
---
 build-aux/update-copyright |   26 +++---
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 42579c2..9039b7c 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w -pi
+#!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2009-06-04 08:53'; # UTC
+my $VERSION = '2009-07-29.08:18'; # UTC

 # Copyright (C) 2009 Free Software Foundation
 #
@@ -21,15 +21,19 @@ my $VERSION = '2009-06-04 08:53'; # UTC
 # Written by Jim Meyering

 use strict;
+use warnings;

-my ($sec, $min, $hour, $mday, $month, $this_year) = localtime (time());
-$this_year += 1900;
-
+my $this_year;
 my $holder = 'Free Software Foundation';

-if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
+BEGIN {
+  my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+  $this_year = $year + 1900;
+}
+
+if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
   {
-my ($sep, $last_c_year) = ($1, $2);
+my ($sep, $last_c_year, $rest) = ($1, $2, $3);

 # Handle two-digit year numbers like 98 and 99.
 $last_c_year = 99
@@ -39,15 +43,15 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
   {
 if ($sep eq '-'  $last_c_year + 1 == $this_year)
   {
-s//-$this_year $holder/;
+s//-$this_year$rest/;
   }
 elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
   {
-s// $last_c_year-$this_year $holder/;
+s// $last_c_year-$this_year$rest/;
   }
 else
   {
-s//$sep$last_c_year, $this_year $holder/;
+s//$sep$last_c_year, $this_year$rest/;
   }
   }
   }
@@ -56,7 +60,7 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
 # indent-tabs-mode: nil
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: my $VERSION = '
-# time-stamp-format: %:y-%02m-%02d.%02H
+# time-stamp-format: %:y-%02m-%02d.%02H:%02M
 # time-stamp-time-zone: UTC
 # time-stamp-end: '; # UTC
 # End:
--
1.6.4.rc3.201.gd9d59


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


Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Jim Meyering wrote:

 Joel E. Denny wrote:

 Hi Jim.

 On Fri, 26 Jun 2009, Jim Meyering wrote:

 From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Fri, 26 Jun 2009 13:33:59 +0200
 Subject: [PATCH] maint: add a rule to automate the annual 
 copyright-year-update process

 * build-aux/update-copyright: New file.
 * Makefile.am (changelog_etc): Add update-copyright.
 (update-copyright): New rule.

 Hi Joel,

 I'd like to use this in Bison.  Would you consider contributing
 build-aux/update-copyright to gnulib so we don't maintain separate copies?

 Sure.
 First, here's a change to catch the extra cases you noted,
 but without concatenating lines.

Whoops.
I didn't test well enough.
That worked only for a single file, so I've just pushed this
additional change:

From c91c85647c4dc98ea43b2b368f9be2ecf1855eba Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 10:56:10 +0200
Subject: [PATCH] maint: update-copyright: fix just-introduced bug

* build-aux/update-copyright: ... and revert-for-now the
change that made this script invoke localtime only once.
---
 build-aux/update-copyright |   10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 9039b7c..23d8f38 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2009-07-29.08:18'; # UTC
+my $VERSION = '2009-07-29.08:43'; # UTC

 # Copyright (C) 2009 Free Software Foundation
 #
@@ -23,14 +23,10 @@ my $VERSION = '2009-07-29.08:18'; # UTC
 use strict;
 use warnings;

-my $this_year;
+my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';

-BEGIN {
-  my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
-  $this_year = $year + 1900;
-}
-
 if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
--
1.6.4.rc3.201.gd9d59


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


Re: BTRFS file clone support for cp

2009-07-29 Thread Jim Meyering
Jim Meyering wrote:

 Andreas Schwab wrote:

 Jim Meyering j...@meyering.net writes:

 +#ifdef __linux__
 +# define BTRFS_IOC_CLONE 1074041865

 This is wrong, the actual value is architecture dependent.  You should
 use the _IOW macro instead.

 Good point.  Thanks!
 I've adjusted it.
 Here's the patch I'm considering now:

From 6ae1f09da25f6600f32dc540551a9479dd2e618e Mon Sep 17 00:00:00 2001
 From: Giuseppe Scrivano gscriv...@gnu.org
 Date: Sat, 25 Jul 2009 16:35:27 +0200
 Subject: [PATCH] cp: support btrfs' copy-on-write file clone operation

Giuseppe is going to write a root-only test to exercise this code,
so I've made one final adjustment to his patch (move decl of copied
down to definition) and have pushed this change:

From 45330176690b079ed47ac7c58f29a1b028f97b07 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano gscriv...@gnu.org
Date: Sat, 25 Jul 2009 16:35:27 +0200
Subject: [PATCH] cp: support btrfs' copy-on-write file clone operation

* src/copy.c [HAVE_SYS_IOCTL_H]: Include sys/ioctl.h.
(BTRFS_IOCTL_MAGIC, BTRFS_IOC_CLONE): Define.
(clone_file): New function.
(copy_reg): Use the btrfs clone operation if possible.
---
 src/copy.c |   28 
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 4c8c432..bbed336 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -61,6 +61,10 @@
 # include verror.h
 #endif

+#if HAVE_SYS_IOCTL_H
+# include sys/ioctl.h
+#endif
+
 #ifndef HAVE_FCHOWN
 # define HAVE_FCHOWN false
 # define fchown(fd, uid, gid) (-1)
@@ -114,6 +118,23 @@ static bool owner_failure_ok (struct cp_options const *x);
 static char const *top_level_src_name;
 static char const *top_level_dst_name;

+/* Perform the O(1) btrfs clone operation, if possible.
+   Upon success, return 0.  Otherwise, return -1 and set errno.  */
+static inline int
+clone_file (int dest_fd, int src_fd)
+{
+#ifdef __linux__
+# undef BTRFS_IOCTL_MAGIC
+# define BTRFS_IOCTL_MAGIC 0x94
+# undef BTRFS_IOC_CLONE
+# define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
+  return ioctl (dest_fd, BTRFS_IOC_CLONE, src_fd);
+#else
+  errno = ENOTSUP;
+  return -1;
+#endif
+}
+
 /* FIXME: describe */
 /* FIXME: rewrite this to use a hash table so we avoid the quadratic
performance hit that's probably noticeable only on trees deeper
@@ -589,6 +610,13 @@ copy_reg (char const *src_name, char const *dst_name,
   goto close_src_and_dst_desc;
 }

+  /* If --sparse=auto is in effect, attempt a btrfs clone operation.
+ If the operation is not supported or it fails then copy the file
+ in the usual way.  */
+  bool copied = (x-sparse_mode == SPARSE_AUTO
+  clone_file (dest_desc, source_desc) == 0);
+
+  if (!copied)
   {
 typedef uintptr_t word;
 off_t n_read_total = 0;
--
1.6.4.rc3.201.gd9d59


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


Re: BTRFS file clone support for cp

2009-07-29 Thread Jim Meyering
Jim Meyering wrote:

 Jim Meyering wrote:

 Andreas Schwab wrote:

 Jim Meyering j...@meyering.net writes:

 +#ifdef __linux__
 +# define BTRFS_IOC_CLONE 1074041865

 This is wrong, the actual value is architecture dependent.  You should
 use the _IOW macro instead.

 Good point.  Thanks!
 I've adjusted it.
 Here's the patch I'm considering now:

From 6ae1f09da25f6600f32dc540551a9479dd2e618e Mon Sep 17 00:00:00 2001
 From: Giuseppe Scrivano gscriv...@gnu.org
 Date: Sat, 25 Jul 2009 16:35:27 +0200
 Subject: [PATCH] cp: support btrfs' copy-on-write file clone operation

 Giuseppe is going to write a root-only test to exercise this code,
 so I've made one final adjustment to his patch (move decl of copied
 down to definition) and have pushed this change:

Now that I've pushed that, I realize it deserves a NEWS entry:

From 722d75b6091dd55b9254e7a49727ebe2f97d00a7 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 12:25:33 +0200
Subject: [PATCH] maint: update NEWS

* NEWS (New features): Mention it.
---
 NEWS |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index e476f2b..80c60e2 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,9 @@ GNU coreutils NEWS-*- 
outline -*-

   chroot now accepts the options --userspec and --groups.

+  cp, install, mv: take advantage of btrfs' O(1) copy-on-write feature
+  when both the source and destination are on the same btrfs partition.
+
   sort accepts a new option, --human-numeric-sort (-h): sort numbers
   while honoring human readable suffixes like KiB and MB etc.

--
1.6.4.rc3.201.gd9d59


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


Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:

  I'd like to use this in Bison.  Would you consider contributing
  build-aux/update-copyright to gnulib so we don't maintain separate copies?
 
 Sure.

Thanks.  I'll watch for that.  In the meantime, I'll probably import a 
copy into Bison.

 First, here's a change to catch the extra cases you noted,
 but without concatenating lines.

 diff --git a/build-aux/update-copyright b/build-aux/update-copyright
 index 42579c2..9039b7c 100755
 --- a/build-aux/update-copyright
 +++ b/build-aux/update-copyright
 @@ -1,7 +1,7 @@
 -#!/usr/bin/perl -w -pi
 +#!/usr/bin/perl -0777 -pi

You're still missing copyrights containing newline followed by a comment 
sequence.  For example, m4/lib-check.m4.


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


Re: BTRFS file clone support for cp

2009-07-29 Thread Pádraig Brady
Chris Mason wrote:
 On Tue, Jul 28, 2009 at 10:06:35PM +0200, Giuseppe Scrivano wrote:

 I can't replicate it now, all tests I am doing report that blocks used
 before and after the clone are the same.  Probably yesterday the
 difference I noticed was in reality the original file flushed to the
 disk.
 
 The clone will use some additional space for the metadata required to
 point to the cloned blocks.  It isn't exactly O(1) it is O(metadata for
 the file).

Thanks for the clarification Chris.
So the just committed change in cp will
link the destination file to the extents of the source.

We may need to play around with fallocate()
if we want to get back to the original
cp semantics of actually allocating space
on the file system for the new file.

I'll test this when I get an up to date btrfs
and when the fallocate interface in glibc settles down.

cheers,
Pádraig.


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


new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Joel E. Denny wrote:

 On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:

  I'd like to use this in Bison.  Would you consider contributing
  build-aux/update-copyright to gnulib so we don't maintain separate copies?

 Sure.

 Thanks.  I'll watch for that.  In the meantime, I'll probably import a
 copy into Bison.

I've just pushed it to gnulib:

From 8dc0e5d63e272095754e3144e64dc6b1c8791d9e Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 16:22:21 +0200
Subject: [PATCH] update-copyright: new module

* modules/update-copyright: New file.
* build-aux/update-copyright: New file.
* MODULES.html.sh (maint+release support): Add update-copyright.
---
 ChangeLog  |7 +
 MODULES.html.sh|1 +
 build-aux/update-copyright |   62 
 modules/update-copyright   |   19 +
 4 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100755 build-aux/update-copyright
 create mode 100644 modules/update-copyright

diff --git a/ChangeLog b/ChangeLog
index fa9a76b..2be276a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-29  Jim Meyering  meyer...@redhat.com
+
+   update-copyright: new module
+   * modules/update-copyright: New file.
+   * build-aux/update-copyright: New file.
+   * MODULES.html.sh (maint+release support): Add update-copyright.
+
 2009-07-27  Bruno Haible  br...@clisp.org

Fix compilation error when ctime is used and mktime is replaced.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 6adef20..ef48ec5 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -3179,6 +3179,7 @@ func_all_modules ()
   func_module gnupload
   func_module maintainer-makefile
   func_module mktempd
+  func_module update-copyright
   func_module useless-if-before-free
   func_module vc-list-files
   func_end_table
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
new file mode 100755
index 000..1ceaf8a
--- /dev/null
+++ b/build-aux/update-copyright
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -0777 -pi
+# Update an FSF copyright year list to include the current year.
+
+my $VERSION = '2009-07-29.13:34'; # UTC
+
+# Copyright (C) 2009 Free Software Foundation
+#
+# 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, 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 http://www.gnu.org/licenses/.
+
+# Written by Jim Meyering
+
+use strict;
+use warnings;
+
+my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+my $this_year = $year + 1900;
+my $holder = 'Free Software Foundation';
+
+if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+  {
+my ($sep, $last_c_year, $rest) = ($1, $2, $3);
+
+# Handle two-digit year numbers like 98 and 99.
+$last_c_year = 99
+  and $last_c_year += 1900;
+
+if ($last_c_year != $this_year)
+  {
+if ($sep eq '-'  $last_c_year + 1 == $this_year)
+  {
+s//-$this_year$rest/;
+  }
+elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
+  {
+s// $last_c_year-$this_year$rest/;
+  }
+else
+  {
+s//$sep$last_c_year, $this_year$rest/;
+  }
+  }
+  }
+
+# Local variables:
+# indent-tabs-mode: nil
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: my $VERSION = '
+# time-stamp-format: %:y-%02m-%02d.%02H:%02M
+# time-stamp-time-zone: UTC
+# time-stamp-end: '; # UTC
+# End:
diff --git a/modules/update-copyright b/modules/update-copyright
new file mode 100644
index 000..c703c68
--- /dev/null
+++ b/modules/update-copyright
@@ -0,0 +1,19 @@
+Description:
+Update an FSF copyright year list to include the current year.
+
+Files:
+build-aux/update-copyright
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+GPLed build tool
+
+Maintainer:
+Jim Meyering
--
1.6.4.rc3.201.gd9d59


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


Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

  You're still missing copyrights containing newline followed by a comment
  sequence.  For example, m4/lib-check.m4.
 
 You're right.  Thanks.
 This new version catches those, too.
 It doesn't allow trailing blanks between the final number
 and \n#, but that's not a possibility here.

 @@ -27,7 +27,7 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
 (time());
  my $this_year = $year + 1900;
  my $holder = 'Free Software Foundation';
 
 -if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
 +if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
{
  my ($sep, $last_c_year, $rest) = ($1, $2, $3);

This isn't general enough: (1) # is not the only comment style, and (2) 
newlines plus comments could occur within $holder.  The following patch 
against coreutils implements a more general approach and fixes one 
coreutils file from case #1.  I haven't tested it very well yet, so I've 
added a diagnostic to help us catch files it can't parse.

Now that the comment style is extracted, it should be possible to extend 
this further to automatically format the added text.  I might work on that 
some other time.

From ed7de5b95ddc6888592dbe8f38f77b2a6fd83bc9 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Wed, 29 Jul 2009 09:59:34 -0400
Subject: [PATCH] maint: generalize update-copyright's comment handling some

* build-aux/update-copyright: Handle copyright statements within some
comment styles, and document limitations.
Report any file with an external copyright holder or parse failure.
* m4/check-decl.m4: Update copyright.

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 1ceaf8a..aedad96 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2009-07-29.13:34'; # UTC
+my $VERSION = '2009-07-29.08:43'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -27,7 +27,40 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';
 
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+# In the copyright statement, Copyright (C) must appear at the
+# beginning of the line except for any comment sequence of no more than
+# 5 characters.  Iff that comment sequence is present, the same comment
+# sequence should appear at the beginning of every line within the
+# copyright statement so that it can be parsed and wrapped correctly.
+#
+# For example, these are fine:
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.
+#*/
+#
+# This will not be parsed correctly:
+#
+#   /* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.  */
+#
+# A warning is printed for any file for which the last copyright year
+# cannot be discovered.  The culprit may be simply that the copyright
+# holder is not the expected one, or it may be that the above
+# preconditions are not obeyed.
+
+my $comment = ;
+if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
+  $comment = quotemeta($1);
+}
+$holder =  $holder;
+$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+
+if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
 
@@ -51,6 +84,11 @@ if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
   }
   }
   }
+else
+  {
+print STDERR
+  $ARGV: warning: external copyright holder or parse failure\n;
+  }
 
 # Local variables:
 # indent-tabs-mode: nil
diff --git a/m4/check-decl.m4 b/m4/check-decl.m4
index e2d20f3..028b855 100644
--- a/m4/check-decl.m4
+++ b/m4/check-decl.m4
@@ -1,7 +1,7 @@
 #serial 24
 # Check declarations for this package.
 
-dnl Copyright (C) 1997-2001, 2003-2006, 2008
+dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009
 dnl Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
-- 
1.5.4.3



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


[PATCH] maint: move update-copyright to gnulib

2009-07-29 Thread Jim Meyering
FYI, I've just pushed this:

From 5ef9069576230e11b123fffb52012c5b0e9c5f33 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 16:29:21 +0200
Subject: [PATCH] maint: move update-copyright to gnulib

* build-aux/update-copyright: Remove file.
* bootstrap.conf (gnulib_modules): Add update-copyright.
* gnulib: Update submodule to latest.
---
 bootstrap.conf |1 +
 build-aux/update-copyright |   62 
 gnulib |2 +-
 3 files changed, 2 insertions(+), 63 deletions(-)
 delete mode 100755 build-aux/update-copyright

diff --git a/bootstrap.conf b/bootstrap.conf
index 6671027..b6623f6 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -210,6 +210,7 @@ gnulib_modules=
   unlink-busy
   unlinkdir
   unlocked-io
+  update-copyright
   uptime
   useless-if-before-free
   userspec
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
deleted file mode 100755
index 1ceaf8a..000
--- a/build-aux/update-copyright
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl -0777 -pi
-# Update an FSF copyright year list to include the current year.
-
-my $VERSION = '2009-07-29.13:34'; # UTC
-
-# Copyright (C) 2009 Free Software Foundation
-#
-# 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, 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 http://www.gnu.org/licenses/.
-
-# Written by Jim Meyering
-
-use strict;
-use warnings;
-
-my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
-my $this_year = $year + 1900;
-my $holder = 'Free Software Foundation';
-
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
-  {
-my ($sep, $last_c_year, $rest) = ($1, $2, $3);
-
-# Handle two-digit year numbers like 98 and 99.
-$last_c_year = 99
-  and $last_c_year += 1900;
-
-if ($last_c_year != $this_year)
-  {
-if ($sep eq '-'  $last_c_year + 1 == $this_year)
-  {
-s//-$this_year$rest/;
-  }
-elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
-  {
-s// $last_c_year-$this_year$rest/;
-  }
-else
-  {
-s//$sep$last_c_year, $this_year$rest/;
-  }
-  }
-  }
-
-# Local variables:
-# indent-tabs-mode: nil
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: my $VERSION = '
-# time-stamp-format: %:y-%02m-%02d.%02H:%02M
-# time-stamp-time-zone: UTC
-# time-stamp-end: '; # UTC
-# End:
diff --git a/gnulib b/gnulib
index 7c385af..29a35cf 16
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 7c385af22c99df5eceda1e82d7aa595e6d5cb796
+Subproject commit 29a35cf5baff3fa063a995e91c28986859ad865f
--
1.6.4.rc3.201.gd9d59


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


Re: BTRFS file clone support for cp

2009-07-29 Thread Pádraig Brady
Chris Mason wrote:
 On Wed, Jul 29, 2009 at 03:14:49PM +0100, Pádraig Brady wrote:

 We may need to play around with fallocate()
 if we want to get back to the original
 cp semantics of actually allocating space
 on the file system for the new file.
 
 Well, best to just use the original cp code.  I was talking with
 Giuseppe about this as well, I think we should the option to do regular
 cp via a flag.

Right. Well we can turn off this cloning by doing --sparse={never,always}
but that has side effects. If we need an option then maybe we should have
it turn on cloning rather than restore default cp behaviour?
The side effects I thought of earlier, of COW without corresponding allocation
were possible fragmentation on write or unexpected/mishandled ENOSPC.
Also for endangered mechanical disks, subsequent processing could
be slowed as the head seeks between the old and new data to be copied.
Perhaps these are a small price to pay, especially considering that
solid state disks will only be affected by the write()=ENOSPC issue.

At the moment we have these linking options:

cp -l, --link #for hardlinks
cp -s, --symbolic-link #for symlinks

So perhaps we should support:

cp --link={soft,hard,cow}
for symlink(), link() and reflink() respectively?
I.E. link to the name, inode or extents respectively.

 There will soon be a reflink system call that can be used on ocfs2 and
 btrfs as well.  Thanks for adding this to glibc!

I was thinking there would be a generic syscall for this.
So cp should call reflink() instead when it becomes available.

thanks for the info!
Pádraig.


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


Porting GNU Projects - Coreutils

2009-07-29 Thread bornlibra23

Hello People
I am trying to port various GNU products to Stratus OpenVOS platform
including the GCC compiler collection. However I am stuck currently for the
lack of wide  multibyte character support. Can somebody guide me to an
implementation of the same that I can port first. The glibc is also proving
a monster to port for various reasons. I have tried to build the wide
character support of glibc separately but it didnt workout. Can somebody
isolate the code  guide me in implementing it on VOS? This is proving to be
a major blocker. Please help
Thanks
bornlibra23

checking for BEOS mounted file system support functions... no
checking whether it is possible to resort to fread on /etc/mnttab... no
configure: error: could not determine how to read list of mounted file
systems
bash-2.05$
-- 
View this message in context: 
http://www.nabble.com/Porting-GNU-Projects---Coreutils-tp24721478p24721478.html
Sent from the Gnu - Coreutils - Discuss mailing list archive at Nabble.com.



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


Re: BTRFS file clone support for cp

2009-07-29 Thread Chris Mason
On Tue, Jul 28, 2009 at 10:06:35PM +0200, Giuseppe Scrivano wrote:
 Hi Pádraig,
 
 
 Pádraig Brady p...@draigbrady.com writes:
 
  How different exactly?
  OK I tried this myself on F11 with inconclusive results.
 
 I can't replicate it now, all tests I am doing report that blocks used
 before and after the clone are the same.  Probably yesterday the
 difference I noticed was in reality the original file flushed to the
 disk.

The clone will use some additional space for the metadata required to
point to the cloned blocks.  It isn't exactly O(1) it is O(metadata for
the file).

 
 
  The above suggests that the clone does actually allocate space
  but btrfs isn't reporting it through statvfs correctly?
 
 The same message appeared here too some days ago, though I cloned only
 few Kb files, not much to fill the entire partition.
 
 
  If the clone does allocate space, then how can one
  clone without allocation which could be very useful
  for snapshotting for example?
 
 I don't know if snapshotting is handled in the same way as a clone,
 but in this case it seems more obvious to me that no additional space
 should be reported.

The COW for snapshotting and a clone are the same, but the way we get
there is a little different.  For a snapshot, we have two btree roots
pointing to the same nodes, and we've incremented the reference count on
each of the nodes they both point to.  No matter how big the subvolume
is, this will always be O(number of pointers in the root block).

Cloning a file is done by walking the file metadata and taking a
reference on each extent pointed to by the file.  The file data is never
read in, but all of the file metadata is read in.

 
 
  Also I tried the above twice and both times got:
  http://www.kerneloops.org/submitresult.php?number=578993
 
 I didn't get these errors.  I am using the btrfs git version.

These have been fixed.

-chris



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


Re: BTRFS file clone support for cp

2009-07-29 Thread Chris Mason
On Wed, Jul 29, 2009 at 03:14:49PM +0100, Pádraig Brady wrote:
 Chris Mason wrote:
  On Tue, Jul 28, 2009 at 10:06:35PM +0200, Giuseppe Scrivano wrote:
 
  I can't replicate it now, all tests I am doing report that blocks used
  before and after the clone are the same.  Probably yesterday the
  difference I noticed was in reality the original file flushed to the
  disk.
  
  The clone will use some additional space for the metadata required to
  point to the cloned blocks.  It isn't exactly O(1) it is O(metadata for
  the file).
 
 Thanks for the clarification Chris.
 So the just committed change in cp will
 link the destination file to the extents of the source.
 
 We may need to play around with fallocate()
 if we want to get back to the original
 cp semantics of actually allocating space
 on the file system for the new file.

Well, best to just use the original cp code.  I was talking with
Giuseppe about this as well, I think we should the option to do regular
cp via a flag.

There will soon be a reflink system call that can be used on ocfs2 and
btrfs as well.  Thanks for adding this to glibc!

-chris


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


Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:
 
  On Wed, 29 Jul 2009, Jim Meyering wrote:
 
  Joel E. Denny wrote:
 
   I'd like to use this in Bison.  Would you consider contributing
   build-aux/update-copyright to gnulib so we don't maintain separate 
   copies?
 
  Sure.
 
  Thanks.  I'll watch for that.  In the meantime, I'll probably import a
  copy into Bison.
 
 I've just pushed it to gnulib:

Thanks.  I didn't notice this before I posted that last patch to 
bug-coreutils:

  http://lists.gnu.org/archive/html/bug-coreutils/2009-07/msg00213.html

Here it is again, rewritten for gnulib.  I've also made some improvements 
to the documentation.

From 009b660dd28dfbb2b289b367d243d08d7ef01588 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Wed, 29 Jul 2009 15:17:53 -0400
Subject: [PATCH] update-copyright: generalize comment handling

* build-aux/update-copyright: Handle copyright statements
within more comment styles.
Document usage.
Report any file with an external copyright holder or parse failure.
---
 ChangeLog  |8 ++
 build-aux/update-copyright |   56 ++-
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9c386f5..5f1c812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-29  Joel E. Denny  jde...@clemson.edu
+
+   update-copyright: generalize comment handling
+   * build-aux/update-copyright: Handle copyright statements
+   within more comment styles.
+   Document usage.
+   Report any file with an external copyright holder or parse failure.
+
 2009-07-29  Jim Meyering  meyer...@redhat.com
 
mktime: correct setting of REPLACE_MKTIME
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 1ceaf8a..c4419b5 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.
 
-my $VERSION = '2009-07-29.13:34'; # UTC
+my $VERSION = '2009-07-29.19:13'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -20,6 +20,46 @@ my $VERSION = '2009-07-29.13:34'; # UTC
 
 # Written by Jim Meyering
 
+# In the copyright statement in each file, Copyright (C) must appear
+# at the beginning of the line except that it may be preceded by any
+# comment sequence of no more than 5 characters.  Iff that comment
+# sequence is present, the same comment sequence should appear at the
+# beginning of each remaining line within the copyright statement so
+# that it can be parsed correctly.
+#
+# For example, these are fine:
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.
+#*/
+#
+# The following format is not recognized:
+#
+#   /* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.  */
+#
+# A warning is printed for every file for which the copyright format is
+# not recognized.  The culprit may be that the above preconditions are
+# not obeyed as in the previous example, or it may simply be that the
+# stated copyright holder is not the Free Software Foundation.
+#
+# You may wish to place a target like the following in your top-level
+# makefile in your project:
+#
+#   .PHONY: update-copyright
+#   update-copyright:
+#  if test -d .git; then   \
+#git grep -l -w Copyright  \
+#  | grep -v -E '(^|/)(COPYING|ChangeLog)' \
+#  | xargs $(srcdir)/build-aux/$@; \
+#  fi
+#
+# You can build a list of files to skip in the second grep.
+
 use strict;
 use warnings;
 
@@ -27,7 +67,14 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';
 
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+my $comment = ;
+if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
+  $comment = quotemeta($1);
+}
+$holder =  $holder;
+$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+
+if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
 
@@ -51,6 +98,11 @@ if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
   }
   }
   }
+else
+  {
+print STDERR
+  $ARGV: warning: external copyright holder or parse failure\n;
+  }
 
 # Local variables:
 # indent-tabs-mode: nil
-- 
1.5.4.3



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


Re: BTRFS file clone support for cp

2009-07-29 Thread Pádraig Brady
Giuseppe Scrivano wrote:
 Hi,
 
 I cleaned a bit the Pádraig's example in a new test case.

tests, great!
comments below.

 The second patch fixes a problem that I introduced with the commit
 e81c4d88c2fce526c02693d539e22c7468dc452b.

I would have posted that patch in the other tail thread.
On momentary review it seems fine.


 diff --git a/tests/cp/file-clone b/tests/cp/file-clone

 +require_root_
 +require_sparse_support_

We probably want expensive_ for the moment
since we're moving 500M of data around

 +
 +fail=0
 +
 +mkfs.btrfs --version || skip_test_ btrfs userland tools not installed

Here, I'd add the comment:

# 300MB seems to be the minimum size for a btrfs with default parameters.
# FIXME: use `truncate --allocate` when it becomes available, which
# may allow unmarking this as an expensive test.

 +dd bs=1M count=300 if=/dev/zero of=btrfs.img  || framework_failure

Perhaps we could shrink everything by tweaking some
of the parameters to mkfs.btrfs ?

 +
 +mkfs.btrfs btrfs.img  || framework_failure
 +
 +mkdir btrfs || framework_failure
 +
 +mount -t btrfs -o loop btrfs.img btrfs || framework_failure
 +
 +dd bs=1M count=200 if=/dev/zero of=btrfs/alloc.test || (umount btrfs;
 +   framework_failure)

No need for a subshell above. The following is better I think:

dd bs=1M count=200 if=/dev/zero of=btrfs/alloc.test ||
  { umount btrfs; framework_failure; }

 +# If the file is cloned, only additional space for metadata is required.
 +# Two 200Mb files can be present even if the total file system space is 
 300Mb.

I usually use big B for Bytes and little b for bits.

cheers,
Pádraig.


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


Re: BTRFS file clone support for cp

2009-07-29 Thread Joel Becker
On Wed, Jul 29, 2009 at 07:14:37PM +0100, Pádraig Brady wrote:
 Chris Mason wrote:
  On Wed, Jul 29, 2009 at 03:14:49PM +0100, Pádraig Brady wrote:
 
  We may need to play around with fallocate()
  if we want to get back to the original
  cp semantics of actually allocating space
  on the file system for the new file.
 
  Well, best to just use the original cp code.  I was talking with
  Giuseppe about this as well, I think we should the option to do regular
  cp via a flag.
 
 Right. Well we can turn off this cloning by doing --sparse={never,always}
 but that has side effects. If we need an option then maybe we should have
 it turn on cloning rather than restore default cp behaviour?
 The side effects I thought of earlier, of COW without corresponding allocation
 were possible fragmentation on write or unexpected/mishandled ENOSPC.
 Also for endangered mechanical disks, subsequent processing could
 be slowed as the head seeks between the old and new data to be copied.
 Perhaps these are a small price to pay, especially considering that
 solid state disks will only be affected by the write()=ENOSPC issue.
 
 At the moment we have these linking options:
 
 cp -l, --link #for hardlinks
 cp -s, --symbolic-link #for symlinks
 
 So perhaps we should support:
 
 cp --link={soft,hard,cow}
 for symlink(), link() and reflink() respectively?
 I.E. link to the name, inode or extents respectively.

I've cooked up 'ln -r' for reflinks, which works for ln(1) but
not for cp(1).  I have a git tree with the (in-flux) code on
oss.oracle.com:

[View]
http://oss.oracle.com/git/?p=jlbec/reflink.git;a=summary
[Pull]
git://oss.oracle.com/git/jlbec/reflink.git master

This repository isn't designed to be an authorative patch for
coreutils.  Instead it provides a reflink(1) program that is actually ln
-r in disguise.  Later work would be to get coreutils updated
properly.

Joel

-- 

This is the end, beautiful friend.
 This is the end, my only friend the end
 Of our elaborate plans, the end
 Of everything that stands, the end
 No safety or surprise, the end
 I'll never look into your eyes again.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.bec...@oracle.com
Phone: (650) 506-8127


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