Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#31821 closed enhancement (invalid)

reinplace -E doesn't work when /usr/bin/sed switches from BSD sed to GNU sed or vice versa

Reported by: ekawahyu (Ekawahyu Susilo) Owned by: macports-tickets@…
Priority: Low Milestone:
Component: base Version: 2.0.3
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port:

Description

This is a known issue of incompatibility between BSD sed (Mac) and GNU sed (macports). I don't know where to file this issue, therefore, I put it here as note/enhancement request.

In the past, I renamed /usr/bin/sed to /usr/bin/darwinsed and created a symbolic link of /usr/bin/sed -> /opt/local/bin/gsed. It turned out that building arm-none-eabi-binutils failed because of this, and it is fine when I put the symbolic link back to BSD sed.

I did not keep the log file, but I copy the error message below:

--->  Verifying checksum(s) for arm-none-eabi-binutils
--->  Checksumming binutils-2.21.53.0.1.tar.bz2
--->  Extracting arm-none-eabi-binutils
--->  Extracting binutils-2.21.53.0.1.tar.bz2
Error: reinplace: /usr/bin/sed: -e expression #1, char 42: Invalid character class name
Error: Target org.macports.patch returned: reinplace sed(1) failed
Warning: the following items did not execute (for arm-none-eabi-binutils): org.macports.activate org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
Error: Failed to install arm-none-eabi-binutils
Log for arm-none-eabi-binutils is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_cross_arm-none-eabi-binutils/arm-none-eabi-binutils/main.log
Error: The following dependencies were not installed: arm-none-eabi-binutils libmpc mpfr
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>

This is only a minor issue and I hope this could help someone else who replaces the BSD sed with GNU sed, like I did.

The arm-none-eabi-binutils builds just fine using BSD sed. Thank you.

Change History (2)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed

You shouldn't replace OS X's BSD sed with a GNU sed. Many programs' configuration scripts are hardcoded with the knowledge that on Darwin, sed is BSD sed; you'll break those by doing this.

If you want GNU sed in your PATH for your own convenience, install the gsed port and add /opt/local/libexec/gnubin to your PATH.

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Component: portsbase
Port: arm-none-eabi-binutils removed
Summary: [minor issue] sed issue while building arm-none-eabi-binutilsreinplace -E doesn't work when /usr/bin/sed switches from BSD sed to GNU sed or vice versa

In the specific case you found above, it's not arm-none-eabi-binutils' configuration program; it's MacPorts base itself, which has a "reinplace" command which portfiles can use, which is basically a wrapper to sed. The relevant reinplace that's demonstrating the problem is in the crossbinutils portgroup that the arm-none-eabi-binutils port (and the other cross-compiled binutils ports) use:

browser:trunk/dports/_resources/port1.0/group/crossbinutils-1.0.tcl?rev=69962#L89

The -E switch that this reinplace is using means "use extended (i.e. modern) regular expressions". With BSD sed, the way to do that is to pass it the argument -E. With GNU sed, the argument is -r. MacPorts base's configure script will detect whether your sed is BSD sed or GNU sed and pass the correct argument:

browser:trunk/base/aclocal.m4?rev=80222#L912

So the only reason this failed for you is that you configured and installed MacPorts base back when you had BSD sed, and then later you replaced sed with GNU sed -- or you installed MacPorts base from one of our pre-compiled disk images, which are built on such a system.

Note: See TracTickets for help on using tickets.