GNOME Bugzilla – Bug 771143
create-project: Guard against invalid project names
Last modified: 2018-01-11 10:09:38 UTC
the project name is used as variables in Autoconf scripts without check. This can break build. Example for a breaking Project name: 2nd-project (which creates several variables beginning with '2', which is not a valid variable in Autoconf) This can be detected at project creation name, and don't allow user to use invalid names.
Created attachment 335224 [details] [review] create-project: improve name validation Don't allow names starting with a digit, nor names containing whitespace.
Thanks! Attachment 335224 [details] pushed as 4cf83eb - create-project: improve name validation
Sorry for not explaining it deep. Invalid variables include variables that contain on of '`~%$(){}|@!' and probably several other chars (not checked extensively). It may be better to think that character that doesn't belong to [a-zA-Z0-9_-] are invalid
This also means that non-ASCII project names can be invalid variable name in Autoconf scripts, say like 'ഗ്നു'
Another way to handle this may be by asking the user a separate ASCII name (which can be used internally, wherever required). As Unicode names are very common to projects, that shall be the better way to do this. But that requires a UI change.
hello, i am new to gnome-builder and would like to start contributing. So, wasn't this bug fixed in the commit 4cf83eb by Christian Hergert. Should i create a patch to not allow any characters other than [a-zA-Z0-9_-] as asked by Mohammed Sadiq?
Honestly, I'm not sure how much it is worth to push this forward. It's going to be project backend specific (so autotools vs meson vs cmake vs cargo, etc). So if we were to "correctly" fix the issue, we would need an Addin interface for project name validation that the different build system backends could implement.
Ok, i will work on this bug but i think i will try an easier bug first to get familiar with gnome and builder.
Created attachment 358031 [details] [review] Guard against projects named 'test' I ran into this while testing out builder, and so I thought it would make a good first bug fix.
Review of attachment 358031 [details] [review]: I think we should make the templates work with the name "test" rather than not allowing it.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-builder/issues/139.