Ticket #12700 (closed defect: fixed)
BUG: reinplace -E doesn't work with GNU sed (from gsed +with_default_names)
| Reported by: | vinc17@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | MacPorts 1.6 |
| Component: | base | Version: | 1.5.2 |
| Keywords: | Cc: | vinc17@…, nox@… | |
| Port: |
Description
The Portfile man page mentions "reinplace -E", which is used by the libxslt port at least. When sed from the coreutils port is installed (in /opt/local/bin, which is first in my $PATH), installing libxslt fails with:
Error: reinplace: sed: invalid option -- E
A fix could be to hard-code the path to BSD sed: /usr/bin/sed. But it would probably be better not to rely on non-POSIX features, in particular if Apple decides to use another version of sed in the future. Note that the BSD sed man page says:
The -E, -a and -i options are non-standard FreeBSD extensions and may not
be available on other operating systems.
Attachments
Change History
comment:2 Changed 6 years ago by afb@…
coreutils doesn't have sed, does it ? and gsed installs at gsed, so I don't see the problem
comment:3 Changed 6 years ago by vinc17@…
Yes, it's port gsed, and it is installed as sed too if the with_default_names variant is used.
comment:4 Changed 6 years ago by vinc17@…
- Summary changed from BUG: reinplace -E doesn't work with GNU sed (from coreutils) to BUG: reinplace -E doesn't work with GNU sed (from gsed +with_default_names)
comment:5 Changed 6 years ago by nox@…
- Cc nox@… added
We should should hardcode it. sed -E uses POSIX-compliant regular expressions, see re_format(7).
comment:7 Changed 6 years ago by afb@…
It would be better if you autoconf'ed it as @SED@ and added it to MacPorts requirements.
Note: +with_default_names is rather dangerous, and will break a few other ports as well.
comment:8 Changed 6 years ago by afb@…
I've added @SED@ and @SED_EXT@ in r29127, along with sed_command and sed_ext_flag.
Should now be able to auto-detect BSD sed (-E) and GNU sed (-r) flags, at least...
comment:9 Changed 6 years ago by vinc17@…
Note: +with_default_names is rather dangerous, and will break a few other ports as well.
It should be clear that binaries installed by ports are first for the end user. If the end user prefers GNU utilities, he should be able to use them without needing any prefix. If a port relies on some non-POSIX feature or doesn't take care of a specific dependency (because it wants to use some extension) itself, then this is a bug.
Conversely, upstream sometimes assumes coreutils or couldn't test with BSD utilities; this can also break some ports...
BTW, +with_default_names could install default names into another directory, such as /opt/local/gnu/bin; the end user would just have to adjust his $PATH.
comment:10 Changed 6 years ago by afb@…
cmdline set to use autoconf values, in r29441.
remaining to be tested is if the extended regexps actually work with GNU sed, if they don't there is not much to do but to require that BSD sed is configured.
but at least it should be using the full path now, Mac default being /usr/bin/sed
comment:11 Changed 5 years ago by afb@…
- Status changed from new to closed
- Resolution set to fixed
Fixed, MacPorts 1.6.0.
comment:12 Changed 5 years ago by jmpp@…
- Priority changed from High to Normal
- Component changed from ports to base
comment:13 Changed 4 years ago by toby@…
- Milestone changed from MacPorts base bugs to MacPorts Future
Milestone MacPorts base bugs deleted


The fact that /opt/local/bin is in my $PATH, doesn't matter. So, I suppose that port uses a hard-coded $PATH with /opt/local/bin in it.