Skip to content

Conversation

Schamper
Copy link
Collaborator

@Schamper Schamper commented Apr 29, 2025

As discussed in #1230.

Adds the -pluginFiles argument to both VM-Install-IDA-Plugin and VM-Uninstall-IDA-Plugin to more finely manage the installed plugin files. This allows for more flexible plugin packages without having to make a custom chocolateyInstall.ps1 for those.

Currently a bunch of plugins will fail to reinstall after an uninstall because of leftover files (a reinstall will complain about already existing files), so if this gets merged we probably want to update those plugins with this argument.

Updated ida.plugin.dereferencing.vm as example with this.

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @Schamper! 💐 can you please increase the version in the nuspec of common.vm.nuspec as explained in our documentation? We need increase the version, otherwise the existent version from MyGet is still used. The linter is complaining about it. 😉

I'll review the rest thoughtfully next week, I am sorry but I won't have time this week.

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work and for increasing the version of common 😄

description: |
SHA256 hash of the file or ZIP downloaded from the download url introduced in the previous field. The hash is used for verification purposes. Example: `62af5cce80dbbf5cdf961ec9515549334a2112056d4168fced75c892c24baa95`
- type: input
id: files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Schamper are you aiming for this field to be used by our automation? Have you tested the GH action new_package.yml with this change? I think it does not work, as we are using template-path: .github/ISSUE_TEMPLATE/new_package.yml to parse the issue and I think fields not included there are ignored.

attributes:
label: Files to copy
description: |
A comma separated list of files and/or directories to copy into the plugin directory. Only necessary for plugins with awkward repository layouts. Example: `awkward_directory/awesomeplugin.py, `awkward_directory/awesomeplugin_libs`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] I think it would be better to use an real example instead of awkward_directory/awesomeplugin.py.

$pluginName = 'dereferencing.py'
$pluginUrl = 'https://github.com/danigargu/deREferencing/archive/ab106c1fa5969a5d7c27c8037b4aec446ad55a4d.zip'
$pluginSha256 = '83c0f9420075dbe5217f5fbf2413c7b1b72eadfaedfe2474b306e1e3eaae0aa8'
$pluginFiles = @('dereferencing', 'dereferencing.py')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bad example to use the $pluginFiles argument as this plugin is installed correctly with the default behavior and this change unnecessarily complicates the code. What about removing this change and run scripts/utils/create_package_template.py to create the IDA plugin ida.plugin.hexrayspytools.vm so that we can test the new argument with an IDA plugin that needs it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails to uninstall correctly though, how do you propose to deal with that? I figured consistency between installation/uninstallation is more important than the "magicness" of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does dereferencing fails to uninstall with the current implementation? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well technically it doesn't fail, but it doesn't properly uninstall, since it will only remove dereferencing.py:

The dereferencing module folder will remain: https://github.com/danigargu/deREferencing/tree/259685bce8ab4ba0371ec6d13446cc553df2689b/dereferencing

Trying to reinstall the deferencing plugin will then fail because that folder already exists.

Comment on lines +253 to +254
$pluginFiles = @({files})
VM-Uninstall-IDA-Plugin -pluginName $pluginName -pluginFiles $pluginFiles
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like that we know always use the pluginFiles argument even if it is not needed. I think this complicates the code for the default case making it also confusing. What about adding an if to check if files is empty in create_ida_plugin_template and having two different templates (the previous one and the purposed one)?

del args.type

# fixup the files argument
args.files = ", ".join(repr(name.strip()) for name in args.files.split(","))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails if files is not provided (it is not required). I purpose to move this code inside create_ida_plugin_template (after checking if files is empty) as it is only used by that function.

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

Successfully merging this pull request may close these issues.

2 participants