After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771143 - create-project: Guard against invalid project names
create-project: Guard against invalid project names
Status: RESOLVED OBSOLETE
Product: gnome-builder
Classification: Other
Component: general
3.21.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-10 01:26 UTC by Mohammed Sadiq
Modified: 2018-01-11 10:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
create-project: improve name validation (2.28 KB, patch)
2016-09-10 02:47 UTC, Christian Hergert
committed Details | Review
Guard against projects named 'test' (890 bytes, patch)
2017-08-20 20:32 UTC, Justin Michaud
reviewed Details | Review

Description Mohammed Sadiq 2016-09-10 01:26:39 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.
Comment 1 Christian Hergert 2016-09-10 02:47:30 UTC
Created attachment 335224 [details] [review]
create-project: improve name validation

Don't allow names starting with a digit, nor names containing whitespace.
Comment 2 Christian Hergert 2016-09-10 02:47:58 UTC
Thanks!

Attachment 335224 [details] pushed as 4cf83eb - create-project: improve name validation
Comment 3 Mohammed Sadiq 2016-09-10 03:04:13 UTC
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
Comment 4 Mohammed Sadiq 2016-09-10 03:07:31 UTC
This also means that non-ASCII project names can be invalid variable name in Autoconf scripts, say like 'ഗ്നു'
Comment 5 Mohammed Sadiq 2016-09-10 03:12:59 UTC
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.
Comment 6 Naman 2017-01-16 18:13:09 UTC
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?
Comment 7 Christian Hergert 2017-01-16 23:07:18 UTC
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.
Comment 8 Naman 2017-01-17 18:48:53 UTC
Ok, i will work on this bug but i think i will try an easier bug first to get familiar with gnome and builder.
Comment 9 Justin Michaud 2017-08-20 20:32:19 UTC
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.
Comment 10 Christian Hergert 2017-08-21 18:31:29 UTC
Review of attachment 358031 [details] [review]:

I think we should make the templates work with the name "test" rather than not allowing it.
Comment 11 GNOME Infrastructure Team 2018-01-11 10:09:38 UTC
-- 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.