Opened 10 years ago

Last modified 10 years ago

#43145 closed defect

Perl PortGroup fails to reinplace non-ascii Makefiles — at Initial Version

Reported by: mojca (Mojca Miklavec) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: dluke@…, cal@…, and.damore@…
Port: p5-test-base p5-yaml

Description

When building p5-yaml on 10.8 and 10.9, sed fails with

DEBUG: Executing reinplace: /usr/bin/sed {/^CCFLAGS *=/s/$/ /} < /opt/local/var/macports/build/_opt_mports_dports_perl_p5-yaml/p5.16-yaml/work/YAML-0.90/Makefile >@ file14
DEBUG: sed: RE error: illegal byte sequence

(see https://build.macports.org/builders/buildports-mavericks-x86_64/builds/2454) because the Makefile contains a non-ascii character (in Latin 1 encoding, invalid UTF).

This comes from the perl PortGroup:

# CCFLAGS can be passed in to "configure" but it's not necessarily inherited.
# LDFLAGS can't be passed in (or if it can, it's not easy to figure out how).
post-configure {
    fs-traverse file ${configure.dir} {
        if {[file isfile ${file}] && [file tail ${file}] eq "Makefile"} {
            ui_info "Fixing flags in [string map "${configure.dir}/ {}" ${file}]"
            reinplace "/^CCFLAGS *=/s/$/ [get_canonical_archflags cc]/" ${file}
            reinplace "/^OTHERLDFLAGS *=/s/$/ [get_canonical_archflags ld]/" ${file}
        }
    }
}

Suggestions from IRC:

neverpanic:

set LC_ALL to C I think that's a common issue with ill-formatted UTF-8 files /usr/bin/sed changed on 10.8 and above You can either patch that to be valid UTF-8 or set configure.env LC_ALL=C in the Portfile It is kind of weird to use the locale settings for that. I mean you could set the correct locale for the file, but then any messages to your terminal would be broken…

anddam:

I'd escape that dollar sign

Dar1us:

it refuses to process files which aren't validly encoded given the current LC settings .. and by default that is UTF-8

Change History (0)

Note: See TracTickets for help on using tickets.