Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] e7c16d9 Update README copyright to 2013, and add test #13233

Closed
p5pRT opened this issue Sep 5, 2013 · 10 comments
Closed

[PATCH] e7c16d9 Update README copyright to 2013, and add test #13233

p5pRT opened this issue Sep 5, 2013 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 5, 2013

Migrated from rt.perl.org#119625 (status was 'resolved')

Searchable as RT119625$

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2013

From @Smylers

This is a bug report for perl from smylers@​stripey.com,
generated with the help of perlbug 1.39 running under perl 5.19.4.

From e7c16d9cd2ac4cb537a3e050a876d6ccf05e01c9 Mon Sep 17 00​:00​:00 2001
From​: Smylers <Smylers@​stripey.com>
Date​: Thu, 5 Sep 2013 14​:57​:35 +0100
Subject​: [PATCH] Update README copyright to 2013, and add test
MIME-Version​: 1.0
Content-Type​: multipart/mixed; boundary="------------1.8.1.2"

This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type​: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding​: 8bit


MANIFEST | 1 +
README | 4 ++--
t/porting/copyright.t | 24 ++++++++++++++++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 t/porting/copyright.t

--------------1.8.1.2
Content-Type​: text/x-patch; name="0001-Update-README-copyright-to-2013-and-add-test.patch"
Content-Transfer-Encoding​: 8bit
Content-Disposition​: attachment; filename="0001-Update-README-copyright-to-2013-and-add-test.patch"

Inline Patch
diff --git a/MANIFEST b/MANIFEST
index ed47bd3..caf6504 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5373,6 +5373,7 @@ t/porting/bincompat.t		Check that {non_,}bincompat_options are ordered
 t/porting/checkcase.t		Check whether we are case-insensitive-fs-friendly
 t/porting/checkcfgvar.t		Check that all config.sh-like files are good
 t/porting/cmp_version.t		Test whether all changed module files have their VERSION bumped
+t/porting/copyright.t		Check that copyright year is up to date
 t/porting/customized.dat		Data file for porting/customized.t
 t/porting/customized.t		Check all CUSTOMIZED files are as they should be
 t/porting/diag.t		Test completeness of perldiag.pod
diff --git a/README b/README
index 2967921..5cf3a9e 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-by Larry Wall and others.  All rights reserved.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 by Larry Wall and others.  All rights reserved.
 
 
 
diff --git a/t/porting/copyright.t b/t/porting/copyright.t
new file mode 100644
index 0000000..48ea7b4
--- /dev/null
+++ b/t/porting/copyright.t
@@ -0,0 +1,24 @@
+#!perl
+
+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file includes the
+current year.
+
+=cut
+
+
+BEGIN { chdir 't'; require './test.pl' }
+
+
+open my $readme, '<', '../README' or die "Opening README failed: $!";
+local $/ = '';
+my $copyright_msg = <$readme>;
+my $year = (gmtime)[5] + 1900;
+like $copyright_msg, qr/\b$year\b/, 'current year in README copyright message';
+
+done_testing;

--------------1.8.1.2--


---
Flags:   category=docs   severity=low

Site configuration information for perl 5.19.4​:

Configured by smylers at Thu Sep 5 14​:42​:23 BST 2013.

Summary of my perl5 (revision 5 version 19 subversion 4) configuration​:
  Derived from​: 4981938
  Platform​:
  osname=linux, osvers=3.8.0-30-generic, archname=x86_64-linux
  uname='linux fozzie 3.8.0-30-generic #44-ubuntu smp thu aug 22 20​:52​:24 utc 2013 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.7.3', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -ldl -lm -lcrypt -lutil -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.17'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches​:
  uncommitted-changes


@​INC for perl 5.19.4​:
  lib
  /home/smylers/lib/perl5/site_perl
  /home/smylers/lib/perl5
  /usr/local/lib/perl5/site_perl/5.19.4/x86_64-linux
  /usr/local/lib/perl5/site_perl/5.19.4
  /usr/local/lib/perl5/5.19.4/x86_64-linux
  /usr/local/lib/perl5/5.19.4
  .


Environment for perl 5.19.4​:
  HOME=/home/smylers
  LANG=en_GB.utf8
  LANGUAGE=en_GB​:en
  LC_COLLATE=C
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/smylers/bin​:/usr/local/sbin​:/usr/local/bin​:/sbin​:/bin​:/usr/sbin​:/usr/bin​:/usr/X11R6/bin​:/usr/games
  PERL5LIB=/home/smylers/lib/perl5/site_perl​:/home/smylers/lib/perl5
  PERL_BADLANG (unset)
  PERL_CPANM_OPT=--sudo --prompt
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2013

