After an upgrade from 12.2 to 13.0-BETA3, python's virtualenvwrapper stopped working with a sed error. Source seems to be a pipeline akin to this:
> echo test/bin/activate | tr "\n" " " | sed "s|/bin/activate |/|g" | tr "/" "\n" | sed "s/^\s*$/d"
sed: 1: "/^\s*$/d": RE error: trailing backslash (\)
If I mount the 12.2 boot environment and replace the sed calls in the above with /tmp/be<RANDOM>/usr/bin/sed, it works, as it has on 12.2:
> echo test/bin/activate | tr "\n" " " | /tmp/be_mount.6Hlw/usr/bin/sed "s|/bin/activate |/|g" | tr "/" "\n" | /tmp/be_mount.6Hlw/usr/bin/sed "/^\s*$/d"
Note that while the bug is actual, there is an error in your reproducer, `sed "s/^\s*$/d"` is wrong, there should not be an 's' command at the beginning.
(In reply to freebsd from comment #0)
Regardless of how 13 ends up, you should patch this to replace \s with [[:space:]]. This expression is not doing what the authors intended it to do on any other version of FreeBSD, and the new logic is only pointing that out.
A simpler test case is just:
printf "\n\n\n\n" | sed "/^\s*$/d"
Expected behaviour is that the empty lines will be filtered out.
I believe the error is raised in p_simp_re() in /usr/src/lib/libc/regex/regcomp.c.
(In reply to David Schlachter from comment #4)
Indeed, the error is quite intentional and to catch unexpected behavior like this.
(In reply to Kyle Evans from comment #5)
Do you mean this is expected behaviour now? Because from a user's point of view, this error message is rather unhelpful: what trailing backslash?
I can report that changing \s to [[:space:]] is working.
So how to proceed? Should I report this to virtualenvwrapper's upstream? Should the port maintainer add a patch?
(In reply to freebsd from comment #6)
Yes, the message leaves a lot to be desired, unfortunately; I've not yet been able to study the impact of changing the message since this reused a preexisting "escape error" condition.
Indeed, ideally this would both go upstream and to the local port maintainer as a POSIX compliance issue.