Commit Graph

22004 Commits

Author SHA1 Message Date
Sebastian Dröge
5ba5f5b686 Merge branch '137-gfileinfo-display-name-docs' into 'master'
gfileinfo: Clarify docs to say that name and display-name are set

Closes #137

See merge request GNOME/glib!1585
2020-07-27 13:12:44 +00:00
Philip Withnall
5b429344b5 Merge branch '1869-ios-cocoa' into 'master'
gosxutils: Include Foundation rather than Cocoa

Closes #1869

See merge request GNOME/glib!1589
2020-07-27 12:41:27 +00:00
Philip Withnall
9c6c546236 gosxutils: Include Foundation rather than Cocoa
Apparently, the function calls added in 11729cdc use Foundation, not
Cocoa. Cocoa is a massive superset of Foundation, and is not available
on iOS.

Patch contributed by Jay Freeman, but without providing an e-mail
address. So the git commit cannot be attributed to him.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1869
2020-07-27 13:21:20 +01:00
Sebastian Dröge
4bd74ac582 Merge branch 'wip/pwithnall/bsd-nofollow' into 'master'
gfileutils: Fix O_NOFOLLOW handling on BSD systems

See merge request GNOME/glib!1591
2020-07-27 12:01:19 +00:00
Sebastian Dröge
62a54a90b2 Merge branch '4-strescape-utf8' into 'master'
Add some g_strescape() tests

Closes #4

See merge request GNOME/glib!1584
2020-07-27 11:49:44 +00:00
Sebastian Dröge
6a87f7ed6f Merge branch 'bandwidth' into 'master'
Reduce CI bandwidth requirements

See merge request GNOME/glib!1570
2020-07-27 11:31:38 +00:00
Sebastian Dröge
79aeba33c7 Merge branch 'ci-schedules' into 'master'
Use CI schedules and DAGs

See merge request GNOME/glib!1590
2020-07-27 11:30:33 +00:00
Philip Withnall
b4aa9d7858 gfileutils: Fix O_NOFOLLOW handling on BSD systems
Various different BSD systems use a different errno from `E_LOOP` (as
defined by POSIX and used on Linux) to indicate that a file is a symlink
when you try to `open()` it with `O_NOFOLLOW`.

Fix the code which detects this. This is a follow-up to #1302.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-27 12:24:20 +01:00
Philip Withnall
410ee530b5 ci: Add DAG attributes
Add some basic DAG attributes so that some jobs in the pipeline can
run out of stage order to speed things up a little.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-27 12:10:54 +01:00
Philip Withnall
feab973662 ci: Move some CI jobs from branches to schedules
These jobs (`scan-build` and `valgrind`) take ages to run and rarely
indicate failures, so move them to a weekly schedule, rather than
running them on each branch/MR.

The current schedule is once weekly:
https://gitlab.gnome.org/GNOME/glib/-/pipeline_schedules.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-27 12:10:41 +01:00
Sebastian Dröge
87bc87ae69 Merge branch '1022-g-object-new-zeros-docs' into 'master'
gobject: Document that g_object_new() zeros out private data

Closes #1022

See merge request GNOME/glib!1586
2020-07-27 08:09:07 +00:00
Philip Withnall
b79747eee1 Merge branch 'remove-broken-xp-code' into 'master'
gio: Remove broken support for XP

See merge request GNOME/glib!1583
2020-07-27 02:07:43 +00:00
Philip Withnall
41937c3631 gobject: Document that g_object_new() zeros out private data
It’s already mentioned at
https://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation,
but is important enough that mentioning it in the documentation for
`g_object_new()` seems helpful.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1022
2020-07-27 01:57:57 +01:00
Philip Withnall
0544fdff5f gfileinfo: Clarify docs to say that name and display-name are set
They are always available, for all files.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #137
2020-07-27 00:45:31 +01:00
Philip Withnall
1ef6e84012 tests: Add some tests for expanding invalid escapes with g_strcompress()
This brings the branch coverage of `g_strcompress()` up to 100%. Yay.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 23:22:06 +01:00
Philip Withnall
59eb3c5bdb tests: Add missing cast to URI tests
This fixes a compiler warning.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 23:05:31 +01:00
Philip Withnall
437526675a tests: Test that UTF-8 is escaped correctly by g_strescape()
`g_strescape()` is documented as escaping UTF-8 characters, so test that
it does.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #4
2020-07-26 23:04:37 +01:00
Philip Withnall
a84f241dd7 Merge branch '1302-file-set-contents-fsync' into 'master'
gfileutils: Add g_file_set_contents_full() and GFileSetContentsFlags

