Created attachment 589593 [details] Configure environment from command line Description of problem: Using mock + scm under RHEL5 with EPEL, it is impossible to pass environment variable SSH_AUTH_SOCK to scm command execution environment. Solution of bug 803217 is not working because usermode package in RHEL5 is too old to understand KEEP_ENV_VARS option. Version-Release number of selected component (if applicable): mock-1.0.29-1.el5 usermode-1.88-3.el5.2 How reproducible: Steps to Reproduce: 1. Configure SVN using SSH: ... config_opts['scm_opts']['method'] = 'svn' config_opts['scm_opts']['svn_get'] = "svn co svn+ssh://svn/svnroot/SCM_PKG" ... 2. Ensure SSH_AUTH_SOCK is set and connection to svn host can be established: $ echo "$SSH_AUTH_SOCK" /tmp/ssh-jlTbf12545/agent.12545 $ ssh svn pwd /home/max 3. start mock $ mock -v --scm-enable DEBUG: Initializing SCM integration... DEBUG: SCM checkout command: svn co svn+ssh://svn/svnroot/package DEBUG: SCM checkout post command: None DEBUG: SCM checkout directory: /tmp/tmpKX0Mm-.mock-scm.package DEBUG: Executing command: ['svn co svn+ssh://svn/svnroot/package'] with env {'LANG': 'en_US.UTF-8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'CVS_RSH': 'ssh', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'HOME': '/home/max', 'HOSTNAME': 'mock', 'SSH_AUTH_SOCK': '/home/max/.ssh/auth_sock'} DEBUG: svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file. DEBUG: svn: Network connection closed unexpectedly DEBUG: Child returncode was: 1 ERROR: Command failed. See logs for output. # ['svn co svn+ssh://svn/svnroot/package'] Actual results: Command environment includes 'SSH_AUTH_SOCK': '/home/max/.ssh/auth_sock' Expected results: 'SSH_AUTH_SOCK': '/tmp/ssh-jlTbf12545/agent.12545' Additional info: Attached patch to add an ability to configure environment variables using command-line switch --environment. The main use case is to pass SSH_AUTH_SOCK value when usermode package is too old to understand KEEP_ENV_VARS option: --environment SSH_AUTH_SOCK=$SSH_AUTH_SOCK
Perhaps you noticed already, you can workaround the usermode.el5 limitation by creating the ~/.ssh/auth_sock link (perhaps in a shell alias/function to "automate" it): $ ln -sf $SSH_AUTH_SOCK ~/.ssh/auth_sock $ mock -v --scm-enable ... Although this requires one extra step I'm not sure the patch would make things notably easier. Also, allowing users to pass arbitrary environment variables might have implications. Clark, what do you think?
Argee, the workaround with link have almost same complexity, as passing the value in command line. Thank you, Marko!
Ok, glad to hear it works, closing.
Marko, sorry I missed this, but I agree completely