1. 26 Dec, 2018 3 commits
    • Vasily Galkin's avatar
      gspawn, win32: quoted args - escape end backslash · 22e875f7
      Vasily Galkin authored
      According to msdn documentation last backslash(es) of quoted argument
      in a win32 cmdline need to be escaped, since they are
      directly preceding quote in the resulting string:
      https://docs.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments
      
      Glib <=2.58.0 passed children arguments like C:\Program Files\
      without escaping last backslash(es).
      So it had been passed as "C:\Program Files\"
      windows command line parsing treated this as escaped quote,
      and later text was treated as argument continuation instead of separate
      arguments.
      
      Existing implementation wasn't easily adoptable to fix this problem,
      so escaping logic was rewritten.
      Since the resulting length need to be increased due to extra escaping
      it was rewritten too. Now the calculated length assumes that all
      escapable chars would be escaped in a resulting string,
      so the length may be a bit bigger than actually needed,
      since backslashes not preceding quotes are not escaped.
      
      This fixes the glib/tests/spawn-singlethread.c test
      (which introduced testing for special chars to make this problem
      testable).
      The problem itself was found during investigations about fixing
      related #1566
      
      The logic is duplicated in protect_argv_string() and protect_wargv() funcs.
      However there is no single obvious way to get rid of duplication -
      !419 (comment 371483)
      
      So by now adding a note referencing protect_wargv from protect_argv_string,
      the other direction is already referenced.
      22e875f7
    • Vasily Galkin's avatar
      gspawn, win32: fix child stderr when coverage enabled · f7f597c8
      Vasily Galkin authored
      This fixes test that were added in previous commit:
      checking for empty stderr failed with coverage enabled, since
      coverage warnings printed from gspawn-win32-helper process were treated
      as child output. This is fixed by removing redirection after child
      finishes execution.
      
      The dup_noninherited renamed to reopen_noninherited,
      since it actually always closes passed file descriptor.
      f7f597c8
    • Vasily Galkin's avatar
      gspawn, win32: fix redirecting only stderr · cafb61a1
      Vasily Galkin authored
      Problem was just a typo - wrong variable was checked before enabling
      stderr redirection.
      This fixes error-only redirection spawn-test added in previous commit.
      
      Behavior while redirecting only stdout should be unaffected,
      since old code tried to redirect stderr to -1 in such case,
      which silently failed I think.
      cafb61a1
  2. 21 Jun, 2018 1 commit
    • Daniel Drake's avatar
      gspawn: Add g_spawn_async_with_fds variant · 3524de16
      Daniel Drake authored
      Add a new process spawning function variant which allows the caller
      to pass specific file descriptors for stdin, stdout and stderr.
      It is otherwise identical to g_spawn_async_with_pipes.
      
      Allow the same fd to be passed in multiple parameters. To make this
      workable, the child process logic that closes the fd after the first time
      it has been dup2'ed needed tweaking; we now just set those fds to be
      closed upon exec using the CLOEXEC flag. Add a test for this case.
      
      This will be used by gnome-shell to avoid performing equivalent
      dup2 actions in a child_setup function. Dropping use of child_setup will
      enable use of an upcoming optimized process spawning codepath.
      3524de16
  3. 12 Jun, 2018 2 commits
  4. 25 Apr, 2018 1 commit
  5. 12 Jul, 2017 1 commit
  6. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      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
      f9faac76
  7. 06 Apr, 2017 1 commit
  8. 04 Jan, 2017 1 commit
  9. 12 Oct, 2016 1 commit
  10. 05 Aug, 2014 1 commit
  11. 15 Nov, 2012 2 commits
  12. 28 Aug, 2012 3 commits
  13. 13 Jul, 2012 1 commit
  14. 07 Jul, 2010 1 commit
  15. 22 Aug, 2009 1 commit
  16. 25 Sep, 2008 1 commit
    • Tor Lillqvist's avatar
      Just ignore the child_setup function, never call it. The is no situation · 0ed8b94b
      Tor Lillqvist authored
      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
      0ed8b94b
  17. 19 Sep, 2008 1 commit
    • Tor Lillqvist's avatar
      glib/gutils.c (_glib_get_dll_directory) Be a bit less restrictive, look · bc8e1dd8
      Tor Lillqvist authored
      2008-09-19  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gutils.c (_glib_get_dll_directory)
      	* glib/gspawn-win32.c (do_spawn_with_pipes): Be a bit less
      	restrictive, look for the helper programs in the same folder where
      	the GLib DLL is, not necessarily in a "bin" subfolder of the top
      	GLib installation folder.
      
      
      svn path=/trunk/; revision=7511
      bc8e1dd8
  18. 04 Aug, 2008 1 commit
    • Tor Lillqvist's avatar
      glib/giowin32.c glib/gmain.c glib/gspawn-win32.c Change gssize casts · 0e2384fa
      Tor Lillqvist authored
      2008-08-04  Tor Lillqvist  <tml@novell.com>
      
      	* glib/giowin32.c
      	* glib/gmain.c
      	* glib/gspawn-win32.c
      	* glib/gspawn-win32-helper.c: Change gssize casts introduced on
      	2008-07-28 to gintptr casts now that we have that. gssize is as
      	such the same as gintptr on both 32- and 64-bit Windows, but the
      	gintptr name indicates that it is used to hold pointers, i.e. also
      	HANDLEs.
      
      
      svn path=/trunk/; revision=7306
      0e2384fa
  19. 28 Jul, 2008 1 commit
    • Tor Lillqvist's avatar
      Fix problems on 64-bit Windows. Avoid warnings, some of which indicated · a3fa7485
      Tor Lillqvist authored
      2008-07-28  Tor Lillqvist  <tml@novell.com>
      
      	Fix problems on 64-bit Windows. Avoid warnings, some of which
      	indicated actual problems, some which were just annoyances. 
      
      	Where casts to an integer type are needed for pointers, use
      	gssize. Technically intptr_t would be the more proper type, but we
      	still want to be compilable with MSVS6 and 7 which don't have
      	intptr_t. MSVS8 and 9 do have intptr_t, but in <crtdefs.h>, not
      	<stdint.h>.
      
      	Use %p to print out handles. Use gssize casts when assigning
      	GPollFD::fd fields.
      
      	Use G_GSIZE_FORMAT when printing size_t values.
      	
      	* configure.in: Define automake conditional G_OS_WIN32_X64 which
      	is true on Win64.
      
      	* glib/giochannel.h: Use slightly different prototype for
      	g_io_channel_win32_new_messages() on Win64 with gsize instead of
      	guint.
      
      	* glib/giowin32.c
      	* glib/gmain.c
      	* glib/gspawn-win32.c
      	* tests/testglib.c: Generic changes as described above.
      
      	* glib/gmain.h: Don't bother mentioning GIMP in comment.
      
      	* glib/grel.c (tuple_hash_2): Use all bits of pointer.
      
      	* glib/gspawn-win32.c
      	* glib/gspawn-win32-helper.c: Use gssize types in the
      	communication between parent and helper process, so that we can
      	pass process handles, which are pointers, also on Win64.
      
      	* glib/gtimer.c (g_time_val_to_iso8601): time_t is 64 bits on
      	Win64 so we can't pass the address of a GTimeVal::tv_sec which is
      	a long directly to gmtime(). On the other hand, changing
      	GTimeVal::tv_sec to be a gint64 on Win64 is not really feasible
      	either, as that would then require changes in much code that uses
      	GTimeVals.
      
      	* glib/gspawn-win32.c
      	* glib/Makefile.am: Call the helper programs
      	gspawn-win64-helper.exe and gspawn-win64-helper-console.exe on
      	Win64, to avoid potential risk of running a 32-bit version of the
      	helper.
      
      
      svn path=/trunk/; revision=7260
      a3fa7485
  20. 27 Jul, 2008 1 commit
    • Tor Lillqvist's avatar
      glib/glib.symbols glib/gconvert.c glib/gdir.c glib/gfileutils.c · 80ecc308
      Tor Lillqvist authored
      2008-07-27  Tor Lillqvist  <tml@novell.com>
      
      	* glib/glib.symbols
      	* glib/gconvert.c
      	* glib/gdir.c
      	* glib/gfileutils.c
      	* glib/giowin32.c
      	* glib/gspawn-win32.c
      	* glib/gutils.c
      	* glib/gwin32.c: Bypass the Windows "ABI compatibility" symbols on
      	_WIN64. As there hasn't been any widely deployed 64-bit Windows
      	builds of the really old GLib (pre-2.8.1) versions those refer to,
      	there is no need to have the "ABI compatibility" versions in the
      	DLL.
      
      	* glib/makegalias.pl: Handle #ifndef _WIN64: Just output it, too.
      
      
      svn path=/trunk/; revision=7257
      80ecc308
  21. 16 Jun, 2008 1 commit
  22. 03 Mar, 2008 1 commit
    • Tor Lillqvist's avatar
      Must set the GError also in the unexpected EOF case. · 5ec93805
      Tor Lillqvist authored
      2008-03-03  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gspawn-win32.c (read_helper_report): Must set the GError
      	also in the unexpected EOF case.
      	(do_spawn_with_pipes): Must protect also new_argv[0].
      
      
      svn path=/trunk/; revision=6612
      5ec93805
  23. 24 Feb, 2008 2 commits
    • Tor Lillqvist's avatar
      Guard against _glib_get_installation_directory() returning NULL. In that · 96c7abe7
      Tor Lillqvist authored
      2008-02-24  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gspawn-win32.c: Guard against
      	_glib_get_installation_directory() returning NULL. In that
      	case, just use the name of the helper process executable
      	without path.
      
      
      svn path=/trunk/; revision=6576
      96c7abe7
    • Tor Lillqvist's avatar
      New internal function. · 17640e78
      Tor Lillqvist authored
      2008-02-24  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gutils.c (_glib_get_installation_directory): New internal function.
      
      	* glib/gspawn-win32.c: When spawning the helper process, use an
      	explicit full path. (#518292)
      
      	* glib/gspawn-win32.c
      	* glib/gspawn-win32-helper.c: Fix race condition when using the
      	helper process: When the helper process writes the handle of the
      	actual started user process to the parent process, it must be
      	duplicated in the parent process with DuplicateHandle() so that it
      	is a valid handle in that process. However, if the helper process
      	has happened to exit before the DuplicateHandle() call, the
      	duplication will fail. Thus we must synchronise the helper
      	process's exit. Use another pipe for this.
      
      	Take care not to inherit the writing end of this pipe to the
      	helper process. Also, in the helper process, take care not to
      	inherit either of the pipes used for communication with the parent
      	process to the started user process.
      
      
      svn path=/trunk/; revision=6575
      17640e78
  24. 13 May, 2007 1 commit
    • Tor Lillqvist's avatar
      Drop the pipe() macro. Defining macros outside of its namespace that look · 20d47d6f
      Tor Lillqvist authored
      2007-05-13  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gwin32.h: Drop the pipe() macro. Defining macros outside of
      	its namespace that look like POSIX functions is not GLib's
      	business in my opinion. This means pipe()-using code that has
      	relied on this definition will need changing to call _pipe() on
      	Windows, and make the decision itself on what size pipe buffer to
      	use, and whether to use text or binary mode, and whether the pipe
      	handles should be inheritable or not.
      
      	* glib/gspawn-win32.c (make_pipe): Use _pipe() instead of pipe().
      
      
      svn path=/trunk/; revision=5490
      20d47d6f
  25. 30 Sep, 2006 1 commit
  26. 29 Aug, 2006 1 commit
    • Tor Lillqvist's avatar
      Remove support for Windows 9x/ME, as will be done also in Pango and GTK+. · da422c00
      Tor Lillqvist authored
      2006-08-29  Tor Lillqvist  <tml@novell.com>
      
      	Remove support for Windows 9x/ME, as will be done also in Pango
      	and GTK+. GTK+ hasn't worked on Win9x since 2.6 or 2.8 anyway, so
      	it's pretty pointless to keep the Win9x code in here either. If
      	somebody is interested, the code can always be found in older GLib
      	versions, and in CVS.
      
      	* glib/gdir.c
      	* glib/gfileutils.c
      	* glib/gspawn-win32-helper.c
      	* glib/gspawn-win32.c
      	* glib/gstdio.c
      	* glib/gutils.c
      	* glib/gwin32.c
      	* glib/gwin32.h: Remove the G_WIN32_IS_NT_BASED() and
      	G_WIN32_HAVE_WIDECHAR_API() tests and their false (Win9x)
      	branches, and any variables or static functions used only by the
      	Win9x branches.
      
      	* glib/gwin32.c (g_win32_windows_version_init): Call g_error() if
      	run on Win9x.
      da422c00
  27. 09 May, 2006 1 commit
  28. 04 Apr, 2006 1 commit
    • Matthias Clasen's avatar
      Move short_month_names and long_month_names to bss. · b58fb2bd
      Matthias Clasen authored
      2006-04-04  Matthias Clasen  <mclasen@redhat.com>
      
              * glib/gdate.c: Move short_month_names and long_month_names
              to bss.
      
              * glib/gspawn-win32.c (g_spawn_error_quark):
              * glib/gspawn.c (g_spawn_error_quark):
              * glib/gshell.c (g_shell_error_quark):
              * glib/gmarkup.c (g_markup_error_quark):
              * glib/goption.c (g_option_error_quark):
              * glib/gkeyfile.c (g_key_file_error_quark):
              * glib/giochannel.c (g_io_channel_error_quark):
              * glib/gfileutils.c (g_file_error_quark):
              * glib/gconvert.c (g_convert_error_quark):
              * glib/gbookmarkfile.c (g_bookmark_file_error_quark):
              * glib/gthread.c (g_thread_error_quark): No point in making
              the error path fast by caching quarks.
      
              * glib/gbookmarkfile.c: Make the parser struct const.
      b58fb2bd
  29. 01 Jan, 2006 1 commit
    • Tor Lillqvist's avatar
      Set the GIOChannels for stdout and stderr to unbuffered. Otherwise the · 07e1d54f
      Tor Lillqvist authored
      2006-01-01  Tor Lillqvist  <tml@novell.com>
      
      	* glib/gspawn-win32.c (g_spawn_sync_utf8): Set the GIOChannels for
      	stdout and stderr to unbuffered. Otherwise the giochannel layer
      	will try to read from them regardless whether the
      	g_io_channel_win32_poll() call here has indicated
      	readability or not. (#325310)
      07e1d54f
  30. 07 Sep, 2005 1 commit
    • Tor Lillqvist's avatar
      Create also a console version of the gspawn-win32-helper program, · 17045b64
      Tor Lillqvist authored
      2005-09-07  Tor Lillqvist  <tml@novell.com>
      
      	* glib/Makefile.am: Create also a console version of the
      	gspawn-win32-helper program, gspawn-win32-helper-console.exe.
      	It's otherwise identical to gspawn-win32-helper.exe, except marked
      	as a console application (linked without the -mwindows option).
      
      	* glib/gspawn-win32.c (do_spawn_directly, do_spawn_with_pipes):
      	Drop the dont_wait parameter. Its truth value correlated 100% with
      	the NULLness of the exit_status parameter anyway, so it's enough
      	to check whether exit_status is NULL. Invert the sense of the
      	dont_return_handle parameter and rename it to do_return_handle, to
      	make the code easier to read by avoiding double negations.
      
      	(g_spawn_sync_utf8, g_spawn_async_with_pipes_utf8): Modify calls
      	to do_spawn_with_pipes() accordingly.
      
      	(do_spawn_with_pipes): If we have a console, use the console
      	version of the helper program, otherwise use the GUI one. This
      	avoids extra console windows opening up in some situations. (In
      	case a console application uses the GUI gspawn-win32-helper.exe to
      	spawn another console application we would get a separate console
      	for the spawned console application).
      
      	* glib-zip.in: Distribute also gspawn-win32-helper-console.exe.
      17045b64
  31. 26 Aug, 2005 1 commit
  32. 25 Aug, 2005 1 commit
    • Tor Lillqvist's avatar
      Make also the g_spawn*() functions take parameters in the GLib file name · 41e833ae
      Tor Lillqvist authored
      2005-08-25  Tor Lillqvist  <tml@novell.com>
      
      	Make also the g_spawn*() functions take parameters in the GLib
      	file name encoding, i.e. UTF-8, on Windows. Has no impact on Unix
      	API or ABI. Like the other GLib API that was earlier changed to
      	use UTF-8 on Windows, the names of the functions that take UTF-8
      	have _utf8 suffixes added by using preprocessor macros in the
      	header file. The old names are kept for functions with the old
      	behaviour, taking parameters in the system codepage, for DLL ABI
      	stability.
      
      	* glib/gspawn.h: On Win32 add the suffix _utf8 to the names of the
      	g_spawn*() functions.
      
      	* glib/gspawn-win32.c: Use wide-char API on NT-based
      	Windows. Convert parameters from UTF-8 to wide chars (NT) or
      	system codepage (Win9x) and call the C library _wspawn*() or
      	spawn*() functions respectvely. Add DLL ABI stability versions
      	that take parameters in the system codepage.
      
      	* glib/gspawn-win32-helper.c: On NT-based Windows use the
      	wide-char versions of argv and envp, and use wide-char API to
      	change directory and spawn the program to run. Remove the verbose
      	debugging output, it was too complex to modify for the wide-char
      	features. (Just add temporary debugging printouts if needed, no
      	need to have them permanently in the source.)
      
      	* glib/gspawn.c: Corresponding documentation updates.
      
      	* glib/glib.symbols: Corresponding changes: Mark the ABI stability
      	symbols as PRIVATE, add the new _utf8-suffixed ones.
      41e833ae
  33. 20 Mar, 2005 1 commit