Bug 192712

Summary: Minor patch update needed for devel/cvsweb3
Product: Ports & Packages Reporter: Dennis Glatting <freebsd>
Component: Individual Port(s)Assignee: John Marino <marino>
Status: Closed FIXED    
Severity: Affects Some People CC: marino
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Previously proposed patch file. none

Description Dennis Glatting 2014-08-16 20:31:00 UTC
I do not know if this is PERL version dependent but I have had to add a minor patch to cvsweb.cgi for some time. I updated an existing patch file which I have included below. I am currently running PERL 5.20.

Here is my error without the additional patch:

Docs# perl -c cvsweb.cgi
"my" variable $tmp masks earlier declaration in same statement at cvsweb.cgi line 1338.
syntax error at cvsweb.cgi line 1195, near "$v qw(hidecvsroot hidenonreadable)"
Global symbol "$v" requires explicit package name at cvsweb.cgi line 1197.
Global symbol "$v" requires explicit package name at cvsweb.cgi line 1197.
syntax error at cvsweb.cgi line 1276, near "}"
  (Might be a runaway multi-line << string starting on line 1267)
syntax error at cvsweb.cgi line 1289, near "}"
syntax error at cvsweb.cgi line 1295, near "}"
syntax error at cvsweb.cgi line 1302, near "}"
syntax error at cvsweb.cgi line 1312, near "}"
syntax error at cvsweb.cgi line 1336, near "}"
syntax error at cvsweb.cgi line 1338, near ""$tmp,v" }"
cvsweb.cgi has too many errors.
Docs# 

With the patch:

Docs# perl -c cvsweb.cgi
defined(@array) is deprecated at cvsweb.cgi line 2954.
	(Maybe you should just omit the defined()?)
cvsweb.cgi syntax OK





--- ./cvsweb.cgi.orig	2005-09-25 14:28:51.000000000 -0600
+++ ./cvsweb.cgi	2014-08-16 14:21:37.000000000 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -T
+#!!!PERL!! -wT
 #
 # cvsweb - a CGI interface to CVS trees.
 #
@@ -214,7 +214,7 @@
 
 # == EDIT this ==
 # Locations to search for user configuration, in order:
