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

Compilation error when selecting default v2/Autohotkey.exe interpreter #132

Closed
RaptorX opened this issue Aug 1, 2022 · 6 comments
Closed

Comments

@RaptorX
Copy link
Contributor

RaptorX commented Aug 1, 2022

Issue Type: Bug

Steps

  • Select the default interpreter for autohotkey v2 (v2/Autohotkey.exe)
  • Use the hotkey to compile

Result

image

image

Expected

Script should be compiled

Notes

image

The problem is that the default instalation uses a symlink for the file instead of a copy of it and AHK2Exe doesnt resolve the link prior to tyring to compile

Possible solution

Manually resolve the symlink before passing it to AHK2Exe while I report the bug to the developer


Extension version: 1.4.9
VS Code version: Code 1.69.2 (3b889b090b5ad5793f524b5d1d39fda662b96a2a, 2022-07-18T16:12:52.460Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3198)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.91GB (23.28GB free)
Process Argv
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
pylanb8912:30529769
vsclangdc:30486549
c4g48928:30535728

@thqby
Copy link
Owner

thqby commented Aug 1, 2022

This bug is not caused by symlink, but because ahk2exe excludes autohotkey.exe

@thqby thqby closed this as completed Aug 1, 2022
@RaptorX
Copy link
Contributor Author

RaptorX commented Aug 2, 2022

Couldnt you resolve the path before sending the arguments to ahk2exe?

ahk2exe doesnt exclude autohotkey.exe because I can use Autohotkey.exe in v1 to compile scripts just fine.
The problem is that in v2 Autohotkey.exe is a symlink (a special type of shortcut), not a real file and ahk2exe doesn't resolve the path to the actual file.

@thqby
Copy link
Owner

thqby commented Aug 2, 2022

I have verified that symlink can compile normally without resolving to the source file path.

https://github.com/AutoHotkey/Ahk2Exe/blob/master/Ahk2Exe.ahk#L297
The file named AutoHotkey.exe in this line will be skipped.

@RaptorX
Copy link
Contributor Author

RaptorX commented Aug 3, 2022

I have verified that symlink can compile normally without resolving to the source file path.

https://github.com/AutoHotkey/Ahk2Exe/blob/master/Ahk2Exe.ahk#L297 The file named AutoHotkey.exe in this line will be skipped.

I think is exactly the other way around:
if the file is NOT .bin, Autohotkey.exe or Ahk2Exe.exe then it will be skipped.

the condition is:

if !(regex)

image

So, if your lexer is calling AHK2Exe by passing Autohotkey.exe (which is what I think is doing) it should work just fine, the problem is that v2\Autohotkey.exe is not an actual file and when AHK2Exe tries to use it to compile it fails.

Thats because it is actually a shortcut to Autohotkey64.exe in my case, but is not being resolved.


This is not a problem directly with your lexer though, I think this is on AHK2Exe's side, but I think, as a workaround your lexer might check if the file is a shortcut and resolve it before passing it to the compiler while they fix that, because I dont think they will fix it for now.

@thqby
Copy link
Owner

thqby commented Aug 3, 2022

I think is exactly the other way around:
if the file is NOT .bin, Autohotkey.exe or Ahk2Exe.exe then it will be skipped.
The correct regular expression is i)^AutoHotkey.*\.exe$ instead of i)^AutoHotkey.+\.exe$.
There is no simple way to identify hard link.

@Lexikos
Copy link

Lexikos commented Aug 6, 2022

I had a feeling I had already brought this up with @TAC109. It was actually about a different requirement put into effect the same way, with a similar unwanted side-effect.

AutoHotkey/Ahk2Exe#90
The restriction is neither necessary nor helpful when the user is explicitly selecting a specific file as base. It is probably a side-effect of code sharing and not specifically intended to apply to this situation.

I think the loop is used primarily to build the list of binary files for the GUI. The exclusion of AutoHotkey.exe is likely intended to eliminate a redundant option from the GUI, but it also has the unwanted effect of falsely claiming that the file is an invalid base. If the user (or parent process) explicitly specifies a file, it should not matter what the file is named.

There is no simple way to identify hard link.

It's a symbolic link, not a hard link. Still, this should be fixed in Ahk2Exe.

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