Bug 1300686 - Environment variable not passed into mock chroot
Summary: Environment variable not passed into mock chroot
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 24
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-21 13:11 UTC by Jeroen Koekkoek
Modified: 2016-02-26 11:17 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-26 11:17:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jeroen Koekkoek 2016-01-21 13:11:43 UTC
Description of problem:
Environment variables exported by user are not imported into mock chroot even though the variable is assigned the same value as the current environment variable. Like so:

config_opts['environment']['VAR'] = os.environ['VAR']

This does work when running mock through sudo.

Version-Release number of selected component (if applicable):
1.2.14

How reproducible:
DOES NOT WORK:
export FOO=bar
mock --shell
echo $FOO (in shell)

DOES WORK:
export FOO=bar
sudo mock --shell
echo $FOO (in shell)
bar

Steps to Reproduce:
See above.

Comment 1 Jan Kurik 2016-02-24 15:44:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 2 Miroslav Suchý 2016-02-26 11:17:54 UTC
This is because /usr/bin/mock is in fact consolehelper which clean up environment and gain root right and execute /usr/sbin/mock.

As root you probably directly executed /usr/sbin/mock which is first in your path.
Note that there is already plan to change those paths in bug 1246810.

So if you want to preserve some variable, you can alter /etc/security/console.apps/mock and add to KEEP_ENV_VARS variables the list of variables you want to preserve.


Note You need to log in before you can comment on or make changes to this bug.