Sed: -e expression #1, char 1: unknown command: `''

What’s going wrong in my following attempt to build? I can recreate this most trivially by trying to install lua. The error message is:

sed: -e expression #1, char 1: unknown command: `''

Is there something borked in my installation or eups that’s causing something to be empty that’s not supposed to be?

[Calm ~] rebuild -u lua
Could not import lsstcppimport; please ensure the base package has been built (not just setup).

                 lua:  ok (0.7 sec).
# BUILD ID: b2999
Could not import lsstcppimport; please ensure the base package has been built (not just setup).

                 lua: 5.1.4.lsst1-1-gfd327c6 ERROR (5 sec).
*** error building product lua.
*** exit code = 1
*** log is in /Users/wmwv/lsstsw/build/lua/_build.log
*** last few lines:
:::::  [2017-08-07T12:26:38.228666Z] + cd /Users/wmwv/lsstsw/build/lua
:::::  [2017-08-07T12:26:38.228681Z] + git reset --hard
:::::  [2017-08-07T12:26:38.232630Z] HEAD is now at fd327c6 Merge pull request #1 from lsst/tickets/DM-1731
:::::  [2017-08-07T12:26:38.233695Z] + git clean -d -f -q -x -e '_build.*'
:::::  [2017-08-07T12:26:38.248223Z] + eupspkg PRODUCT=lua VERSION=5.1.4.lsst1-1-gfd327c6 FLAVOR=generic prep
:::::  [2017-08-07T12:26:39.571840Z] + cat
:::::  [2017-08-07T12:26:39.587158Z] + set +x
:::::  [2017-08-07T12:26:39.587254Z] Setting up environment with EUPS
:::::  [2017-08-07T12:26:40.227774Z] + eupspkg PRODUCT=lua VERSION=5.1.4.lsst1-1-gfd327c6 FLAVOR=generic config
:::::  [2017-08-07T12:26:41.229304Z] sed: -e expression #1, char 1: unknown command: `''

Theory: you are using GNU sed, but running on a macOS system. Could you give us a $ uname && sed --version please?

Or cd into that directory and take a look at the sed command that’s actually failing (ideally by doing a setup and running that eupspkg command with -v set)

I am way ahead of you. I bet he’s getting this:

sed -i '.prev' s,#define LUA_ROOT\t"/usr/local/",#define LUA_ROOT\t"/Users/jds/Projects/Astronomy/LSST/stack/DarwinX86/lua/5.1.4.lsst1-1-gfd327c6/", src/luaconf.h
sed: -e expression #1, char 1: unknown command: `''

Offending logic is here: https://github.com/lsst/lua/blob/master/ups/eupspkg.cfg.sh#L19.

Agreed (and mea culpa). Should be testing for gnu vs. BSD sed here (basically, check whether sed -i fails w/o an argument).

That said, @mwv, I suspect other software could get tripped up on this too – it’s risky to be shadowing Mac’s BSD utils with GNU equivalents (macports?).

https://jira.lsstcorp.org/browse/DM-11507

Got it in one.

[Calm ~] which sed
/sw/bin/sed
[Calm ~] uname && sed --version
Darwin
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

Yes, I use Fink as the package manager on my laptop. In a few more years that will qualify as “retro hip”.

This issue has been fixed on DM-11507.