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 642452 - g_parse_debug_string(): support “all except these flags”
g_parse_debug_string(): support “all except these flags”
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-02-16 11:56 UTC by Will Thompson
Modified: 2011-10-25 00:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test g_parse_debug_string ("all") (945 bytes, patch)
2011-02-16 11:56 UTC, Will Thompson
none Details | Review
Test g_parse_debug_string with hyphens. (1.28 KB, patch)
2011-02-16 11:56 UTC, Will Thompson
none Details | Review
g_parse_debug_string(): support subtracting from "all" (3.29 KB, patch)
2011-02-16 11:56 UTC, Will Thompson
needs-work Details | Review
g_parse_debug_string: invert flags after "all" (3.71 KB, patch)
2011-05-05 17:38 UTC, Will Thompson
none Details | Review
g_parse_debug_string: invert flags given besides "all" (3.75 KB, patch)
2011-10-20 15:13 UTC, Will Thompson
none Details | Review

Description Will Thompson 2011-02-16 11:56:01 UTC
Today I found myself wanting to be able to set WOCKY_DEBUG="all -tls" to get all debugging output from Wocky, except for the TLS debugging output. Here's a branch improving the test coverage of g_parse_debug_string() slightly, then adding this feature: http://git.collabora.co.uk/?p=user/wjt/glib;a=shortlog;h=refs/heads/debug-strings
Comment 1 Will Thompson 2011-02-16 11:56:27 UTC
Created attachment 180987 [details] [review]
Test g_parse_debug_string ("all")
Comment 2 Will Thompson 2011-02-16 11:56:31 UTC
Created attachment 180988 [details] [review]
Test g_parse_debug_string with hyphens.
Comment 3 Will Thompson 2011-02-16 11:56:34 UTC
Created attachment 180989 [details] [review]
g_parse_debug_string(): support subtracting from "all"
Comment 4 Matthias Clasen 2011-02-16 12:40:19 UTC
Review of attachment 180989 [details] [review]:

I guess the idea is ok in principle, now that we have 'all'.

I don't really like the extra decoration with the prepended '-', 
in particular since we allow '-' inside key names as well. 

Would you be open to just interpreting the presence of 'all' as
meaning 'invert the remaining flags' ? Then 'all:foo:bar' could be
used to indicate 'all except for foo and bar'
Comment 5 Will Thompson 2011-05-05 17:34:33 UTC
That could work. Alternative patch coming up.

It's a little bit surprising that DEBUG="foo all" and DEBUG="all foo" mean two different things, but I doubt anyone will ever notice. Alternatively some other prefix could be used, maybe ‘~’ or ‘!’? (If only ‘¬’ was in ASCII I'd suggest using that, particularly since it's a key on the GB keyboard … ☺)
Comment 6 Will Thompson 2011-05-05 17:38:52 UTC
Created attachment 187305 [details] [review]
g_parse_debug_string: invert flags after "all"

Any flags specified after "all" are subtracted from the result, allowing
the user to specify FOO_DEBUG="all,bar,baz" to mean "give me debugging
information for everything except bar and baz".
Comment 7 Matthias Clasen 2011-05-07 18:07:39 UTC
I actually didn't envision this to be positional at all.
I thought all,foo would give you the same as foo,all: all options except for foo
Comment 8 Will Thompson 2011-10-20 15:13:40 UTC
Created attachment 199536 [details] [review]
g_parse_debug_string: invert flags given besides "all"

Any flags specified as well as "all" are subtracted from the result,
allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me
debugging information for everything except bar and baz".
Comment 9 Matthias Clasen 2011-10-25 00:39:06 UTC
Thanks, committed with a slight fixup for the testcase.