Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 666732 - dev-lang/spidermonkey-60.5.2_p0-r1 - Exception: Could not detect environment shell!
Summary: dev-lang/spidermonkey-60.5.2_p0-r1 - Exception: Could not detect environment ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CVE-2018-1116
  Show dependency tree
 
Reported: 2018-09-21 22:19 UTC by Alexey Korepanov
Modified: 2019-05-02 20:09 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (emerge.build.log,16.99 KB, text/x-log)
2018-09-21 22:20 UTC, Alexey Korepanov
Details
emerge --info (emerge.info,5.35 KB, text/plain)
2018-09-21 22:21 UTC, Alexey Korepanov
Details
emerge -pqv (emerge.pqv,137 bytes, text/plain)
2018-09-21 22:21 UTC, Alexey Korepanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Korepanov 2018-09-21 22:19:38 UTC
Hi. I am compiling in and aarch64 qemu chroot, if that matters. Configuration fails with

Creating config.status
Traceback (most recent call last):
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/js/src/../../configure.py", line 107, in <module>
    sys.exit(main(sys.argv))
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/js/src/../../configure.py", line 31, in main
    return config_status(config)
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/js/src/../../configure.py", line 92, in config_status
    from mozbuild.config_status import config_status
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/build/mach_bootstrap.py", line 370, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/python/mozbuild/mozbuild/config_status.py", line 21, in <module>
    from mozbuild.base import MachCommandConditions
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/build/mach_bootstrap.py", line 370, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/python/mozbuild/mozbuild/base.py", line 17, in <module>
    from mach.mixin.process import ProcessExecutionMixin
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/build/mach_bootstrap.py", line 370, in __call__
    module = self._original_import(name, globals, locals, fromlist, level)
  File "/var/tmp/portage/dev-lang/spidermonkey-52.9.1_pre1/work/mozjs-52.9.1pre1/python/mach/mach/mixin/process.py", line 29, in <module>
    raise Exception('Could not detect environment shell!')
Exception: Could not detect environment shell!

The environment variable SHELL is set to /bin/bash.
Comment 1 Alexey Korepanov 2018-09-21 22:20:21 UTC
Created attachment 547506 [details]
build.log
Comment 2 Alexey Korepanov 2018-09-21 22:21:07 UTC
Created attachment 547508 [details]
emerge --info
Comment 3 Alexey Korepanov 2018-09-21 22:21:53 UTC
Created attachment 547510 [details]
emerge -pqv
Comment 4 Alexey Korepanov 2018-09-21 22:34:28 UTC
Runnning `export SHELL=/bin/bash` before emerge fixes this. But shouldn't this be somehow automatic?
Comment 5 Matt Turner gentoo-dev 2018-11-16 19:08:28 UTC
To be clear: I see this on amd64, so it does not seem to be architecture specific.
Comment 6 David W Noon 2018-11-16 20:44:11 UTC
This problem occurs on Firefoz and Thunderbird too. It seems many of the Mozilla written packages start their builds by deleting akk the environment variables to "cleanse" the build environment.

I normally fix it ny putting an export command in the pkg_setup() function of the ebuild and then recalculating the manifest.
Comment 7 Larry the Git Cow gentoo-dev 2018-11-17 16:52:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5457e2f4fb34e39402ce387a67788022ef53d414

commit 5457e2f4fb34e39402ce387a67788022ef53d414
Author:     Ian Stakenvicius <axs@gentoo.org>
AuthorDate: 2018-11-17 15:57:20 +0000
Commit:     Ian Stakenvicius <axs@gentoo.org>
CommitDate: 2018-11-17 16:51:29 +0000

    dev-lang/spidermonkey: fix SHELL every way possible
    
    The changes in this commit are overkill, but with v60 built using mach
    there isn't any form of precedent to set with this code, and ensuring
    these assignments occur will squash this bug once and for all no matter
    how it manifests.
    
    Bug: https://bugs.gentoo.org/666732
    Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
    Package-Manager: Portage-2.3.49, Repoman-2.3.11

 dev-lang/spidermonkey/spidermonkey-52.9.1_pre1.ebuild | 5 +++++
 1 file changed, 5 insertions(+)
Comment 8 Ian Stakenvicius gentoo-dev 2018-11-22 20:37:21 UTC
If any of you could try to reproduce this bug but find you can't, please let me know and I'll consider it finally closed.
Comment 9 Ian Stakenvicius gentoo-dev 2019-03-07 18:14:12 UTC
timeout, assume fixed; please reopen or file a new bug if not fixed.
Comment 10 Bernd Feige 2019-03-22 08:41:46 UTC
I've now been bitten by this as well, trying to compile dev-lang/spidermonkey-60.5.2_p0-r1 from a chroot environment (systemd-nspawn actually).

