Bug 828987 - Cannot pass SSH_AUTH_SOCK into mock scm commands
Cannot pass SSH_AUTH_SOCK into mock scm commands
Product: Fedora EPEL
Classification: Fedora
Component: mock (Show other bugs)
Unspecified Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-06-05 13:33 EDT by Max Romanov
Modified: 2012-06-09 11:10 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-08 03:56:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Configure environment from command line (2.21 KB, text/plain)
2012-06-05 13:33 EDT, Max Romanov
no flags Details

  None (edit)
Description Max Romanov 2012-06-05 13:33:28 EDT
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):


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"
$ ssh svn pwd
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
Comment 1 Marko Myllynen 2012-06-06 03:29:22 EDT
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?
Comment 2 Max Romanov 2012-06-06 05:54:01 EDT
Argee, the workaround with link have almost same complexity, as passing the value in command line.

Thank you, Marko!
Comment 3 Marko Myllynen 2012-06-08 03:56:32 EDT
Ok, glad to hear it works, closing.
Comment 4 Clark Williams 2012-06-09 11:10:56 EDT
Marko, sorry I missed this, but I agree completely

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