-for (catfile($mydir, 'cvsweb.conf'), '/usr/local/etc/cvsweb/cvsweb.conf') {
+for (catfile($mydir, 'cvsweb.conf'), '!!PREFIX!!/etc/cvsweb/cvsweb.conf') {
   if (-r $_) {
     $config = $_;
     last;
@@ -1192,7 +1192,7 @@
 <legend>General options</legend>
 <input type="hidden" name="copt" value="1" />
 EOF
-    for my $v qw(hidecvsroot hidenonreadable) {
+    for my $v (qw(hidecvsroot hidenonreadable)) {
       printf(qq{<input type="hidden" name="%s" value="%s" />\n},
              $v, $input{$v} || 0);
     }
Comment 1 John Marino freebsd_committer freebsd_triage 2014-08-16 20:35:10 UTC
1) you want to attach patches, not put them in comments
2) There is a standard fix for perl shebangs.  It's called "USES=shebangfile" and it's partner is SHEBANG_FILES= <list of files relative to WRKSRC>

You can read about it in Mk/Uses/shebangfix.mk or just grep and category, you'll find plenty of examples.

The other changes are best done with ${REINPLACE_CMD} I suspect.
Comment 2 John Marino freebsd_committer freebsd_triage 2014-08-16 20:36:09 UTC
(In reply to John Marino from comment #1)
> The other changes are best done with ${REINPLACE_CMD} I suspect.

you still need a patch for that qw fix though...
Comment 3 Dennis Glatting 2014-08-16 20:46:17 UTC
(In reply to John Marino from comment #1)
> 1) you want to attach patches, not put them in comments

Noted.


> 2) There is a standard fix for perl shebangs.  It's called
> "USES=shebangfile" and it's partner is SHEBANG_FILES= <list of files
> relative to WRKSRC>
> 
> You can read about it in Mk/Uses/shebangfix.mk or just grep and category,
> you'll find plenty of examples.
> 

The shebang part of the patch is from the original patch. I simply updated the patch.


> The other changes are best done with ${REINPLACE_CMD} I suspect.
Comment 4 John Marino freebsd_committer freebsd_triage 2014-08-16 20:51:16 UTC
(In reply to Dennis Glatting from comment #3)
> The shebang part of the patch is from the original patch. I simply updated
> the patch.

I'm not following, it says you added "#!!!PERL!! -wT" which I assume !!PERL!! is replaced inline.

Why don't you attach what the patch to the port should be to eliminate this confusion?  Or is this it?
Comment 5 Dennis Glatting 2014-08-16 21:25:22 UTC
Created attachment 145884 [details]
Previously proposed patch file.
Comment 6 Dennis Glatting 2014-08-16 21:34:50 UTC
(In reply to John Marino from comment #4)
> (In reply to Dennis Glatting from comment #3)
> > The shebang part of the patch is from the original patch. I simply updated
> > the patch.
> 
> I'm not following, it says you added "#!!!PERL!! -wT" which I assume
> !!PERL!! is replaced inline.
> 
> Why don't you attach what the patch to the port should be to eliminate this
> confusion?  Or is this it?

Second try on a reply...

I am not the maintainer and someone else updated the port for StageDir. I simply tried to keep my changes to a minimum. I recreated the patch file from "make makepatch".

!!PERL!! and !!CVSROOT!! is part of the existing patch files. For !!PERL!! the unaltered code contains:

#!/usr/bin/perl -T

Why the alteration in patch files and subsequent alteration in the Makefile? Dunno. Wasn't there.
Comment 7 John Marino freebsd_committer freebsd_triage 2014-08-16 21:35:42 UTC
okay, so now we're back to the beginning.

1. this port is not staged, it will be deleted in 2 weeks
2. That post-patch thing with !!PERL!! is redundant to shebangfix.  The rest of the patch can be handled with REINPLACE_CMD.


however, unless #1 is solved, there's no point to this PR.  it be obsolete.
Comment 8 Dennis Glatting 2014-08-16 22:04:10 UTC
(In reply to John Marino from comment #7)
> okay, so now we're back to the beginning.
> 
> 1. this port is not staged, it will be deleted in 2 weeks
> 2. That post-patch thing with !!PERL!! is redundant to shebangfix.  The rest
> of the patch can be handled with REINPLACE_CMD.
> 
> 
> however, unless #1 is solved, there's no point to this PR.  it be obsolete.

I use this port for Sarbanes-Oxley compliance. Specifically, my router and switch configurations are managed under RANCID where the diffs are made visible through a web interface using this port. Once, maybe twice, a year the auditors pull up the web page, click one or two things (I suspect without looking at content), then check the box. For me this is useful.

The port has a number of problems, such as failing "make check-orphans" and portlint. 

I don't have a problem updating this port unless there is something better.
Comment 9 John Marino freebsd_committer freebsd_triage 2014-08-16 22:10:18 UTC
hmm, wait, this port is staged.  I must have been looking at an older tree.  some of what I said is still true I think.
Comment 10 John Marino freebsd_committer freebsd_triage 2014-08-16 22:22:24 UTC
(In reply to Dennis Glatting from comment #8)
> I use this port for Sarbanes-Oxley compliance. Specifically, my router and
> switch configurations are managed under RANCID where the diffs are made
> visible through a web interface using this port. Once, maybe twice, a year
> the auditors pull up the web page, click one or two things (I suspect
> without looking at content), then check the box. For me this is useful.

It's a moot point because it is staged, but had it not been staged, this wouldn't have mattered.  Raising a hand with, "but I use it!" wouldn't stop the reaper.  Only a PR staging it would.


> The port has a number of problems, such as failing "make check-orphans" and
> portlint. 
> 
> I don't have a problem updating this port unless there is something better.

Actually I ran it through poudriere and it passes everything.

But that post-patch command can be replace such that no patch is needed at all.
Comment 11 John Marino freebsd_committer freebsd_triage 2014-08-16 22:23:38 UTC
I'll take this.  As-is it's not "patch-ready", there's a better way to fix this.
Comment 12 commit-hook freebsd_committer freebsd_triage 2014-08-17 00:31:13 UTC
A commit references this bug:

Author: marino
Date: Sun Aug 17 00:30:19 UTC 2014
New revision: 365145
URL: http://svnweb.freebsd.org/changeset/ports/365145

Log:
  devel/cvsweb3: Update cvsweb3.cgi for newer versions of perl

  Remove patch to cvsweb3.cgi and implement all the necessary changes
  only with sed which is already being used and shebangfix.  This change to
  the qw line is needed for the recent versions of perl.

  PR:		192712
  Submitted by:	Dennis Glatting
  Approved by:	Just Fix It

Changes:
  head/devel/cvsweb3/Makefile
  head/devel/cvsweb3/files/patch-cvsweb.cgi
Comment 13 John Marino freebsd_committer freebsd_triage 2014-08-17 00:32:10 UTC
okay, done.
Comment 14 Dennis Glatting 2014-08-17 00:46:54 UTC
(In reply to John Marino from comment #13)
> okay, done.

Thank you.