Bug 203147

Summary: [patch][maintainer update] fix rc.d issues introduced with recent perl changes
Product: Ports & Packages Reporter: Dave Cottlehuber <dch>
Component: Individual Port(s)Assignee: Grzegorz Blach <gblach>
Status: Closed FIXED    
Severity: Affects Some People CC: gblach
Priority: --- Keywords: patch
Version: LatestFlags: dch: maintainer-feedback+
Hardware: Any   
OS: Any   
Bug Depends on: 202937    
Bug Blocks: 203096    
Attachments:
Description Flags
v1 patch to fix rc.d issues post perl changes
dch: maintainer-approval+
v2 patch to fix rc.d issues post perl changes dch: maintainer-approval+

Description Dave Cottlehuber freebsd_committer freebsd_triage 2015-09-16 07:02:37 UTC
I can't get daemon to stop or correctly anymore. I think this is the recent perl changes breaking things.

wintermute# service h2o start
/usr/local/etc/rc.d/h2o: DEBUG: Sourcing /etc/rc.conf.d/h2o
/usr/local/etc/rc.d/h2o: DEBUG: checkyesno: h2o_enable is set to YES.
Starting h2o.
/usr/local/etc/rc.d/h2o: DEBUG: run_rc_command: doit: /usr/local/bin/h2o  -m daemon -c /usr/local/etc/h2o/h2o.conf
start_server (pid:92099) starting now...
starting new worker 92102
wintermute# [INFO] raised RLIMIT_NOFILE to 22500
h2o server (pid:92102) is ready to serve requests
fetch-ocsp-response (using OpenSSL 1.0.1p-freebsd 9 Jul 2015)
fetch-ocsp-response (using OpenSSL 1.0.1p-freebsd 9 Jul 2015)
...
188.166.111.169 - - [14/Sep/2015:20:44:46 +0000] "GET / HTTP/1.1" 200 344 "-" "raintank collector"

wintermute# pgrep -ilf h2o; ps aux |grep h2o; cat /var/run/h2o.pid
92121 python /usr/local/bin/autojump -a /usr/local/share/h2o
92102 /usr/local/bin/h2o -c /usr/local/etc/h2o/h2o.conf
92101 /usr/local/bin/perl -x /usr/local/share/h2o/start_server --pid-file=/var/run/h2o.pid --log-file=/var/log/h2o/error.log --daemonize --port=[::]:80 --port=0.0.0.0:80 --port=[::]:443 --port=0.0.0.0:443 -- /usr/local/bin/h2o -c /usr/local/etc/h2o/h2o.conf
www      92102   4.0  0.0    64216   7992  -  S     8:44PM     0:00.50 /usr/local/bin/h2o -c /usr/local/etc/h2o/h2o.conf
root     92101   0.1  0.0    47648  12368  -  S     8:44PM     0:00.00 /usr/local/bin/perl -x /usr/local/share/h2o/start_server --pid-file=/var/run/h2o.pid
root     92121   0.0  0.0    25612   5372  6  RN    8:44PM     0:00.00 python /usr/local/bin/autojump -a /usr/local/share/h2o (python2.7)
root     92124   0.0  0.0    18824   2612  6  S+    8:44PM     0:00.00 grep h2o
92101

wintermute# service h2o stop
/usr/local/etc/rc.d/h2o: DEBUG: Sourcing /etc/rc.conf.d/h2o
/usr/local/etc/rc.d/h2o: DEBUG: checkyesno: h2o_enable is set to YES.
h2o not running? (check /var/run/h2o.pid).

wintermute# killall -9 -m 'h2o|perl'

wintermute# grep pid-file /usr/local/etc/h2o/h2o.conf |cut -d' ' -f2
/var/run/h2o.pid

config snippet:

listen: 80
listen:
    port: 443
    ssl:
...
access-log: /var/log/h2o/access.log
error-log: /var/log/h2o/error.log
pid-file: /var/run/h2o.pid
user: www


To fix this, I think 3 changes are required:

# /usr/local/share/h2o/*
replace all shebangs by full /usr/local/bin/perl path

# /usr/local/etc/rc.d/h2o
procname="/usr/local/bin/perl"

# /usr/ports/www/h2o/Makefile
introduce perl as a dependency which is missing from the original patch.
Comment 1 Dave Cottlehuber freebsd_committer freebsd_triage 2015-09-16 07:06:47 UTC
Created attachment 161100 [details]
v1 patch to fix rc.d issues post perl changes
Comment 2 Dave Cottlehuber freebsd_committer freebsd_triage 2015-09-16 07:20:51 UTC
# portlint

WARN: Makefile: possible use of absolute pathname "/var/log/${PORTNAME}...".
0 fatal errors and 1 warning found.

# poudriere

http://pkg.skunkwerks.at/poudriere/data/10_2_amd64-default/2015-09-16_07h11m28s/logs/h2o-1.4.5.log

# comments from @mat* on IRC are to use LOCALBASE for perl PATH. v2 patch underway.
Comment 3 Dave Cottlehuber freebsd_committer freebsd_triage 2015-09-16 08:09:26 UTC
revised patch with tips from @mat__ on IRC.

# portlint

WARN: Makefile: possible use of absolute pathname "/var/log/${PORTNAME}...".
0 fatal errors and 1 warning found.

# poudriere

http://pkg.skunkwerks.at/poudriere/data/10_2_amd64-default/2015-09-16_08h02m33s/logs/h2o-1.4.5.log

# patch

https://github.com/dch/freebsd-ports/commit/a6c7794cd4a763aed6042ff81036b7bce0f5a495
Comment 4 Dave Cottlehuber freebsd_committer freebsd_triage 2015-09-16 08:11:07 UTC
Created attachment 161111 [details]
v2 patch to fix rc.d issues post perl changes
Comment 5 Grzegorz Blach freebsd_committer freebsd_triage 2015-09-16 10:25:34 UTC
I'll take this
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-09-16 12:30:44 UTC
A commit references this bug:

Author: gblach
Date: Wed Sep 16 12:29:58 UTC 2015
New revision: 397062
URL: https://svnweb.freebsd.org/changeset/ports/397062

Log:
  - Fix rc.d issues introduced with recent perl changes [1]
  - Update to 1.4.5 [2]

  PR:		203147 [1], 203096 [2]
  Submitted by:	Dave Cottlehuber (maintainer)

Changes:
  head/www/h2o/Makefile
  head/www/h2o/distinfo
  head/www/h2o/files/h2o.in
Comment 7 Grzegorz Blach freebsd_committer freebsd_triage 2015-09-16 12:32:47 UTC
Committed with minior change, thanks.
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-09-16 16:33:05 UTC
A commit references this bug:

Author: feld
Date: Wed Sep 16 16:32:40 UTC 2015
New revision: 397072
URL: https://svnweb.freebsd.org/changeset/ports/397072

Log:
  Document www/h2o vulnerability

  PR:		203096
  PR:		203147
  Security:	CVE-2015-5638

Changes:
  head/security/vuxml/vuln.xml
Comment 9 commit-hook freebsd_committer freebsd_triage 2015-09-18 09:57:30 UTC
A commit references this bug:

Author: junovitch
Date: Fri Sep 18 09:56:31 UTC 2015
New revision: 397229
URL: https://svnweb.freebsd.org/changeset/ports/397229

Log:
  MFH r393066,r396229,r396629,r397062:

  r393066
  www/h2o: 1.2.0 -> 1.4.2

  ChangeLog:
  https://github.com/h2o/h2o/releases

  PR:		200998
  Submitted by:	sean@x-n.su
  Approved by:	Dave Cottlehuber <dch@skunkwerks.at> (maintainer)

  r396229
  - Update to 1.4.4 [1]
  - Drop 8.x support [2]

  PR:		202818 [1]
  Submitted by:	Dave Cottlehuber (dch <at> skunkwerks <dot> at) [1]
  Approved by:	portmgr blanket [2]

  r396629
  - Fix rc.d script
  - Bump PORTVERSION

  PR:		202937
  Submitted by:	gblach
  Approved by:	Dave Cottlehuber (dch <at> skunkwerks <dot> at)

  r397062
  - Fix rc.d issues introduced with recent perl changes [1]
  - Update to 1.4.5 [2]

  PR:		203147 [1], 203096 [2]
  Submitted by:	Dave Cottlehuber (maintainer)

  Security:	31ea7f73-5c55-11e5-8607-74d02b9a84d5
  Security:	CVE-2015-5638
  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2015Q3/
  branches/2015Q3/www/h2o/Makefile
  branches/2015Q3/www/h2o/distinfo
  branches/2015Q3/www/h2o/files/h2o.conf.sample
  branches/2015Q3/www/h2o/files/h2o.in
  branches/2015Q3/www/h2o/files/patch-CMakeLists.txt
  branches/2015Q3/www/h2o/pkg-plist