From @cpansprout

On Thu Sep 05 07​:00​:10 2013, smylers@​stripey.com wrote​:

diff --git a/t/porting/copyright.t b/t/porting/copyright.t
new file mode 100644
index 0000000..48ea7b4
--- /dev/null
+++ b/t/porting/copyright.t
@​@​ -0,0 +1,24 @​@​
+#!perl
+
+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file includes
the
+current year.
+
+=cut
+
+
+BEGIN { chdir 't'; require './test.pl' }
+
+
+open my $readme, '&lt;', '../README' or die "Opening README failed​: $!";
+local $/ = '';
+my $copyright_msg = <$readme>;
+my $year = (gmtime)[5] + 1900;
+like $copyright_msg, qr/\b$year\b/, 'current year in README copyright
message';
+
+done_testing;

Hmm. If I’m reading this correctly, then when I try to install last
year’s perl then tests will fail.

I would prefer a note in the release manager’s guide.

While you could see whether the tests are being run under a git
repository and see whether there are any commits in the current year
before checking the README, that could *still* produce false positives;
e.g., for downstream packagers. That would be rare; nevertheless, if
the correct thing to do is to ignore test failures under some
circumstance, that suggests there is something wrong with the tests.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 6, 2013

From @Smylers

Father Chrysostomos via RT writes​:

On Thu Sep 05 07​:00​:10 2013, smylers@​stripey.com wrote​:

+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file includes the
+current year.

Hmm. If I’m reading this correctly, then when I try to install last
year’s perl then tests will fail.

Ooops, yes. Sorry for not thinking that through properly.

Attached is a patch which just puts 2013 in README, since that's well
overdue for fixing regardless of whether we do anything to catch this in
future.

I would prefer a note in the release manager’s guide.

While you could see whether the tests are being run under a git
repository and see whether there are any commits in the current year
before checking the README,

Yeah, finding the year of the most recent commit is straightforward​:

  find_git_or_skip 'all';
  my $latest_commit = qx(git log -n 1 --format=format​:%ct);
  my $year = (gmtime $latest_commit)[5] + 1900;

that could *still* produce false positives; e.g., for downstream
packagers.

Ah, yes. Only running the test if the current branch is blead would
presumably avoid that, but would mean that if the first commit of a year
is a merge it could cause a test failure that isn't apparent pre-merge.

Unless anybody can think of a way of detecting this situation, I'll drop
the test and submit a ‘Release Manager's Guide’ patch instead.

That would be rare; nevertheless, if the correct thing to
do is to ignore test failures under some circumstance, that suggests
there is something wrong with the tests.

Indeed. Thanks for your wisdom.

Smylers
--
Stop drug companies hiding negative research results.
Sign the AllTrials petition to get all clinical research results published.
Read more​: http​://www.alltrials.net/blog/the-alltrials-campaign/

@p5pRT
Copy link
Author

p5pRT commented Sep 6, 2013

From @Smylers

0001-Update-README-copyright-to-2013.patch
From 55e8258e2a1f692e4657494a506bac6a805f1977 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 06:02:41 +0100
Subject: [PATCH] Update README copyright to 2013
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"

This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


For RT #119625.
---
 README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--------------1.8.1.2
Content-Type: text/x-patch; name="0001-Update-README-copyright-to-2013.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Update-README-copyright-to-2013.patch"

diff --git a/README b/README
index 2967921..5cf3a9e 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-by Larry Wall and others.  All rights reserved.
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
+2013 by Larry Wall and others.  All rights reserved.
 
 
 

--------------1.8.1.2--


@p5pRT
Copy link
Author

p5pRT commented Sep 6, 2013

From @cpansprout

On Thu Sep 05 22​:25​:57 2013, smylers@​stripey.com wrote​:

Father Chrysostomos via RT writes​:

Hmm. If I’m reading this correctly, then when I try to install last
year’s perl then tests will fail.

Ooops, yes. Sorry for not thinking that through properly.

Attached is a patch which just puts 2013 in README, since that's well
overdue for fixing regardless of whether we do anything to catch this
in
future.

Thank you. Applied as a271a37.

That would be rare; nevertheless, if the correct thing to
do is to ignore test failures under some circumstance, that suggests
there is something wrong with the tests.

