Low-level core library that forms the basis for projects such as GTK+ and GNOME.
Go to file
Philip Withnall 87e19535fe glocalfileoutputstream: Fix CREATE_REPLACE_DESTINATION with symlinks
The `G_FILE_CREATE_REPLACE_DESTINATION` flag is equivalent to unlinking
the destination file and re-creating it from scratch. That did
previously work, but in the process the code would call `open(O_CREAT)`
on the file. If the file was a dangling symlink, this would create the
destination file (empty). That’s not an intended side-effect, and has
security implications if the symlink is controlled by a lower-privileged
process.

Fix that by not opening the destination file if it’s a symlink, and
adjusting the rest of the code to cope with
 - the fact that `fd == -1` is not an error iff `is_symlink` is true,
 - and that `original_stat` will contain the `lstat()` results for the
   symlink now, rather than the `stat()` results for its target (again,
   iff `is_symlink` is true).

This means that the target of the dangling symlink is no longer created,
which was the bug. The symlink itself continues to be replaced (as
before) with the new file — this is the intended behaviour of
`g_file_replace()`.

The behaviour for non-symlink cases, or cases where the symlink was not
dangling, should be unchanged.

Includes a unit test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2325
2021-03-10 17:55:51 +00:00
.gitlab-ci ci: Ensure the machine-id is set on the Fedora CI image 2021-03-01 13:55:03 +00:00
docs gspawn: Add new g_spawn_async_with_pipes_and_fds() API 2021-02-16 13:44:00 +00:00
fuzzing Fix wrong position for static qualifier warning in fuzzing/fuzz_dbus_message.c 2021-02-10 20:41:16 +01:00
gio glocalfileoutputstream: Fix CREATE_REPLACE_DESTINATION with symlinks 2021-03-10 17:55:51 +00:00
glib gbitlock.c: replace remaining 'asm' with '__asm__' 2021-03-04 04:39:27 +06:00
gmodule Fix g_module_symbol() under Windows sometimes not succeeding 2020-09-30 09:57:40 +02:00
gobject glib-genmarshal: close output file 2021-03-03 12:24:29 +06:00
gthread Meson: Override every dependency glib provides 2020-04-05 00:34:04 -04:00
m4macros m4macros: Increment serial number of glib-2.0.m4 2021-01-27 11:55:37 +00:00
po Updated Spanish translation 2021-03-10 12:47:52 +01:00
subprojects Bump the libsysprof-capture dependency 2020-11-14 18:41:07 +00:00
tests threadpool test: Don't leak the thread pool 2021-01-29 20:26:05 +00:00
.clang-format CI: Code check formating in CI 2019-11-21 14:03:01 -06:00
.dir-locals.el Add .dir-locals.el to tell Emacs users not to use tabs for C 2012-07-30 04:09:08 -04:00
.gitattributes git: Add .gitattributes file with EOL settings for README.win32 2017-07-10 11:35:31 +01:00
.gitignore build: Drop autotools support 2019-01-15 15:11:43 +00:00
.gitlab-ci.yml ci: Ensure the machine-id is set on the Fedora CI image 2021-03-01 13:55:03 +00:00
AUTHORS docs: Rename README.in to README.md for GitLab 2018-06-15 13:04:59 +01:00
check-abis.sh Correct shellcheck errors (and ignore world splitting when we want it) 2020-11-15 17:34:27 +01:00
clang-format-diff.py py: Reformat all Python files consistently 2020-11-17 15:50:07 +00:00
CONTRIBUTING.md docs: The mailing lists are no more 2019-07-23 11:05:17 +01:00
COPYING Update COPYING file to LGPLv2.1 2017-05-29 19:53:35 +02:00
glib-gettextize.in tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
glib.doap doap: Update the <mailing-list> element 2019-07-23 11:27:30 +01:00
glib.supp glib.supp: Add another system thread suppression 2021-03-09 12:34:39 +00:00
HACKING docs: Update HACKING and README to mention Meson rather than autotools 2019-01-15 15:11:43 +00:00
INSTALL.in docs: Update INSTALL.in to mention Meson rather than autotools 2019-01-15 15:11:43 +00:00
meson_options.txt build: Add glib_debug option 2021-01-20 16:05:36 +01:00
meson.build gdbusprivate: Stop hard-coding path to /var/lib 2021-03-01 13:44:20 +00:00
msvc_recommended_pragmas.h Adding macros G_NORETURN and G_NORETURN_FUNCPTR 2020-11-25 11:34:05 +00:00
NEWS 2.67.5 2021-03-01 13:36:00 +00:00
NEWS.pre-1-3 updates. 2001-04-03 19:22:44 +00:00
README docs: Rename README.in to README.md for GitLab 2018-06-15 13:04:59 +01:00
README.md docs: Move ‘Notes’ section from README to NEWS 2021-01-13 13:58:57 +00:00
README.rationale docs: Add a README.rationale documenting major design decisions 2014-05-04 18:22:09 +01:00
README.win32 README.win32: Update and convert to markdown 2019-08-27 12:57:32 +05:30
README.win32.md README.win32.md: Mention about Window 8+ SDK requirement 2021-02-28 11:04:29 +02:00
template-tap.test.in tests: Remove redundant --tap options 2019-05-14 12:42:51 +01:00
template.test.in Meson: Install glib tests 2018-07-16 15:36:20 -04:00

GLib

GLib is the low-level core library that forms the basis for projects such as GTK and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.

The official download locations are: https://download.gnome.org/sources/glib

The official web site is: https://www.gtk.org/

Installation

See the file 'INSTALL.in'

How to report bugs

Bugs should be reported to the GNOME issue tracking system. (https://gitlab.gnome.org/GNOME/glib/issues/new). You will need to create an account for yourself.

In the bug report please include:

  • Information about your system. For instance:
    • What operating system and version
    • For Linux, what version of the C library
    • And anything else you think is relevant.
  • How to reproduce the bug.
    • If you can reproduce it with one of the test programs that are built in the tests/ subdirectory, that will be most convenient. Otherwise, please include a short test program that exhibits the behavior. As a last resort, you can also provide a pointer to a larger piece of software that can be downloaded.
  • If the bug was a crash, the exact text that was printed out when the crash occurred.
  • Further information such as stack traces may be useful, but is not necessary.

Patches

Patches should also be submitted as merge requests to gitlab.gnome.org. If the patch fixes an existing issue, please refer to the issue in your commit message with the following notation (for issue 123): Closes: #123

Otherwise, create a new merge request that introduces the change, filing a separate issue is not required.