Commit Graph

13886 Commits

Author SHA1 Message Date
Colin Walters
9f1a0b57cd Ensure g_file_copy() does not temporarily expose private files
Previously, g_file_copy() would (on Unix) create files with the
default mode of 644.  For applications which might at user request
copy arbitrary private files such as ~/.ssh or /etc/shadow, a
world-readable copy would be temporarily exposed.

This patch is suboptimal in that it *only* fixes g_file_copy()
for the case where both source and destination are instances of
GLocalFile on Unix.

The reason for this is that the public GFile APIs for creating files
allow very limited control over the access permissions for the created
file; one can either say a file is "private" or not.  Fixing
this by adding e.g. g_file_create_with_attributes() would make sense,
except this would entail 8 new API calls for all the variants of
_create(), _create_async(), _replace(), _replace_async(),
_create_readwrite(), _create_readwrite_async(), _replace_readwrite(),
_replace_readwrite_async().  That can be done as a separate patch
later.

https://bugzilla.gnome.org/show_bug.cgi?id=699959
2013-06-05 19:00:20 +01:00
Colin Walters
02aaef5a4d g_file_copy(): Clean up logic for info query
Previously, we called g_file_query_info() *again* on the source at the
very end of the copy.  This has the lame semantics that if the source
happened to be deleted, we would fail to apply attributes to the
destination.  This could even be a security flaw.

This commit changes things so that we query info from the source
*stream* after opening - i.e. on Unix we use the proper fstat() and
friends.  That way we operate more atomically.

https://bugzilla.gnome.org/show_bug.cgi?id=699959
2013-06-05 18:56:53 +01:00
Ryan Lortie
b4df86fa19 GApplication: implement fd.o application spec
The freedesktop application specification is largely overlapping the
GLib application D-Bus interface but implementing it will allow for
applications to be launched directly from desktop files, which we want.

We keep the old Gtk interface for compatibility reasons and because it
has some functionality not in the freedesktop spec (Busy state,
CommandLine, etc.).

https://bugzilla.gnome.org/show_bug.cgi?id=699259
2013-06-05 12:50:50 -04:00
Ryan Lortie
7baea0aee5 GApplication: set prgname to appid for services
Since services are based on D-Bus activation and desktop files are
supposed to be named like the busname for DBusActivatable applications
and since gnome-shell wants wmclass equal to the desktop file name, we
therefore want wmclass equal to the application ID in this case.

wmclass is determined from the prgname, which is otherwise pretty
pointless to set to some random thing in $(libexec) for a D-Bus service,
so set that to the appid.

This means that for D-Bus services, the following things are now all the
same:

 - application ID
 - prgname
 - wmclass property set on all windows
 - desktop file name
 - well-known bus name

There are not many applications running as D-Bus services at present so
this shouldn't impact anybody except for gnome-clocks (where this change
will be fixing a bug) and gnome-terminal.

https://bugzilla.gnome.org/show_bug.cgi?id=699259
2013-06-05 12:50:50 -04:00
Daniel Mustieles
25d6560588 Updated Spanish translation 2013-06-05 18:28:48 +02:00
ManojKumar Giri
27c2864843 Updated Odia Translation. 2013-06-05 13:08:46 +05:30
Sandeep Sheshrao Shedmake
5b872bb4fd Updated Marathi Translations 2013-06-05 12:28:00 +05:30
Sweta Kothari
78ebab5bea Updated Gujarati Translations 2013-06-05 10:49:24 +05:30
Ryan Lortie
9d0c17b501 g_file_set_contents(): don't fsync on ext3/4
ext3 and ext4 (for quite some time) with default mount options don't
need fsync() to ensure safety of replace-by-rename.  Stop doing that for
these filesystems.

Note: this patch also impacts ext2, which is probably not safe, but I
don't know of any way to check ext2. vs the others because they all have
the same magic numbers (short of opening /proc/mount).

This patch assumes that if BTRFS_SUPER_MAGIC is defined then so will be
EXT3_SUPER_MAGIC.