I checked that really by default SHELL is unset in the chroot, and then this error occurs despite these provisions.

If I edit the environment file and replace
 declare -- SHELL=...
by
 declare -x SHELL=...

configuration will succeed. Probably it's necessary to do it like debian:
 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876354
and export SHELL in the global environment.
Comment 11 Alexey Korepanov 2019-04-01 06:32:16 UTC
Sorry for the lack of feedback, I have been rather busy with life.

I also still have this problem, now with with dev-lang/spidermonkey-60.5.2_p0-r1.

I will try to reopen this bug now.
Comment 12 William 2019-04-02 12:30:17 UTC
Same here, not in a chroot but with mksh as sh:

> eselect sh list
Available POSIX shell implementations:
  [1]   bash
  [2]   dash
  [3]   mksh *
Comment 13 Matt Turner gentoo-dev 2019-04-24 21:13:05 UTC
Happened again to me on dev-lang/spidermonkey-60.5.2_p0-r1.
Comment 14 Matt Turner gentoo-dev 2019-04-24 22:22:32 UTC
From configure:

> Ignoring --build : Unknown option
> Ignoring --mandir : Unknown option
> Ignoring --infodir : Unknown option
> Ignoring --sysconfdir : Unknown option
> Ignoring --localstatedir : Unknown option
> Ignoring SHELL : Unknown option
> Ignoring AR : Unknown option
> Ignoring RANLIB : Unknown option

Seems like something's not working right at least.

Looks like the code in mozjs-60.5.2/python/mach/mach/mixin/process.py that fails is:

# Perform detection of operating system environment. This is used by command
# execution. We only do this once to save redundancy. Yes, this can fail module
# loading. That is arguably OK.
if 'SHELL' in os.environ:
    _current_shell = os.environ['SHELL']
elif 'MOZILLABUILD' in os.environ:
    _current_shell = os.environ['MOZILLABUILD'] + '/msys/bin/sh.exe'
elif 'COMSPEC' in os.environ:
    _current_shell = os.environ['COMSPEC']
else:
    raise Exception('Could not detect environment shell!')

Certainly looks like it depends on SHELL being set properly.
Comment 15 Matt Turner gentoo-dev 2019-04-24 22:44:25 UTC
(In reply to Bernd Feige from comment #10)
> I've now been bitten by this as well, trying to compile
> dev-lang/spidermonkey-60.5.2_p0-r1 from a chroot environment (systemd-nspawn
> actually).
> 
> I checked that really by default SHELL is unset in the chroot, and then this
> error occurs despite these provisions.

I think this is it. When I try to emerge spidermonkey in an nspawn container with sometheing like 

> systemd-run --pty --machine hsw /usr/bin/emerge -1 spidermonkey

configure fails.

When I just run

> /usr/bin/emerge -1 spidermonkey

from a shell inside the container (that is, after running machinectl shell hsw) it works.

I'm thinking SHELL is unset in the first case but not the second *and* the ebuild is setting SHELL in such a way that it's ignored.
Comment 16 Ian Stakenvicius gentoo-dev 2019-04-25 14:36:59 UTC
(In reply to Matt Turner from comment #14)
> From configure:
> 
> > Ignoring --build : Unknown option
> > Ignoring --mandir : Unknown option
> > Ignoring --infodir : Unknown option
> > Ignoring --sysconfdir : Unknown option
> > Ignoring --localstatedir : Unknown option
> > Ignoring SHELL : Unknown option
> > Ignoring AR : Unknown option
> > Ignoring RANLIB : Unknown option
> 
> Seems like something's not working right at least.
> 
> Looks like the code in mozjs-60.5.2/python/mach/mach/mixin/process.py that
> fails is:
> 
> # Perform detection of operating system environment. This is used by command
> # execution. We only do this once to save redundancy. Yes, this can fail
> module
> # loading. That is arguably OK.
> if 'SHELL' in os.environ:
>     _current_shell = os.environ['SHELL']
> elif 'MOZILLABUILD' in os.environ:
>     _current_shell = os.environ['MOZILLABUILD'] + '/msys/bin/sh.exe'
> elif 'COMSPEC' in os.environ:
>     _current_shell = os.environ['COMSPEC']
> else:
>     raise Exception('Could not detect environment shell!')
> 
> Certainly looks like it depends on SHELL being set properly.

...but apparently not via commandline to the now python-based configure script, the way these things are supposed to work.  OK, I can work with this.
Comment 17 Larry the Git Cow gentoo-dev 2019-04-26 16:59:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=162e8a929b04e5d7f00308afb6616e89c3ae6ed2

commit 162e8a929b04e5d7f00308afb6616e89c3ae6ed2
Author:     Ian Stakenvicius <axs@gentoo.org>
AuthorDate: 2019-04-26 13:47:26 +0000
Commit:     Ian Stakenvicius <axs@gentoo.org>
CommitDate: 2019-04-26 16:58:24 +0000

    dev-lang/spidermonkey: use CONFIG_SHELL instead of SHELL
    
    Closes: https://bugs.gentoo.org/666732
    Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
    Package-Manager: Portage-2.3.62, Repoman-2.3.11

 dev-lang/spidermonkey/spidermonkey-60.5.2_p0-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 18 Arfrever Frehtes Taifersar Arahesis 2019-04-26 19:25:29 UTC
Not fixed.
Simply run the following command to reproduce problem:
env -u SHELL ebuild spidermonkey-60.5.2_p0-r1.ebuild configure
Comment 19 David Heidelberg (okias) 2019-04-30 17:16:35 UTC
with ZSH I getting: 
checking for autoconf... /usr/bin/autoconf-2.13
Refreshing /var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/js/src/old-configure with /usr/bin/autoconf-2.13
/usr/bin/autoconf-2.13:132: read-only variable: status
Traceback (most recent call last):
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/js/src/../../configure.py", line 127, in <module>
    sys.exit(main(sys.argv))
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/js/src/../../configure.py", line 29, in main
    sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/configure/__init__.py", line 428, in run
    func(*args)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/configure/__init__.py", line 474, in _value_for
    return self._value_for_depends(obj, need_help_dependency)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/util.py", line 944, in method_call
    cache[args] = self.func(instance, *args)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/configure/__init__.py", line 483, in _value_for_depends
    return obj.result(need_help_dependency)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/util.py", line 944, in method_call
    cache[args] = self.func(instance, *args)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/configure/__init__.py", line 123, in result
    return self._func(*resolved_args)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/python/mozbuild/mozbuild/configure/__init__.py", line 1003, in wrapped
    return new_func(*args, **kwargs)
  File "/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/build/moz.configure/old.configure", line 110, in prepare_configure
    old_configure + '.in'])
  File "/usr/lib64/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'/bin/zsh', u'/usr/bin/autoconf-2.13', u'--localdir=/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/js/src', u'/var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/js/src/old-configure.in']' returned non-zero exit status 1

