[Github-comments] [geany] Proxy plugins (#629)

Colomban Wendling notifications at xxxxx
Fri Oct 2 21:44:44 UTC 2015


> @@ -830,25 +1011,80 @@ static gboolean check_plugin_path(const gchar *fname)
>  }
>  
>  
> +/* Retuns NULL if this ain't a plugin,
> + * otherwise it returns the appropriate PluginProxy instance to load it */
> +static PluginProxy* is_plugin(const gchar *file)
> +{
> +	GList *node;
> +	const gchar *ext;
> +
> +	/* extract file extension to avoid g_str_has_suffix() in the loop */
> +	ext = (const gchar *)strrchr(file, '.');
> +	if (ext == NULL)
> +		return FALSE;
> +	/* ensure the dot is really part of the filename */
> +	else if (strchr(ext, G_DIR_SEPARATOR) != NULL)
> +		return FALSE;

> BTW, this is always called with the result of g_build_filename() (either directly or via plugin->filename) so it's kind of guaranteed it's a canonical path.

Fair enough if it's the case.  Can't this change in the prefs? (e.g. if I manually alter the config file of the enabled plugin list)

> Actually, I'm preferring to leave it. We can't have paranoid checks everywhere, even in the deepest leaf functions. At some point we can/have to/should depend on earlier code to provide canonical paths, as is the case here.

Well, sure, if it's something we can totally rely on.  But that means we need to guarantee it -- and here it's not really a "deep function" in that it extract a very low level info (the extension) --, e.g. that we don't work on paths as the OS understands it, but on an internal representation.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/629/files#r41071009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20151002/d8e6f5cd/attachment.html>


More information about the Github-comments mailing list