GNOME Bugzilla – Bug 738185
Misleading language about "file name encoding" in the docs on g_environ_* and GSubprocessLauncher
Last modified: 2015-06-05 18:57:40 UTC
The API doc comments have vague language about the environment variable strings being in the "GLib file name encoding", at the same time admitting they could be arbitrary byte strings. This is actually a misnomer: nothing should prevent a UNIX process from interpreting env vars in any encoding they please, and no encoding should necessarily be applied to e.g. UTF-8 data sources in order to make them useful in a process environment. The encoding of variable values may be decided on case-by-case basis: the filename encoding for path-like variables, the locale encoding for human-readable text, or possibly even strictly UTF-8 in some other cases.
Created attachment 288079 [details] [review] glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding" Removed all mentions of GLib file name encoding referring to the environment strings. The env var content has no defined relation to GLib's notion of filename encoding, or any encoding whatsoever. It would be wrong to pass all UTF-8 strings through g_filename_from_utf8() in order to put them into the environment, for one thing.
Review of attachment 288079 [details] [review]: Other than a small nitpick, this generally looks good. ::: gio/gsubprocesslauncher.c @@ +283,3 @@ * processes launched from this launcher. * + * On UNIX, the variable name can be an arbitrary byte string. This statement is slightly too strong: it cannot contain '='. The other statement was restrictive in nature whereas this one seems more permissive, which is why I think the exception needs to be mentioned here, or the statement reworked to something weaker like "variable name has no particular encoding".
Created attachment 288145 [details] [review] glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding" Added the requirement on not containing '=' in the description of *_setenv*() functions.
Review of attachment 288145 [details] [review]: Sure. Thanks.
Attachment 288145 [details] pushed as 16190d2 - glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding"