[MacPorts] #27299: defect: reinplace dequotes backslashes incompatibly with sed -E

MacPorts noreply at macports.org
Fri Nov 12 21:55:07 PST 2010


#27299: defect: reinplace dequotes backslashes incompatibly with sed -E
---------------------------------------------+------------------------------
 Reporter:  james.from.wellington@…          |       Owner:  macports-tickets@…                   
     Type:  defect                           |      Status:  new                                  
 Priority:  Normal                           |   Milestone:                                       
Component:  base                             |     Version:  1.9.2                                
 Keywords:                                   |        Port:                                       
---------------------------------------------+------------------------------
 In the course of modifying the Portfile for firefox-x11-devel to build
 firefox 4.0b, I want this reinplace command:

 {{{reinplace -E "s:(libgtk-directfb-2.0).so.0:${prefix}/lib/\1.dylib:"
 ${worksrcpath}/dom/plugins/PluginModuleChild.cpp}}}

 The \1 works in sed -E on the command-line, and substitutes back in a copy
 of the library name.

 After port install, the resulting line in the file reads (in vi):
 {{{
 sGtkLib = PR_LoadLibrary("/opt/local/lib/^A.dylib");
 }}}

 I have inserted some debug output into portutil.tcl.  This is one of
 several attempts, so the line numbers will not agree with your copies.
 {{{
  # reinplace
  # Provides "sed in place" functionality
  proc reinplace {args}  {

 +    puts "Because I want to know (args): >>$args<<"
 +
      set extended 0
      while 1 {
          set arg [lindex $args 0]
 @@ -905,6 +932,9 @@
              lappend cmdline $portutil::autoconf::sed_ext_flag
          }
          set cmdline [concat $cmdline [list $pattern < $file >@ $tmpfd]]
 +
 +        puts "Because I want to know (sed): >>$cmdline<<"
 +
 }}}

 The output I get (which I am wrappng for convenience) from this reads:
 {{{
 Because I want to know (args): >>-E
   s:(libgtk-directfb-2.0).so.0:/opt/local/lib/.dylib:
   /opt/local/var/macports/build/
   _Users_jamescone_buildTrees_macports_www_firefox-x11-devel/work/
   mozilla-central/dom/plugins/PluginModuleChild.cpp<<

 Because I want to know (sed): >>/usr/bin/sed -E
   s:(libgtk-directfb-2.0).so.0:/opt/local/lib/.dylib:
   < /opt/local/var/macports/build/
   _Users_jamescone_buildTrees_macports_www_firefox-x11-devel/work/
   mozilla-central/dom/plugins/PluginModuleChild.cpp >@ file11<<
 }}}

 I assume that there is an invisible control-A in these two lines of
 printout, before the .dylib.  In any event, they show that the sed command
 is already mangled, before reinplace is called.

 I have worked out that the portfile is parsed into a set of runtime-
 created proc's, but I cannot work out enough of the details to localise
 the fault.

 Help, please.

-- 
Ticket URL: <https://trac.macports.org/ticket/27299>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list