Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Nov 2009 02:48:04 +0900
From:      "Akinori MUSHA" <knu@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/140364: ports-mgmt/portupgrade-devel: #! line substitution is broken
Message-ID:  <86639mns4r.knu@FreeBSD.org>
Resent-Message-ID: <200911071810.nA7IA3Mj086719@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
	Note: There was a bad value `non-critical<[' for the field `>Severity:'.
	It was set to the default value of `serious'.


>Number:         140364
>Category:       ports
>Synopsis:       ports-mgmt/portupgrade-devel: #! line substitution is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 07 18:10:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     "Akinori MUSHA" <knu@FreeBSD.org>
>Release:        FreeBSD 7.2-STABLE amd64
>Organization:
N/A
>Environment:

  FreeBSD daemon.musha.org 7.2-STABLE FreeBSD 7.2-STABLE #10: Mon Sep 28 01:42:28 JST 2009     root@daemon.musha.org:/var/cache/obj/usr/src/sys/DAEMON  amd64

>Description:

  #! line substitution in portupgrade-devel is broken.

>How-To-Repeat:

  Install portupgrade-devel and run `head -n1 /usr/local/sbin/portupgrade'.
  If it shows `#!/usr/bin/env ruby', the line has not been properly processed.

>Fix:

  sub() is not equivalent to $_.sub() but $_.sub!().

  Just back out the modification as follows:

--- bin/Makefile.orig   2008-07-17 09:26:38.000000000 +0900
+++ bin/Makefile        2009-11-08 02:31:36.000000000 +0900
@@ -28,7 +28,7 @@ ${script}: ${script:T}
   ${RUBY} -pe ' \
           if $$. == 1; \
               if /^#!/; \
-                   $$_.sub(/^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"); \
+                   sub /^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"; \
                 else; \
                         $$_ = "#!${RUBY}\n" + $$_; \
                              end; \

  Or use the destructive method:

--- bin/Makefile.orig   2008-07-17 09:26:38.000000000 +0900
+++ bin/Makefile        2009-11-08 02:31:36.000000000 +0900
@@ -28,7 +28,7 @@ ${script}: ${script:T}
   ${RUBY} -pe ' \
           if $$. == 1; \
               if /^#!/; \
-                   $$_.sub(/^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"); \
+                   $$_.sub!(/^#!\s*\S*(\benv\s+)?\bruby/, "#!${RUBY}"); \
                 else; \
                         $$_ = "#!${RUBY}\n" + $$_; \
                              end; \



-- 
Akinori MUSHA / http://akinori.org/
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86639mns4r.knu>