Indeed. Thanks for your wisdom.

Or paranoia. :-)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2013

From @Smylers

On Friday I wrote​:

Father Chrysostomos via RT writes​:

On Thu Sep 05 07​:00​:10 2013, smylers@​stripey.com wrote​:

+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file includes the
+current year.

Hmm. If I’m reading this correctly, then when I try to install last
year’s perl then tests will fail.

Ooops, yes. Sorry for not thinking that through properly.

The attached includes a commit with a test which simply checks that the
latest copyright year in README matches that in the output of perl -v.

That at least ensures that if somebody remembers to update one place,
there'll be a test failure about the other. And it would've been good
enough for this year, where d907e2e updated one of them.

I would prefer a note in the release manager’s guide.

Another attached commit does that, with a switch on the above test to
check that both copyright dates match the current year.

Cheers

Smylers
--
Stop drug companies hiding negative research results.
Sign the AllTrials petition to get all clinical research results published.
Read more​: http​://www.alltrials.net/blog/the-alltrials-campaign/

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2013

From @Smylers

copyright_year.patch
From a47e2167e8f994ed7f1af70532d0b8475933d6af Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 10:37:29 +0100
Subject: [PATCH 1/3] Enhance runperl doc to mention its return value
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"

This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 t/test.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--------------1.8.1.2
Content-Type: text/x-patch; name="0001-Enhance-runperl-doc-to-mention-its-return-value.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Enhance-runperl-doc-to-mention-its-return-value.patch"

diff --git a/t/test.pl b/t/test.pl
index cdd72ea..5b1ee18 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -548,7 +548,7 @@ USE_OK
     }
 }
 
-# runperl - Runs a separate perl interpreter.
+# runperl - Runs a separate perl interpreter and returns its output.
 # Arguments :
 #   switches => [ command-line switches ]
 #   nolib    => 1 # don't use -I../lib (included by default)

--------------1.8.1.2--



From 401755d56fea1e3e498f16bcd1dd9c1778b56288 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 11:07:27 +0100
Subject: [PATCH 2/3] Test that README and perl -v copyright years match
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"

This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 MANIFEST              |  1 +
 t/porting/copyright.t | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 t/porting/copyright.t


--------------1.8.1.2
Content-Type: text/x-patch; name="0002-Test-that-README-and-perl-v-copyright-years-match.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-Test-that-README-and-perl-v-copyright-years-match.patch"

diff --git a/MANIFEST b/MANIFEST
index 4679c95..6541f67 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5371,6 +5371,7 @@ t/porting/bincompat.t		Check that {non_,}bincompat_options are ordered
 t/porting/checkcase.t		Check whether we are case-insensitive-fs-friendly
 t/porting/checkcfgvar.t		Check that all config.sh-like files are good
 t/porting/cmp_version.t		Test whether all changed module files have their VERSION bumped
+t/porting/copyright.t		Check that copyright years match
 t/porting/customized.dat		Data file for porting/customized.t
 t/porting/customized.t		Check all CUSTOMIZED files are as they should be
 t/porting/diag.t		Test completeness of perldiag.pod
diff --git a/t/porting/copyright.t b/t/porting/copyright.t
new file mode 100644
index 0000000..e1b7faa
--- /dev/null
+++ b/t/porting/copyright.t
@@ -0,0 +1,56 @@
+#!perl
+
+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the latest copyright years in the top-level README file and the
+C<perl -v> output match each other.
+
+If the test fails, update at least one of README and perl.c so that they match
+reality.
+
+=cut
+
+
+use TestInit;
+use strict;
+BEGIN { require 'test.pl' }
+
+
+my $readme_year = readme_year();
+my $v_year = v_year();
+is $readme_year, $v_year, 'README and perl -v copyright dates match';
+
+done_testing;
+
+
+sub readme_year
+# returns the latest copyright year from the top-level README file
+{
+
+  open my $readme, '<', '../README' or die "Opening README failed: $!";
+
+  # The copyright message is the first paragraph:
+  local $/ = '';
+  my $copyright_msg = <$readme>;
+
+  my ($year) = $copyright_msg =~ /.*\b(\d{4,})/s
+      or die "Year not found in README copyright message '$copyright_msg'";
+
+  $year;
+}
+
+
+sub v_year
+# returns the latest copyright year shown in perl -v
+{
+
+  my $output = runperl switches => ['-v'];
+  my ($year) = $output =~ /copyright 1987.*\b(\d{4,})/i
+      or die "Copyright statement not found in perl -v output '$output'";
+
+  $year;
+}

