-
Notifications
You must be signed in to change notification settings - Fork 21
(maint) Inject CommonProgramFiles env var #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(maint) Inject CommonProgramFiles env var #113
Conversation
b9a2b0f
to
69dd837
Compare
step "Emit CommonProgramFiles environment variable" | ||
common_program_files = agent.get_env_var('ProgramFiles') + "\\Common Files" | ||
agent.add_env_var('CommonProgramFiles', common_program_files) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a workaround until we can test this module under something other than Cygwin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, then 👍. If the point of this is to keep feeding to the cygwin tax, let's not and instead invest in getting this working with non-cygwin templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cygwin tax @ferventcoder,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, we need a more generic solution to the missing env vars problem on Windows + Cygwin, but that's out of scope for now.
Also, I noticed this ticket is marked as maint - however I feel that it had quite a few hours of development put towards it, so let's create a JIRA ticket and add it to the sprint. |
69dd837
to
b5ca32e
Compare
- Cygwin environments notably omit a number of important Windows environment variables including: APPDATA CommonProgramFiles CommonProgramFiles(x86) LOCALAPPDATA ProgramData ProgramFiles(x86) ProgramW6432 PSModulePath - When using the ADODB.Connection COM object, the provider from the Connection String (in our case SQLOLEDB.1) is a ProgID that references another COM component for the implementation of connection library to SQL Server. Standard COM library resolution procedures apply when finding the DLL on disk to load. In the registry, the path to the InProcServer32 used for the library is listed as: %CommonProgramFiles%\System\Ole DB\sqloledb.dll Since the key is a REG_EXPAND_SZ, normal rules about env var expansion apply here. Interestingly, when running under a default Cygwin SSH session, since %CommonProgramFiles% is not captured in the environment, COM fails to load sqloledb.dll and the failure is propagated during the .Open("Provider=SQLOLEDB.1; ... ") call. Fix this issue by capturing the hosts %ProgramFiles% environment variable and appending "\Common Files" to it, which is how the pathing structure has always been. The solution here is a bit hacky. It would be better to launch a process that doesn't capture the Cygwin environment, echo the %CommonProgramFiles% environment variable and then inject that into our SSH session.
b5ca32e
to
c886193
Compare
…Files-env-var (maint) Inject CommonProgramFiles env var
Cygwin environments notably omit a number of important Windows
environment variables including:
APPDATA
CommonProgramFiles
CommonProgramFiles(x86)
LOCALAPPDATA
ProgramData
ProgramFiles(x86)
ProgramW6432
PSModulePath
When using the ADODB.Connection COM object, the provider from
the Connection String (in our case SQLOLEDB.1) is a ProgID
that references another COM component for the implementation
of connection library to SQL Server. Standard COM library
resolution procedures apply when finding the DLL on disk to
load. In the registry, the path to the InProcServer32 used
for the library is listed as:
%CommonProgramFiles%\System\Ole DB\sqloledb.dll
Since the key is a REG_EXPAND_SZ, normal rules about env var
expansion apply here.
Interestingly, when running under a default Cygwin SSH session,
since %CommonProgramFiles% is not captured in the environment,
COM fails to load sqloledb.dll and the failure is propagated
during the .Open("Provider=SQLOLEDB.1; ... ") call.
Fix this issue by capturing the hosts %ProgramFiles% environment
variable and appending "\Common Files" to it, which is how
the pathing structure has always been.
The solution here is a bit hacky. It would be better to
launch a process that doesn't capture the Cygwin environment,
echo the %CommonProgramFiles% environment variable and then
inject that into our SSH session.