Bug 231277 - dns/ddclient: perl SHEBANG wrong
Summary: dns/ddclient: perl SHEBANG wrong
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Koichiro Iwao
URL:
Keywords: patch-ready
Depends on:
Blocks:
 
Reported: 2018-09-10 06:48 UTC by O. Hartmann
Modified: 2019-10-08 02:25 UTC (History)
4 users (show)

See Also:
mjl: maintainer-feedback+
koobs: merge-quarterly?


Attachments
Get rid of a wrong shebang statement in ddclient (488 bytes, patch)
2018-09-10 13:12 UTC, O. Hartmann
mjl: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2018-09-10 06:48:01 UTC
Running dns/ddclient on a 12-CURRENT router facility reveals some problems lately and investigating /usr/local/sbin/ddclient (PERL 5 script) reveals, that the SHEBANG header is comprised from:

#!/usr/local/bin/perl -w
#!/usr/local/local/bin/perl -w
######################################################################
#
# DDCLIENT - a Perl client for updating DynDNS information
#
# Author: Paul Burry (paul+ddclient@burry.ca)
[...]

The second line seems clearly wrong.
Comment 1 mjl 2018-09-10 07:01:09 UTC
Can you please address this with upstream.  ddclient works as it is, and you haven't reported a bug that impacts anyone as best i can tell.
Comment 2 O. Hartmann 2018-09-10 13:11:31 UTC
Why should I address something with upstream when it is clearly a fault of the port maintenance?

The original perl main program's shebang is

#!/usr/bin/perl -w
#!/usr/local/bin/perl -w
######################################################################
[...]


and after application of the patch (tagged post-patch) it is

#!/usr/local/bin/perl -w
#!/usr/local/local/bin/perl -w
######################################################################
[...]

as reported. And now: who is to blame? Upstream?

The problem is identified rather quickly:

post-patch:
        @${GREP} -lR '/usr' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} -e \
                's|/usr|${PREFIX}|g'

It is surely more of a cosmetic question, but I'm not sure about nasty side effects. It should be fixed - locally at FreeBSD's, not upstream.

But how do you think about the attached patch? Also cosmetic (I'd prefer /usr/bin/env -S perl -w )?

Regards,

oh
Comment 3 O. Hartmann 2018-09-10 13:12:38 UTC
Created attachment 197003 [details]
Get rid of a wrong shebang statement in ddclient

Delete a wrong shebang statement in ddclient.
Comment 4 mjl 2018-09-11 00:55:35 UTC
My understanding is that it is not valid to have two shebang lines.

My interpretation of your response is that you agree that this is a cosmetic change rather than a bug that impacts anyone.

These two factors are behind my request that this be dealt with upstream.

In terms of a patch, if one must be applied, it seems to me the optimum approach is to remove the second shebang from the source code, and use

https://www.freebsd.org/doc/en/books/porters-handbook/uses-shebangfix.html
Comment 5 Nathan 2018-09-11 01:15:07 UTC
I agree, there should not be two #! lines, upstream needs to get rid of one and then we can let shebangfix do the rest
Comment 6 Nathan 2018-09-11 01:17:10 UTC
(In reply to Nathan from comment #5)
To add on, I think i know why the 2nd line of #! in regards to Comment#0 is because of REINPLACE_CMD. I've seen sed do something similar when I was using sed to replace some text, and it made a bit redundant replacements
Comment 7 Nathan 2018-09-11 03:01:26 UTC
Actually looking at it, wouldn't need shebang fix. 
Get rid of:
  @${GREP} -lR '/usr' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} -e \
 	                's|/usr|${PREFIX}|g'

do 
${REINPLACE_CMD} -e '1d ; s,/usr/bin,${PREFIX}/bin,g' ${WRKSRC}/ddclient

This will delete first #! leaving the correct path we need in FreeBSD, 2nd part fixes rest of /usr/bin in file
Comment 8 mjl 2018-09-11 03:40:35 UTC
When I looked at ddclient after make patch, I didn't see any other use of /usr that we wanted changed to ${PREFIX} that wasn't handled in patch-ddclient already.  This is all about a shebang.
Comment 9 Nathan 2018-09-11 03:41:53 UTC
Yup. then 2nd part of my REINPLACE_CMD wouldn't be needed if patch took care of rest
Comment 10 Walter Schwarzenfeld freebsd_triage 2019-08-11 10:47:29 UTC
ping!
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2019-08-11 11:13:07 UTC
@Maintainer, Can you please produce a patch against the port if there is a change to be made or bug to be fixed
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2019-08-11 11:15:27 UTC
Alternatively, review and accept/not-accept attachment 197003 [details] with rationale in the latter case.
Comment 13 mjl 2019-08-15 08:59:10 UTC
(In reply to Kubilay Kocak from comment #12)
the patch is maintainer approved
Comment 14 Koichiro Iwao freebsd_committer 2019-10-06 16:38:06 UTC
QA looks fine.
Comment 15 commit-hook freebsd_committer 2019-10-06 16:43:00 UTC
A commit references this bug:

Author: meta
Date: Sun Oct  6 16:42:31 UTC 2019
New revision: 513895
URL: https://svnweb.freebsd.org/changeset/ports/513895

Log:
  dns/ddclient: Get rid of a wrong shebang statement

  in bin/ddclient. It has double shebang line and one is
  "#!/usr/local/local/bin/perl -w" This is definitely wrong.

  Also bumped PORTREVISION due to package content change.

  PR:		231277
  Submitted by:	koobs
  Reported by:	O. Hartmann <ohartmann@walstatt.org>
  Approved by:	maintainer
  MFH:		2019Q4

Changes:
  head/dns/ddclient/Makefile
Comment 16 commit-hook freebsd_committer 2019-10-08 02:23:57 UTC
A commit references this bug:

Author: meta
Date: Tue Oct  8 02:23:34 UTC 2019
New revision: 514023
URL: https://svnweb.freebsd.org/changeset/ports/514023

Log:
  MFH: r513895

  dns/ddclient: Get rid of a wrong shebang statement

  in bin/ddclient. It has double shebang line and one is
  "#!/usr/local/local/bin/perl -w" This is definitely wrong.

  Also bumped PORTREVISION due to package content change.

  PR:		231277
  Submitted by:	koobs
  Reported by:	O. Hartmann <ohartmann@walstatt.org>
  Approved by:	maintainer

  Approved by:	portmgr (miwi)

Changes:
_U  branches/2019Q4/
  branches/2019Q4/dns/ddclient/Makefile
Comment 17 Koichiro Iwao freebsd_committer 2019-10-08 02:25:16 UTC
Committed, thanks!