--------------1.8.1.2--



From 783864de35fbefed26340c6666a57cfab27e62d4 Mon Sep 17 00:00:00 2001
From: Smylers <Smylers@stripey.com>
Date: Fri, 6 Sep 2013 11:56:07 +0100
Subject: [PATCH 3/3] Added release manager test for copyright year
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.1.2"

This is a multi-part message in MIME format.
--------------1.8.1.2
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

---
 Porting/release_managers_guide.pod | 10 ++++++++++
 t/porting/copyright.t              | 22 +++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)


--------------1.8.1.2
Content-Type: text/x-patch; name="0003-Added-release-manager-test-for-copyright-year.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0003-Added-release-manager-test-for-copyright-year.patch"

diff --git a/Porting/release_managers_guide.pod b/Porting/release_managers_guide.pod
index e900f9c..4c7297f 100644
--- a/Porting/release_managers_guide.pod
+++ b/Porting/release_managers_guide.pod
@@ -446,6 +446,16 @@ release, this would be 5.13.11).
 For BLEAD-POINT releases, it needs to refer to the previous BLEAD-POINT
 release (so for 5.15.3 this would be 5.15.2).
 
+=head3 Check copyright years
+
+Check that the copyright years are up to date by running:
+
+ $ ./perl t/porting/copyright.t --now
+
+Remedy any test failures by editing README or perl.c accordingly (search for
+the "Copyright"). If updating perl.c, check if the file's own copyright date in
+the C comment at the top needs updating, as well as the one printed by C<-v>.
+
 =head3 Check more build configurations
 
 Try running the full test suite against multiple Perl configurations. Here are
diff --git a/t/porting/copyright.t b/t/porting/copyright.t
index e1b7faa..c95286d 100644
--- a/t/porting/copyright.t
+++ b/t/porting/copyright.t
@@ -12,6 +12,10 @@ C<perl -v> output match each other.
 If the test fails, update at least one of README and perl.c so that they match
 reality.
 
+Optionally you can pass the C<--now> option to check they are at the current
+year. This isn't checked by default, so that it doesn't fail for people
+working on older releases. It should be run before making a new release.
+
 =cut
 
 
@@ -20,9 +24,25 @@ use strict;
 BEGIN { require 'test.pl' }
 
 
+my ($opt) = @ARGV;
+
 my $readme_year = readme_year();
 my $v_year = v_year();
-is $readme_year, $v_year, 'README and perl -v copyright dates match';
+
+# Check that both copyright dates are up-to-date, but only if requested, so
+# that tests still pass for people intentionally working on older versions:
+if ($opt eq '--now')
+{
+  my $current_year = (gmtime)[5] + 1900;
+  is $v_year, $current_year, 'perl -v copyright includes current year';
+  is $readme_year, $current_year, 'README copyright includes current year';
+}
+
+# Otherwise simply check that the two copyright dates match each other:
+else
+{
+  is $readme_year, $v_year, 'README and perl -v copyright dates match';
+}
 
 done_testing;
 

--------------1.8.1.2--


@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2013

From @cpansprout

On Tue Sep 10 03​:15​:55 2013, smylers@​stripey.com wrote​:

On Friday I wrote​:

Father Chrysostomos via RT writes​:

On Thu Sep 05 07​:00​:10 2013, smylers@​stripey.com wrote​:

+=head1 NAME
+
+copyright.t
+
+=head1 DESCRIPTION
+
+Tests that the copyright notice in the top-level README file
includes the
+current year.

Hmm. If I’m reading this correctly, then when I try to install
last
year’s perl then tests will fail.

Ooops, yes. Sorry for not thinking that through properly.

The attached includes a commit with a test which simply checks that
the
latest copyright year in README matches that in the output of perl -v.

That at least ensures that if somebody remembers to update one place,
there'll be a test failure about the other. And it would've been good
enough for this year, where d907e2e updated one of them.

I would prefer a note in the release manager’s guide.

Another attached commit does that, with a switch on the above test to
check that both copyright dates match the current year.

Thank you. Applied​:

$ git log --reverse -3 --oneline
9ff0b39 Enhance runperl doc to mention its return value
acc70a0 Test that README and perl -v copyright years match
52d097d Added release manager test for copyright year

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2013

@cpansprout - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant