Skip to content
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

ag doesn't work correctly through wrapper #76

Closed
cbilson opened this issue Sep 4, 2014 · 7 comments
Closed

ag doesn't work correctly through wrapper #76

cbilson opened this issue Sep 4, 2014 · 7 comments

Comments

@cbilson
Copy link

cbilson commented Sep 4, 2014

At some point in the past year or so, Chocolatey was changed to generate wrapper exe's for tools. So, for example, when I install the ag package, I get a little ag.exe in $env:ChocolateyInstall\bin, which is in my path. This wrapper exe just spawns the real tool in $env:Chocolatey\lib\ag.v\tools.

If I say ag 'The Silver Searcher' using the wrapper, I get errors:

ERR: Error opening directory Silver: No such file or directory
ERR: Error opening directory Searcher: No such file or directory

If I say the same thing to the lib\ag.v\tools version of ag.exe, it works fine.

I am pretty sure this is due to the wrapper exe. I don't know if there is a way to tell chocolatey you don't want a wrapper exe, or much of anything else about the details of why this happens. I remember running into this with a package I tried to build and abandoned.

If I get some time I might look into this. If I find anything, I will update this. I just wanted to make you aware of the problem and maybe if anyone else finds it, they won't think they are crazy like I did for about 20 minutes.

@ferventcoder
Copy link

@cbilson Can you try the following for me?

ag --shimgen-log 

@ferventcoder
Copy link

There are other parameters you can pass to shimgen generated executables as well - chocolatey-archive/chocolatey#509

@ferventcoder
Copy link

@cbilson Actually, what version of chocolatey are you using? There was an issue in some earlier releases (0.9.8.24-.26) with shimgen stuff that has been resolved in the more recent version.

FYI, I installed ag and then in powershell:

ag --shimgen-log 'The Silver Searcher'

C:\codelocal\chocolatey.org >ag --shimgen-log 'The Silver Searcher'
[shim]: Set up Shim to run with the following parameters:
  path to executable: C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe
  working directory: C:\codelocal\chocolatey.org
  is gui? False
  wait for exit? True
  command (optional):
[shim]: Removing any shimgen specific args
[shim]: Quoting args with spaces
[shim]: Quoted 'The Silver Searcher'
[shim]: Arguments are '"The Silver Searcher"'
[shim]: Calling 'C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe "The Silver Searcher"'
[shim]: Exiting with '0'.

On cmd.exe I get the following:

C:\codelocal\chocolatey.org>ag --shimgen-log 'The Silver Searcher'
[shim]: Set up Shim to run with the following parameters:
  path to executable: C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe
  working directory: C:\codelocal\chocolatey.org
  is gui? False
  wait for exit? True
  command (optional):
[shim]: Removing any shimgen specific args
[shim]: Quoting args with spaces
[shim]: Arguments are ''The Silver Searcher''
[shim]: Calling 'C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe 'The Silver Searcher''
ERR: Error opening directory Silver: No such file or directory
ERR: Error opening directory Searcher': No such file or directory
[shim]: Exiting with '0'.

It seems like there may be an issue here.

@cbilson
Copy link
Author

cbilson commented Sep 6, 2014

This actually only happens on my work computer, which uses an "official" company version of chocolatey:

PS1> choco -v
Please run chocolatey /? or chocolatey help - chocolatey v0.9.8.23-nuget28hf1
Reading environment variables from registry. Please wait... Done.

I tried using ag from this machine and adding the --shimgen-log argument, but it looks like maybe that's ignored or passed on to ag?

PS1> C:\Chocolatey\bin\ag.exe --shimgen-log 'foo bar'

Usage: ag [OPTIONS] PATTERN [PATH]

Recursively search for PATTERN in PATH.
Like grep or ack, but faster.

Example:
ag -i foo /bar/

Output Options:
--ackmate Print results in AckMate-parseable format
...

Last night I verified that there is no problem on the newer version of chocolatey that my laptop has.

Date: Thu, 4 Sep 2014 15:58:43 -0700
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [chocolateypackages] ag doesn't work correctly through wrapper (#76)

@cbilson Actually, what version of chocolatey are you using? There was an issue in some earlier releases (0.9.8.24-.26) with shimgen stuff that has been resolved in the more recent version.

FYI, I installed ag and then in powershell:

ag --shimgen-log 'The Silver Searcher'

C:\codelocal\chocolatey.org >ag --shimgen-log 'The Silver Searcher'
[shim]: Set up Shim to run with the following parameters:
path to executable: C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe
working directory: C:\codelocal\chocolatey.org
is gui? False
wait for exit? True
command (optional):
[shim]: Removing any shimgen specific args
[shim]: Quoting args with spaces

[shim]: Arguments are '"The Silver Searcher"'

[shim]: Exiting with '0'.

On cmd.exe I get the following:

C:\codelocal\chocolatey.org>ag --shimgen-log 'The Silver Searcher'
[shim]: Set up Shim to run with the following parameters:
path to executable: C:\ProgramData\Chocolatey\lib\ag.0.18.1\tools\ag.exe
working directory: C:\codelocal\chocolatey.org
is gui? False
wait for exit? True
command (optional):
[shim]: Removing any shimgen specific args
[shim]: Quoting args with spaces
[shim]: Arguments are ''The Silver Searcher''

ERR: Error opening directory Silver: No such file or directory
ERR: Error opening directory Searcher': No such file or directory
[shim]: Exiting with '0'.

It seems like there may be an issue here.


Reply to this email directly or view it on GitHub. =

@ferventcoder
Copy link

It could be the older batch redirect (creates a .bat and a no extension format), depending on what you were using (bash, cmd, or powershell) has issues where the newer shimgen one (which creates an exe shim) does not. The shimgen was first introduced in 0.9.8.24.

@ferventcoder
Copy link

I tried using ag from this machine and adding the --shimgen-log argument, but it looks like maybe that's ignored or passed on to ag?

Shimgen args would only be available when the shimgen is being used (0.9.8.24+).

@ferventcoder
Copy link

At this point I'd almost want to mark this as a non-issue since it affects older versions of chocolatey and is fixed in newer versions. Would you agree @cbilson ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants