Commit Graph

100 Commits

Author SHA1 Message Date
Sébastien Wilmet
f9faac7661 glib/: LGPLv2+ -> LGPLv2.1+
All glib/*.{c,h} files have been processed, as well as gtester-report.

12 of those files are not licensed under LGPL:

	gbsearcharray.h
	gconstructor.h
	glibintl.h
	gmirroringtable.h
	gscripttable.h
	gtranslit-data.h
	gunibreak.h
	gunichartables.h
	gunicomp.h
	gunidecomp.h
	valgrind.h
	win_iconv.c

Some of them are generated files, some are licensed under a BSD-style
license and win_iconv.c is in the public domain.

Sub-directories inside glib/:

	deprecated/: processed in a previous commit
	glib-mirroring-tab/: already LGPLv2.1+
	gnulib/: not modified, the code is copied from gnulib
	libcharset/: a copy
	pcre/: a copy
	tests/: processed in a previous commit

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-24 11:58:19 +02:00
Philip Withnall
d21fb0ed3c docs: Add an example for using the g_spawn_*() APIs
And clarify that you must add a child watch or *not* use the
G_SPAWN_DO_NOT_REAP_CHILD flag, otherwise your child will become a
zombie on exit, and will not be reaped until the parent process exits.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2017-04-30 09:41:35 +01:00
Sébastien Wilmet
8edcf67b02 License headers: "GLib" -> "This library"
Harmonize a little the license headers. In most of the license headers
in GLib, it is "This library".

It is also what is explained at:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html#SEC4
"How to Apply These Terms to Your New Libraries"

https://bugzilla.gnome.org/show_bug.cgi?id=776586
2017-01-04 19:12:56 +01:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Piotr Drąg
10c490cdfe Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2016-10-12 21:30:42 +02:00
Christoph Reiter
c9dd204909 Partly revert "glib: Add filename type annotations"
Revert all annotation changes for environment variables and command line
arguments.

See commit 41013a01f4.
2016-06-07 19:48:11 +02:00
Christoph Reiter
41013a01f4 glib: Add filename type annotations
Adds the filename annotation for all file names
and things which can contain file names like
environment variables, argv-

On Unix they can contain anything while on Windows
they are always utf-8.

https://bugzilla.gnome.org/show_bug.cgi?id=767245
2016-06-04 20:38:33 +02:00
TingPing
3cc349b04e win32: Replace usage of __wgetmainargs()
It was an internal function that has been removed with VS 2015

Use g_win32_get_command_line() or CommandLineToArgvW() directly.

https://bugzilla.gnome.org/show_bug.cgi?id=741822
2015-07-23 04:22:59 -04:00
Matthias Clasen
f38b438c96 docs: Fill in the gspawn long description 2014-05-31 10:54:02 -04:00
William Jon McCann
20f4d1820b docs: use "Returns:" consistently
Instead of "Return value:".
2014-02-19 19:41:52 -05:00
Matthias Clasen
3232425785 Docs: replace <literal> by ` 2014-02-06 08:07:16 -05:00
Matthias Clasen
111803030d Don't use <envar> in docs
Switch to simpler markdown, `foo`.
2014-02-05 19:32:41 -05:00
Matthias Clasen
c575d24dfb Docs: Don't use the note tag
More markup avoidance.
2014-01-31 18:20:06 -05:00
Ryan Lortie
e30bbca667 gspawn: support creating pipes with O_CLOEXEC
Add a new flag, G_SPAWN_CLOEXEC_PIPES, for creating the stdin/out/err
pipes with O_CLOEXEC (for the usual reasons).
2013-10-17 14:32:41 -04:00
Paul Barbieri
e55ccf7338 gspawn: Fix leak of internal pipe with G_SPAWN_LEAVE_DESCRIPTORS_OPEN
Even when the app author specifies G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
we should avoid leaking our internal pipe machinery into the
child.

Commit message written by: Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=703407
2013-07-01 21:10:28 +01:00
Bastien Nocera
1891eafd1d Fix typo in documentation
s/doucumentation/documentation
2013-07-01 08:40:40 +02:00
Dan Winship
4b94c0831e Use 'dumb quotes' rather than `really dumb quotes'
Back in the far-off twentieth century, it was normal on unix
workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
APOSTROPHE to be drawn as "’". This led to the convention of using
them as poor-man's ‛smart quotes’ in ASCII-only text.

However, "'" is now universally drawn as a vertical line, and "`" at a
45-degree angle, making them an `odd couple' when used together.

Unfortunately, there are lots of very old strings in glib, and also
lots of new strings in which people have kept up the old tradition,
perhaps entirely unaware that it used to not look stupid.

Fix this by just using 'dumb quotes' everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=700746
2013-05-21 11:23:22 -03:00
Ryan Lortie
eb860fd898 Partially revert "Merge waitpid() from g_spawn_sync into gmain()"
This partially reverts commit ce0022933c.

It used to be safe to use g_spawn_sync() from processes that had their
own SIGCHLD handler because it simply called wait().  When it was
changed to depend on the GLib child watching infrastructure this meant
that GLib had to own the SIGCHLD handler.

This caused hangs in at least Pidgin.

The patch contained two other improvements to the child watch code which
we want to keep, so only revert the changes to gspawn itself.

https://bugzilla.gnome.org/show_bug.cgi?id=698081
2013-04-23 14:39:09 -04:00
Colin Walters
f398bec5bc Add g_close(), use it
There are two benefits to this:

1) We can centralize any operating system specific knowledge of
   close-vs-EINTR handling.  For example, while on Linux we should never
   retry, if someone cared enough later about HP-UX, they could come by
   and change this one spot.
2) For places that do care about the return value and want to provide
   the caller with a GError, this function makes it convenient to do so.

Note that gspawn.c had an incorrect EINTR loop-retry around close().

https://bugzilla.gnome.org/show_bug.cgi?id=682819
2013-01-29 09:46:04 -05:00
Michael Natterer
75de24ca66 Revert "gspawn: support creating pipes with O_CLOEXEC"
This reverts commit 2054ccad95.
2012-11-15 15:33:38 +01:00
Ryan Lortie
2054ccad95 gspawn: support creating pipes with O_CLOEXEC
Add a new flag, G_SPAWN_CLOEXEC_PIPES, for creating the stdin/out/err
pipes with O_CLOEXEC (for the usual reasons).

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2012-11-14 14:12:15 -05:00
Colin Walters
ce0022933c Merge waitpid() from g_spawn_sync into gmain()
This is preparatory work for a future commit which will add a
"catchall" waitpid API.  If we don't synchronize here with the worker
thread, race conditions are possible.

This also ensures we have an error message if someone adds a child
watch for a nonexistent pid, etc.  Previously, we'd simply keep
calling waitpid() getting ECHILD, and ignoring it until the source was
removed. Now, we g_warning() and fire the source.

Thirdly, this ensures that the waitpid() call in gmain handles EINTR,
like the g_spawn_sync() one did.

https://bugzilla.gnome.org/show_bug.cgi?id=687061
2012-11-02 09:19:13 -04:00
Paul Eggert
00f4c12bf9 gmain: Document constraints on waitpid
Applications that use glib should not invoke waitpid with a first
argument that is nonpositive, because when such a waitpid is run in
one thread and glib waits for a subprocess in another, there is a race
condition, and the former waitpid can reap a process that was intended
for the latter.  Mention this in the documentation for
g_child_watch_source_new, and in the diagnostic generated by
g_spawn_sync when its waitpid fails with errno equal to ECHILD.

Signed-off-by: Colin Walters <walters@verbum.org>

http://bugzilla.gnome.org/show_bug.cgi?id=687075
2012-10-29 10:19:20 -04:00
Cosimo Cecchi
4b602940e2 glib: don't quote quark names for G_DEFINE_QUARK 2012-08-28 13:16:24 -04:00
Matthias Clasen
369c7689c2 Add missing includes 2012-08-28 05:57:17 -04:00
Matthias Clasen
4f12f7c029 Use G_DEFINE_QUARK for GLib's own quarks
This commit just deals with glib/.
gobject/ and gio/ will be handled in separate commits.
2012-08-28 00:08:07 -04:00
Marc-André Lureau
d9af4259f7 win32: fix build g_spawn_check_exit_status() with mingw
With mingw, only gspawn-win32.c is compiled, but it is missing some
new symbols.

https://bugzilla.gnome.org/show_bug.cgi?id=679691
2012-07-12 23:19:52 -04:00
Colin Walters
f7abd3ce13 Add g_spawn_check_exit_status()
Many (if not "almost all") programs that spawn other programs via
g_spawn_sync() or the like simply want to check whether or not the
child exited successfully, but doing so requires use of
platform-specific functionality and there's actually a fair amount of
boilerplate involved.

This new API will help drain a *lot* of mostly duplicated code in
GNOME, from gnome-session to gdm.  And we can see that some bits even
inside GLib were doing it wrong; for example checking the exit status
on Unix, but ignoring it on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=679691
2012-07-10 18:03:56 -04:00
Colin Walters
01d8d43d0b gspawn: Abort if we can't open /dev/null
This really "shouldn't happen", but if we have an assertion here, it
will help static analysis tools know we're not hitting undefined
state.
2012-06-22 10:34:03 -04:00
Christian Persch
481191f118 gspawn: Add GSpawnFlag to use the PATH from envp
Add a G_SPAWN_SEARCH_PATH_FROM_ENVP flag to GSpawnFlags so that
g_spawn_async() etc use the PATH variable from the passed-in child
environment to search for the executable.
If both this flag and the G_SPAWN_SEARCH_PATH flag are set, the
child environment is searched first and only falls back to the
PATH from the process environment if it is unset.

Bug #676398.
2012-05-22 19:47:28 +02:00
David Benjamin
b0739f2223 Continue searching in PATH on ENODEV and ETIMEDOUT
Synchronize the error-handling logic from glibc. Users with networked
filesystems in their PATH may hit ETIMEDOUT.

https://bugzilla.gnome.org/show_bug.cgi?id=672201
2012-03-16 11:49:30 -04:00
Dan Winship
deea0e39ba gspawn: rename G_SPAWN_ERROR_2BIG to be more bindings-friendly
Rename G_SPAWN_ERROR_2BIG to G_SPAWN_ERROR_TOO_BIG (while keeping the
old name for compatibility), to fix problems with language bindings
where the old name translates into something that would be
syntactically invalid due to starting with a digit.

https://bugzilla.gnome.org/show_bug.cgi?id=671025
2012-03-03 13:26:43 -05:00
Stef Walter
7e92997539 documentation fixes
Fixes for gtk-doc warnings.

http://bugzilla.gnome.org/show_bug.cgi?id=66469

https://bugzilla.gnome.org/show_bug.cgi?id=664699
2011-12-13 23:01:51 -05:00
Martin Pitt
1435db48ba Clarify g_spawn_*() behaviour without full path
Document the previously uncovered case of calling g_spawn_async_with_pipes()
without a full path but no G_SPAWN_SEARCH_PATH. This runs programs from the
current directory, which might be unexpected and even dangerous in some corner
cases.

https://bugzilla.gnome.org/show_bug.cgi?id=656621
2011-10-16 16:09:33 -04:00
Matthias Clasen
976b0b72a4 Include genviron.h where necessary 2011-10-15 20:06:32 -04:00
Ryan Lortie
118fa5d502 doc: Remove reference to non-existent #GChildWatch
The g_spawn_ documentation was talking about #GChildWatch, which doesn't
exist.  Refer to g_child_watch_add() instead.
2011-09-05 10:32:51 -04:00
Javier Jardón
c2dc66ccf2 Move documentation to inline comments: spawn 2011-07-06 22:13:05 +01:00
Matthias Clasen
a6b9db6907 Eliminate some dead code 2011-06-14 21:06:17 -04:00
Colin Walters
1874ad97d8 gspawn: Reset signal handlers for synchronous spawning
We should by default reset signal handlers; particularly with the
ability to install them via g_unix_signal_source_new(), we don't
want to call a user callback inside a fork()ed helper process.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:36 -04:00
Colin Walters
7e1886ba72 gspawn: Handle EINTR in a few more cases
I was debugging gthread/tests/spawn-multithreaded.c, and while I
don't think I actually hit EINTR in any of these cases, it'd be
good to fix them anyways.

https://bugzilla.gnome.org/show_bug.cgi?id=652072
2011-06-14 19:23:35 -04:00
Colin Walters
9d53e2bc4e gspawn: Fix annotations
g-ir-scanner wants guint8.
2011-06-10 12:58:49 -04:00
Giovanni Campagna
37c9775b82 gutils, gspawn: fix introspection annotations
Fix various (out) arguments, (allow-none) and (array zero-terminated=1)
for g_spawn_*() and some others.

Some additional fixes by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-06-07 17:13:15 -04:00
Emmanuele Bassi
959886d95e build: Fix warnings caused by missing includes 2010-09-06 11:43:04 +01:00
Matthias Clasen
f13d561211 More header inclusion cleanup 2010-09-05 00:23:03 -04:00
Ryan Lortie
2e53e50244 glib/: fully remove galias hacks 2010-07-07 19:34:35 -04:00
Christian Persch
8ef30758d5 Preserve errno
When using errno in g_set_error with _(), preserve errno. Bug #592457.
2009-08-22 15:08:43 +02:00
Christian Persch
1cbdd2495d Preserve errno when using g_set_error with _() and g_strerror() 2009-05-20 13:47:55 +02:00
Matthias Clasen
0f6b25ca96 Fix some compiler warnings
svn path=/trunk/; revision=7755
2008-12-31 05:51:47 +00:00
Tor Lillqvist
0ed8b94bfe Just ignore the child_setup function, never call it. The is no situation
2008-09-25  Tor Lillqvist  <tml@novell.com>

	* glib/gspawn-win32.c (do_spawn_with_pipes) (do_spawn_directly):
	Just ignore the child_setup function, never call it. The is no
	situation in which it could be useful on Windows. Do print a
	warning, like before.

	* glib/gspawn.c (g_spawn_async_with_pipes): Corresponding change
	in documentation.


svn path=/trunk/; revision=7540
2008-09-25 08:05:41 +00:00
Tor Lillqvist
a689811a41 glib/gmain.c Clarify what a "child pid" is in the doc comments.
2008-06-11  Tor Lillqvist  <tml@novell.com>

	* glib/gmain.c
	* glib/gspawn.c: Clarify what a "child pid" is in the doc
	comments.


svn path=/trunk/; revision=6995
2008-06-11 06:57:22 +00:00