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 732704 - Docs: various fixes and improvements
Docs: various fixes and improvements
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
2.41.x
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-07-03 18:11 UTC by Sébastien Wilmet
Modified: 2014-07-11 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
doc: improve doc of g_subprocess_wait() (1.11 KB, patch)
2014-07-03 18:11 UTC, Sébastien Wilmet
committed Details | Review
doc: possible error domains of GSubprocess (1.18 KB, patch)
2014-07-03 18:11 UTC, Sébastien Wilmet
none Details | Review
doc: improve doc of g_input_stream_read() (1.32 KB, patch)
2014-07-03 18:11 UTC, Sébastien Wilmet
committed Details | Review
doc: small improvement and fixes (2.36 KB, patch)
2014-07-03 18:12 UTC, Sébastien Wilmet
committed Details | Review

Description Sébastien Wilmet 2014-07-03 18:11:09 UTC
Here is another set of small documentation patches.
Comment 1 Sébastien Wilmet 2014-07-03 18:11:51 UTC
Created attachment 279859 [details] [review]
doc: improve doc of g_subprocess_wait()

When using this API, I wasn't sure what the cancellable does. I think
it's generally desirable to kill the subprocess if the wait operation is
cancelled, since in this case the application is no longer interested by
the subprocess.
Comment 2 Sébastien Wilmet 2014-07-03 18:11:54 UTC
Created attachment 279860 [details] [review]
doc: possible error domains of GSubprocess

AFAIK the two possible error domains are G_SPAWN_ERROR and
G_SPAWN_EXIT_ERROR (the latter is used when calling
g_spawn_check_exit_status(), which is done by g_subprocess_wait_check()
for example).

The documentation is added to the main description of GSubprocess, not
for each individual functions.
Comment 3 Sébastien Wilmet 2014-07-03 18:11:58 UTC
Created attachment 279861 [details] [review]
doc: improve doc of g_input_stream_read()

I recently needed to nul-terminate the returned buffer, and I wasn't
sure if g_input_stream_read() does that or not. I've checked
glocalfileinputstream.c, which calls read(2) which doesn't nul-terminate
the buffer. So I assume it's the same behavior for all GInputStream
subclasses.
Comment 4 Sébastien Wilmet 2014-07-03 18:12:01 UTC
Created attachment 279862 [details] [review]
doc: small improvement and fixes

- Add an example to g_strsplit(), like it is done for g_strsplit_set().

- GTK-Doc generates a list if a "1." is at the beginning of a line.
Comment 5 Allison Karlitskaya (desrt) 2014-07-04 14:34:46 UTC
Review of attachment 279859 [details] [review]:

thanks
Comment 6 Allison Karlitskaya (desrt) 2014-07-04 14:35:25 UTC
Review of attachment 279860 [details] [review]:

Why do you need to know this?

In your opinion, if we add this here now, are we then constrained from returning new types of errors in the future?
Comment 7 Allison Karlitskaya (desrt) 2014-07-04 14:36:04 UTC
Review of attachment 279861 [details] [review]:

Certainly doesn't hurt...
Comment 8 Allison Karlitskaya (desrt) 2014-07-04 14:37:38 UTC
Review of attachment 279862 [details] [review]:

Thanks.  Kinda sucks about the '1.' business...
Comment 9 Sébastien Wilmet 2014-07-04 15:01:10 UTC
Thanks for the quick review.

(In reply to comment #6)
> Review of attachment 279860 [details] [review]:
> 
> Why do you need to know this?

It's for printing a clearer error message for G_SPAWN_ERROR_NOENT. Instead of:

> Failed to execute child process "foobar" (No such file or directory)

I print:

> foobar doesn't seem to be installed.

But the error can also be useful to execute a fallback command, or do some other post-processing. Or when the command doesn't exist, propose to install it with PackageKit.

> In your opinion, if we add this here now, are we then constrained from
> returning new types of errors in the future?

The sentence can be formulated differently, so the list of error domains is not restricted to those mentioned. For example:

> Currently the possible error domains are %G_SPAWN_ERROR and
> %G_SPAWN_EXIT_ERROR, but it can be extended in the future.

Or if you don't want API stability guarantee for error domains:
s/extended/extended or changed/
Comment 10 Allison Karlitskaya (desrt) 2014-07-04 15:14:14 UTC
(In reply to comment #9)
> It's for printing a clearer error message for G_SPAWN_ERROR_NOENT. Instead of:
> 
> > Failed to execute child process "foobar" (No such file or directory)
> 
> I print:
> 
> > foobar doesn't seem to be installed.


How does this help?  You can already do this today...

This doesn't seem to be a clarifying statement so much as it is some kind of a new promise that you're looking for.  What's that promise?  That we will definitely emit a particular error code in a particular situation?
Comment 11 Sébastien Wilmet 2014-07-04 15:38:53 UTC
I've always seen the error domains and codes as part of the API, since they are documented and available in the API references. Executing a certain piece of code depending on the error type is useful. In POSIX C the errno and possible error types are also well documented.

But again, if you don't want API stability guarantee on error codes for GSubprocess, I can understand (since it's a quite new code, and that the old GLib API is not really useful anymore and will maybe be deprecated in the future, no?). So the other solution is to not document error domains, and developers needing them must look at the code.
Comment 12 Sébastien Wilmet 2014-07-11 12:19:58 UTC
All the patches are pushed, except the one about possible error domains for GSubprocess. No need to discuss at length this stuff, so I think this bug can be closed.