Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1305765 - windows oc cli doesn't use home env variable as home directory
windows oc cli doesn't use home env variable as home directory
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.1.0
All Windows
unspecified Severity medium
: ---
: ---
Assigned To: Fabiano Franz
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-09 03:00 EST by Christophe Augello
Modified: 2016-05-12 12:28 EDT (History)
8 users (show)

See Also:
Fixed In Version: atomic-openshift-3.1.1.905-1.git.0.ef5902f.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-12 12:28:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1064 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 3.2 security, bug fix, and enhancement update 2016-05-12 16:19:17 EDT

  None (edit)
Description Christophe Augello 2016-02-09 03:00:32 EST
Description of problem:
Since oc 3.1.1.6 windows oc cli seems to use homeDrive + homePath to define the user's home directory. before 3.1.1.6 oc kubeconfig was written in directory from HOME env variable.

Version-Release number of selected component (if applicable):
oc cli 3.1.1.6

How reproducible:


Steps to Reproduce:
1. Have homeDrive != actual home drive (Z:\ vs C:\

Actual results:
C:\Users\XXXX>oc version
oc v3.1.1.6
kubernetes v1.1.0-origin-1107-g4c8e6f4

C:\Users\XXXX>oc whoami
error: open Z:\/.kube/config: The system cannot find the path specified.

C:\Users\XXXX>env | grep HOMEDRIVE
HOMEDRIVE=Z:

C:\Users\SHJN2064>env | grep HOME
HOME=/c/Users/XXXX

Expected results:
If HOME is set, use home prior to homeDrive + homePath

Additional info:
Comment 1 Fabiano Franz 2016-02-11 15:58:16 EST
We have to be careful about relying in the HOME env var on Windows because in many cases it is set to the wrong location, we've seen for example HOME=/c in a few cases. 

The recommended way of doing it is to first try HOMEDRIVE + HOMEPATH and then fallback to USERPROFILE, which is what we are doing[1]. We could add a check for the existence of these two locations, and add HOME as a third location which would be used if any of the other two options are available as env vars and/or path doesn't actually exist.

Could you please confirm what you have in USERPROFILE? 

[1] References
https://support.microsoft.com/en-us/kb/100843
http://blogs.msdn.com/b/patricka/archive/2010/03/18/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions.aspx
Comment 2 Fabiano Franz 2016-02-19 12:24:34 EST
Fixed in https://github.com/openshift/origin/pull/7449
Comment 3 Yanping Zhang 2016-02-22 00:00:35 EST
The fix works on latest origin client oc v1.1.3-170-g14b50fd, but the codes are not merged in enterprise, so still can reproduce the bug on the latest oc v3.1.1.904, wait for a puddle containing the fix to verify the bug.
Comment 4 Christophe Augello 2016-02-22 07:15:39 EST
@Fabian

USERPROFILE=C:\Users\XXXX

Could we implement in https://github.com/openshift/origin/pull/7449 in downstream?
Comment 5 Fabiano Franz 2016-02-22 12:37:30 EST
Christophe yes, it's coming downstream soon.
Comment 6 Yanping Zhang 2016-02-22 21:35:37 EST
Tested on v3.1.1.905
Steps to verify:
1.1
$ export HOMEDRIVE=Z:
1.2.
$ env|grep HOME
HOMEPATH=\Users\oppenshift
HOME=/c/Users/oppenshift
HOMEDRIVE=Z:
1.3.
$ ./oc.exe whoami
yanpzhan
2.1
$ env|grep HOME
HOMEPATH=\Users\oppenshift
HOME=/z/Users/oppenshift
HOMEDRIVE=C:
2.2 
$ ./oc.exe whoami
yanpzhan

The bug has been fixed on v3.1.1.905, so move it to Verified.
Comment 9 errata-xmlrpc 2016-05-12 12:28:30 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2016:1064

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