Closes #1203 and #1302

See merge request GNOME/glib!369
2020-07-26 21:35:35 +00:00
Philip Withnall
5bf3849099 tests: Add tests for g_file_set_contents_full()
These exercise all the code paths I can manage without adding a load of
machinery to inject faults into `write()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:38:17 +01:00
Philip Withnall
f35f9e918a tests: Use G_TEST_OPTION_ISOLATE_DIRS for fileutils tests
They all still pass.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 21:38:17 +01:00
Philip Withnall
cd02eac2d4 gstdio: Add macOS support to g_fsync()
Apparently, `fsync()` doesn’t actually sync to the spinning disk on
macOS. You need an `fcntl()` for that.

See: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fsync.2.html

Spotted by Christoph Reiter in a comment on !369.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 21:38:17 +01:00
Philip Withnall
926dfe5925 gstdio: Handle EINTR in g_fsync()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 21:38:17 +01:00
Philip Withnall
84dd89242a gfileutils: Use g_fsync() for platform-independence
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 21:38:17 +01:00
Philip Withnall
ea2db92034 glocalfileoutputstream: Use g_fsync() for platform-independence
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-26 21:38:17 +01:00
Philip Withnall
3b6460b94c glib: Use g_file_set_contents_full() throughout GLib and GIO
Where applicable. Where the current use of `g_file_set_contents()` seems
the most appropriate, leave that in place.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:37:46 +01:00
Philip Withnall
24ed91ce33 gfileutils: Add a mode argument to g_file_set_contents_full()
This is used when creating the temporary file, or new file from scratch.

I wondered about also allowing the file owner and group to be set, but
that’s not as generally applicable — if your process is operating across
multiple user IDs then it likely has some fairly OS-specific
requirements and will need tighter control of its syscalls anyway.

(Eventually, support for setting the file owner and group atomically
could be added by writing out a file using `O_TMPFILE` so it’s not
addressable, and then linking it into the file system in place of the
old file using something like `renameat2(AT_EMPTY_PATH)` or `linkat()`.
That’s currently not possible without patching the kernel with
https://marc.info/?l=linux-fsdevel&m=152472898003523&w=2, as far as I
know at the moment.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1203
2020-07-26 21:37:46 +01:00
Philip Withnall
f3cea1c464 gfileutils: Implement GFileSetContentsFlags
This moves `write_to_temp_file()` into `g_file_set_contents_full()` and
coalesces its handling of `do_fsync` with the `rename_file()` call. It
adds support for `G_FILE_SET_CONTENTS_DURABLE` and
`G_FILE_SET_CONTENTS_NONE` — previously only
`G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING` was
supported.

In the case that `G_FILE_SET_CONTENTS_CONSISTENT |
G_FILE_SET_CONTENTS_DURABLE` is set, an additional `fsync()` is now done
on the directory after renaming the temporary file.

In the case that `G_FILE_SET_CONTENTS_ONLY_EXISTING` isn’t set, the
`fsync()` after writing the temporary file will always be done (unless
the file system guarantees it never needs to be done).

In the case that only `G_FILE_SET_CONTENTS_DURABLE` is set, the
destination file will be written to directly (using this mode is not
really advised).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1302
2020-07-26 21:37:46 +01:00
Philip Withnall
387c159862 gfileutils: Tidy up types of length arguments in helper functions
We can guarantee that they’re non-negative.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:37:46 +01:00
Philip Withnall
e4e618c604 gfileutils: Factor out fsync calculation
This introduces no functional changes, just makes the code a bit more
modular and reusable.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:37:46 +01:00
Philip Withnall
00c17de72e gfileutils: Split out write_to_file() helper function
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:37:46 +01:00
Philip Withnall
554107c23c gfileutils: Add g_file_set_contents_full() and GFileSetContentsFlags
This is a new version of the g_file_set_contents() API which will allow
its safety to be controlled by some flags, allowing the user to choose
their preferred tradeoff between safety (`fsync()` calls) and speed.

Currently, the flags do nothing and the new API behaves like the old
API. This will change in the following commits.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1302
2020-07-26 21:37:46 +01:00
Nirbheek Chauhan
4e485d76ac gio: Remove broken support for XP
We now require Windows 7 or newer, and the networking code hasn't
worked in a long time since we directly use symbols from iphlapi.dll
now.
2020-07-26 21:30:05 +05:30
Marc-André Lureau
5b49df3b9f Merge branch 'uri-non-utf8' into 'master'
Fix non-utf8 URI pct-decoding / unescape regression

Closes #2165

See merge request GNOME/glib!1569
2020-07-26 14:24:53 +00:00
Philip Withnall
c60d6599c9 Merge branch 'mach_monotonic_time_use_timebase_struct' into 'master'
gmain: fix fetching timebase on non-Intel Darwin

Closes #858

See merge request GNOME/glib!1566
2020-07-26 13:22:48 +00:00
Marc-André Lureau
22fe3b0224 uri: fix regression in g_uri_unescape_segment/string
The previous implementation of g_uri_unescape_segment() allowed non-utf8
decoded characters. uri_decoder() allows it too with FLAGS_ENCODED (I
think it's abusing a bit the user-facing flags for some internal
decoding behaviour)

However, it didn't allow \0 in the decoded string. Let's have an extra
check for that, outside of uri_decoder().

Fixes: d83d68d64c
Reported-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-07-26 17:19:43 +04:00
Marc-André Lureau
ea395e3fdd uri: add a GError to the new g_uri_unescape_bytes()
Suggested-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-07-26 17:19:37 +04:00
Philip Withnall
d5513ef72c Merge branch 'giomodule-cache' into 'master'
Fix giomodule.cache being wrongly considered stale

Closes #2127

See merge request GNOME/glib!1560
2020-07-25 23:10:25 +00:00
Philip Withnall
41ffa411e8 Merge branch '2132-quark-ctor-supp' into 'master'
glib.supp: Generalise some g_quark_init() suppressions

Closes #2132

See merge request GNOME/glib!1543
2020-07-25 20:16:03 +00:00
Philip Withnall
0b75a92823 Merge branch '2129-tz-slim-tests' into 'master'
tests: Add tests for RFC 8536 v3 parsing of time zones

See merge request GNOME/glib!1578
2020-07-25 18:44:29 +00:00
Philip Withnall
060fda09eb Merge branch 'task-set-name-version' into 'master'
gtask: Only override g_task_set_source_tag() for GLib ≥ 2.60

See merge request GNOME/glib!1576
2020-07-25 17:16:44 +00:00
Philip Withnall
50f8a9d32a Merge branch '422-xattr-binary-data' into 'master'
Fix support for binary xattrs

Closes #422

See merge request GNOME/glib!1568
2020-07-25 17:13:55 +00:00
Philip Withnall
c05252b4f1 Merge branch 'uri-illegal' into 'master'
uri: add illegal_characters argument to unescape_bytes

See merge request GNOME/glib!1577
2020-07-25 14:49:28 +00:00
Philip Withnall
1378a40734 ci: Limit depth of fetch for initial code checks
Rather than fetching the entire repository history, limit the fetch
depth to commits in the last 4 weeks. If a branch was branched longer
than 4 weeks ago, it seems reasonable to require it to be rebased before
it can be reviewed.

At the current rate of development, this reduces the bandwidth needed
for git pulls in the initial code checks from 73MB to 9MB.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-25 01:15:02 +01:00
Philip Withnall
b80b864fe3 tests: Add a test for getting/setting xattrs on a local file
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #422
2020-07-24 23:43:01 +01:00
Emmanuele Bassi
221e32d9ac Merge branch 'g-getenv-everywhere' into 'master'
glib: Use g_getenv everywhere instead of getenv

See merge request GNOME/glib!1579
2020-07-23 12:34:31 +00:00
Nirbheek Chauhan
c3c2c31335 glib: Use g_getenv everywhere instead of getenv
`getenv()` doesn't work well on Windows, f.ex., it can't fetch env
vars set with `SetEnvironmentVariable()`. This also means that it
doesn't work at all when targeting UWP since that's the only way to
set env vars in that case.
2020-07-23 13:57:59 +05:30
Philip Withnall
98a7d6e389 tests: Add tests for RFC 8536 v3 parsing of time zones
This adds really basic validation that `GTimeZone` can successfully
parse a ‘slim’ format timezone file.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #2129
2020-07-17 15:08:59 +01:00
Philip Withnall
e18a6a28db tests: Incorporate bug base into g_test_bug() calls in gdatetime tests
This will allow the following commit to refer to GitLab in its
`g_test_bug()` call.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-17 15:08:59 +01:00
Philip Withnall
f5b4a6b9cc Merge branch 'GDateTime-TZif' into 'master'
GDateTime fixes to handle TZif footers

Closes #2129

See merge request GNOME/glib!1533
2020-07-17 13:54:48 +00:00
Paul Eggert
4408e69a0f gtimezone: add FIXME comments 2020-07-16 12:44:25 -07:00