[MacPorts] #54903: AtomicParsley @0.9.0: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'

MacPorts noreply at macports.org
Wed Oct 11 17:37:38 UTC 2017


#54903: AtomicParsley @0.9.0: error: cannot initialize a variable of type 'char *'
with an rvalue of type 'const char *'
----------------------------+------------------------
  Reporter:  jpmelko        |      Owner:
      Type:  defect         |     Status:  new
  Priority:  Normal         |  Milestone:
 Component:  ports          |    Version:
Resolution:                 |   Keywords:  highsierra
      Port:  AtomicParsley  |
----------------------------+------------------------

Comment (by wildyman):

 Please add the following lines to the end of the post-patch section of the
 Portfile to fix these build issues on High Sierra.

 {{{
     # fix initializing a variable of type 'char *' with an rvalue of type
 'const char *' b0rked in High Sierra
     reinplace -locale en_US.ISO8859-1 -W ${worksrcpath} "s|= strrchr|=
 (char*)strrchr|g" AP_NSFile_utils.mm AP_NSImage.mm AtomicParsley.cpp
 }}}

 It appears that clang's Objective C and C++ now use the safe C++ version
 of 'strrchr' which returns a 'const char*'. This version is presumably
 intended to prevent unsafe or unintentional modification of immutable
 string literals through a non constant reference (pointer) to a substring.
 The C version returns 'char*' which silently drops the const. The explicit
 cast added in the reinplace above allows the potentially unsafe operation.
 A better solution might be to change the return type to 'const char*' for
 these variables to ensure that AtomicParsley isn't actually performing
 unsafe string operations. It would be better to fix this in the
 AtomicParsley source.

--
Ticket URL: <https://trac.macports.org/ticket/54903#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list