!!! Please attach the following file when seeking support:
!!! /var/tmp/notmpfs/portage/dev-lang/spidermonkey-60.5.2_p0-r1/work/mozjs-60.5.2/jsobj/config.log
 * ERROR: dev-lang/spidermonkey-60.5.2_p0-r1::gentoo failed (configure phase):
 *   econf failed
```
Comment 20 Jory A. Pratt gentoo-dev 2019-04-30 18:55:23 UTC
-r2 has been pushed which reverts shell to previous behaviour we have in Gentoo. Thanks for reporting.
Comment 21 Matt Turner gentoo-dev 2019-05-01 05:46:12 UTC
(In reply to Jory A. Pratt from comment #20)
> -r2 has been pushed which reverts shell to previous behaviour we have in
> Gentoo. Thanks for reporting.

Unfortunately, still not fixed. See comment #18.

 (In reply to Arfrever Frehtes Taifersar Arahesis from comment #18)
> Not fixed.
> Simply run the following command to reproduce problem:
> env -u SHELL ebuild spidermonkey-60.5.2_p0-r1.ebuild configure
Comment 22 William 2019-05-01 08:53:12 UTC
same here, running into this bug again, whatever I set sh to.
Comment 23 Larry the Git Cow gentoo-dev 2019-05-02 19:05:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f76b0c8f379e33fd0c75bfb77649cfdd6b73d13a

commit f76b0c8f379e33fd0c75bfb77649cfdd6b73d13a
Author:     Ian Stakenvicius <axs@gentoo.org>
AuthorDate: 2019-05-02 19:04:32 +0000
Commit:     Ian Stakenvicius <axs@gentoo.org>
CommitDate: 2019-05-02 19:05:10 +0000

    dev-lang/spidermonkey:60 set both SHELL and CONFIG_SHELL to bash
    
    Ensure the requirement of bash for shell is satisfied in the environment
    and build system once and for all.
    
    Closes: https://bugs.gentoo.org/666732
    Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
    Package-Manager: Portage-2.3.62, Repoman-2.3.11

 dev-lang/spidermonkey/spidermonkey-60.5.2_p0-r2.ebuild | 1 +
 1 file changed, 1 insertion(+)
Comment 24 Matt Turner gentoo-dev 2019-05-02 20:09:12 UTC
Thanks! I can confirm that this is finally fixed.