https://bugzilla.gnome.org/show_bug.cgi?id=701560
2013-06-04 09:52:10 -04:00
Dan Winship
16b26231ca gio/tests/inet-address: fix to work on OS X
OS X's getaddrinfo() only supports IPv6 scope IDs that are interface
names, not numbers. So use if_indextoname() to get the name of an
interface and construct an address using that.

https://bugzilla.gnome.org/show_bug.cgi?id=700123
2013-06-04 09:24:47 -03:00
Ryan Lortie
c828aef014 g_file_set_contents: change {posix_ => }fallocate
Use fallocate() instead of posix_fallocate() so that we just fail
instead of getting the emulated version from the libc.

https://bugzilla.gnome.org/show_bug.cgi?id=701560
2013-06-03 22:55:20 -04:00
Ryan Lortie
fc98c13fde g_file_set_contents(): fix simple logic error
CI FTW.
2013-06-03 17:59:29 -04:00
Ryan Lortie
e40435e834 g_file_set_contents(): use unistd instead of stdio
Use a normal write() system call instead of fdopen() and fwrite().

This will definitely work on UNIX system and should work on Windows as
well...

As an added bonus, we can use g_close() now as well.

https://bugzilla.gnome.org/show_bug.cgi?id=701560
2013-06-03 17:49:06 -04:00
Ryan Lortie
c152ceba09 g_file_set_contents(): don't allocate display name
g_file_set_contents() sets a GError in the event of various failures
that count occur.  It uses g_filename_display_name() in order to get the
filename to include in the messages.

Factor out the error handling to make it easier to allocate the display
name only when we need it (instead of allocating it every time).

https://bugzilla.gnome.org/show_bug.cgi?id=701560
2013-06-03 17:43:36 -04:00
Ryan Lortie
d3be43fcc5 g_file_set_contents(): use posix_fallocate()
Extents-based filesystems like knowing in advance how much data will be
written to a file in order to prevent fragmentation.  If we have it, use
posix_fallocate() before writing data in g_file_set_contents().

https://bugzilla.gnome.org/show_bug.cgi?id=701560
2013-06-03 16:12:04 -04:00
Matej Urbančič
b935059738 Updated Slovenian translation 2013-06-03 21:37:49 +02:00
Daniel Mustieles
771c841b3d Updated Spanish translation 2013-06-03 11:27:44 +02:00
ManojKumar Giri
ebea942d95 Updated Odia Translation. 2013-06-03 13:48:33 +05:30
Sweta Kothari
72af6b0d5b Updated Gujarati Translations 2013-06-03 13:31:25 +05:30
Kjell Ahlstedt
9acc480d72 Remove extra comma in gtestutils.h
https://bugzilla.gnome.org/show_bug.cgi?id=701474
2013-06-03 09:37:01 +02:00
Matthias Clasen
d0301080ee Improve GSettings test coverage 2013-06-02 20:02:06 -04:00
Matthias Clasen
b9406904a5 Add a directory monitoring test 2013-06-02 20:02:06 -04:00
Matthias Clasen
e546eb016a Remove some unused inotify code 2013-06-02 20:01:56 -04:00
Ryan Lortie
a62079e2e3 tests: Remove a leftover debug printf
https://bugzilla.gnome.org/show_bug.cgi?id=701456
2013-06-02 09:53:24 -04:00
Matthias Clasen
fc35c3487e Improve unix stream test coverage 2013-06-02 01:47:19 -04:00
Matthias Clasen
8f655149e9 Improve GAppInfo test coverage 2013-06-02 01:46:21 -04:00
Matthias Clasen
0326f146fd Improve GMemoryInputStream test coverage 2013-06-02 01:44:49 -04:00
Matthias Clasen
dcf5dea922 Improve GMenuModel test coverage 2013-06-02 01:44:15 -04:00
Matthias Clasen
c40e0b59da Improve GFileAttributeMatcher test coverage 2013-06-02 01:43:13 -04:00
Matthias Clasen
0753ae1235 Improve GIcon test coverage 2013-06-02 01:42:28 -04:00
Matthias Clasen
49d39633d1 Improve test coverage for GZipCompressor 2013-06-02 01:41:50 -04:00
Matthias Clasen
2f3f270fcc Improve test coverage for GBufferedOutputStream 2013-06-02 01:41:09 -04:00
Matthias Clasen
6a487eae56 Trivial formatting fix 2013-06-02 01:40:39 -04:00
Matthias Clasen
7977bb15de Skip spawn tests when collecting coverage
These tests break gcov's data collection, so don't link them
against -lgov. See bug 682133.
2013-06-01 18:54:57 -04:00
Matthias Clasen
fed8ae38c3 Improve test coverage a bit 2013-06-01 18:51:25 -04:00
Matthias Clasen
c0f96bb276 mem-overflow: test malloc and realloc corner cases 2013-06-01 18:51:25 -04:00
Fran Diéguez
81be95fffb Updated Galician translations 2013-06-02 00:25:33 +02:00
Ryan Lortie
79972d22ac Fix failure to build exit-on-close gdbus test
In the case that HAVE_DBUS_DAEMON was undefined (as in ostree where glib
is built before D-Bus) this test was failing.  Move it inside the
HAVE_DBUS_DAEMON block.
2013-06-01 11:38:10 -04:00
Ryan Lortie
16ec629580 glib.mk: Rework win32 test support
Newer versions of automake (~1.13.1) seem to generate some new rules for
testcases that get tripped up on our use of $(addsuffix) and $(strip) so
take those out of the definition of TESTS on win32.
2013-06-01 10:08:24 -04:00
Ryan Lortie
601a00fa2a Change a pair of TESTS = to TEST += 2013-06-01 09:55:13 -04:00
Ryan Lortie
e042db0f83 GSettings tests: reverse installed test complexity
Remove the complications that were introduced in an attempt to make the
gsettings and gschema-compile tests function as installed tests.  These
tests are designed (in large part for gsettings and entirely for
gschema-compile) to test the in-tree tools and should not be testing the
system versions.

In the future we may want to move the use of the in-tree tools from the
gsettings testcase into the Makefile and install the resulting files,
allowing this testcase to run against those files, installed.
2013-05-31 23:16:00 -04:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Ryan Lortie
210b1f8b42 Remove a bunch of lingering g_thread_init()
After this patch, there is but one remaining use of g_thread_init(),
which is in tests/slice-threadinit.c, a testcase dedicated to testing
the functionality of gslice across a g_thread_init() boundary.

This testcase is pretty meaningless these days... probably we should
delete it.
2013-05-31 23:03:19 -04:00
Ryan Lortie
e66abbe2ef Some final g_test_build_filename() porting
This should be the last users that need to be ported.

For some of the oldschool non-gtester-ified tests, we call g_test_init()
from main() because it is necessary in order to use
g_test_build_filename().
2013-05-31 23:03:19 -04:00
Ryan Lortie
d7b3e558cf Move a pair of gobject tests to tests/gobject/
testgobject.c and timeloop-closure.c are the only two tests in the
toplevel tests/ directory that depend on gobject, so move them to
tests/gobject/ along with the other gobject tests.

Both of these were in noinst_PROGRAMS and not TESTS, so keep them that
way when we move them.
2013-05-31 23:03:19 -04:00
Matthias Clasen
a114e98d09 Split off the gdbus-overflow test
It is unrealiable under load, and frequently fails in the
ostree tests. See https://bugzilla.gnome.org/show_bug.cgi?id=701105
2013-05-31 21:24:21 -04:00
Matthias Clasen
eb16c5a4fe Fix a typo 2013-05-31 17:24:14 -04:00
Ryan Lortie
9cfac6e76c Bump version. 2013-05-30 13:50:42 -04:00
William Jon McCann
a681e11f92 Fix property example in gobject tutorial
https://bugzilla.gnome.org/show_bug.cgi?id=692848
2013-05-30 10:25:29 -04:00
Ryan Lortie
ccc039c705 Remove org.gtk.test.gschema
This is the old non-xml schema file format that we were playing around
with at one time.  Nothing is using this file anymore.
2013-05-29 23:31:19 -04:00