| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
This is useful when you want to log with a MESSAGE_ID, but not print
to stdout.
|
| |
|
|
|
|
| |
For file operations, it's relevant.
|
|
|
|
|
|
|
| |
We had a g_prefix_error() for the lsetxattr() path, but not
fsetxattr(). Add one for the latter, and change the former to not use
the pathname because we always go through /proc/self/fd so it won't be
useful to show.
|
|
|
|
|
| |
This will be used in the OSTree checkout code, where we want to
mkdir() and then open it.
|
|
|
|
| |
This is a Linux-specific way to work around the missing lsetxattrat().
|
|
|
|
|
| |
Unprivileged users won't be able to copy e.g. security.selinux; let's
ignore this by default, the same way coreutils does.
|
| |
|
| |
|
|
|
|
| |
See https://mail.gnome.org/archives/desktop-devel-list/2014-February/msg00028.html
|
|
|
|
|
|
| |
Needed for g_clear_pointer().
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
|
|
| |
Hooray for rpmlint.
|
|
|
|
| |
This ensures we're not overwriting any earlier output.
|
|
|
|
|
| |
A bit tricky; we have to move the implementation into an internal
helper.
|
| |
|
|
|
|
|
|
| |
This function is not universally available, and since we don't have our
own autoconf script to check for it, just assume that we have it iff
we're on Linux.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For SELinux, it's crucial that we actually copy the "security.selinux"
xattr which provides the security context. the "cp_a" name kind of
strongly implies that we do what coreutils "cp -a" does, and this patch
moves us a lot closer to what it says on the tin.
Concretely, we now match directory modes (and ownership), and we copy
all xattrs for directories.
We're not (yet) copying xattrs for files, but sadly this is a GLib bug.
This patch will allow OSTree to simply use gs_shutil_cp_a() for merging
configuration.
Still TODO:
* Timestamps
https://bugzilla.gnome.org/show_bug.cgi?id=711058
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a warning found during Coverity scan.
Error: REVERSE_INULL (CWE-476): [#def5]
libgsystem/gsystem-subprocess.c:949: deref_ptr_in_call: Dereferencing pointer "context".
libgsystem/gsystem-subprocess-context.c:330:3: deref_parm: Directly dereferencing parameter "self".
libgsystem/gsystem-subprocess.c:960: check_after_deref: Null-checking "context" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
| |
Like cp -a gs_shutil_cp_a should really copy all directory metadata.
This adds support for at least copying the ownership metadata
(user/group).
https://bugzilla.gnome.org/show_bug.cgi?id=711057
|
|
|
|
|
|
| |
This error was found by running Coverity.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
| |
This error was found by running Coverity.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
In case of creating an existing file name, gs_file_open_in_tmpdir_at did
not retry and failed to create the temporary file (while signalling
success).
This error was found by running Coverity.
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
|
| |
This enables gcc with -Wuninitialized to warn if the cleanup function is used
on an uninitialised variable.
|
| |
|
| |
|
| |
|
|
|
|
| |
The proper prefix is gsystem_, not gs_
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=708824
|
|
|
|
| |
So we don't leak it.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The gs_file_get_path_cached() was rather brittle in its handling
of URIs. It would assert() when a GFile didn't have a backing path
(such as when handling trash: or recent: URIs), and didn't know
how to get the target URI for those items either.
Make sure that we do not assert() when a backing path cannot be
found, and handle recent: and trash: URIs.
https://bugzilla.gnome.org/show_bug.cgi?id=708435
|
|
|
|
|
| |
This was only used by OSTree as far as I know, and it now has a better
solution.
|
|
|
|
| |
While we're here, also squash spaces in the filename to '_'.
|
|
|
|
|
| |
We can apparently get this if we try to open with O_NOFOLLOW a chain
of symlinks. Just treat it like it's not a directory so we unlink.
|
|
|
|
|
| |
This is safer against concurrent modification, as well as being more
efficient.
|
|
|
|
|
|
|
| |
While porting relevant parts of OSTree to use openat()/renameat() and
friends, it commonly occurs that I wanted to do
gs_file_read_noatime(). Make a variant of that API, named differently
because the _noatime implies reading.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modern UNIX come with a variety of filesystem API suffixed with "at",
like openat(), linkat(), etc. The reason for their existence
is multiple.
First, if you're doing a lot of file operations in a directory, it's
simply more efficient to avoid having the kernel traverse potentially
long pathnames constantly.
Second, this avoids a problem where if a user does e.g.:
rm -rf somedir &
mv somedir othername
mkdir somedir
touch somedir/otherfile
We won't end up deleting otherfile, because all of our operations are
relative to the original "somedir".
The second rationale is unlikely to matter for OSTree since we'll
assume the user isn't going to move a repository around while we're
committing to it, but anyways, it's just better to use fd-relative
pathnames.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If two threads both call gs_file_get_path_cached() on the same GFile,
then it's possible that both threads see the pathname isn't cached,
and set the qdata. The second one will end up freeing the cached
qdata from the first, causing it to read freed memory.
Fix this by just slapping a lock around the whole business.
This was observed in the real world in ostree where two threads were
calling gs_file_get_path_cached() on the shared repo->tmp_dir.
But really, what we want to do is two things:
1) Upstream this into gio
2) Stop using gs_file_get_path_cached() so much; instead, we
should be using openat() and friends. This will also
avoid malloc, and help us earn our UNIX merit badge.
|
|
|
|
|
|
|
| |
When passed an invalid GFile, or one that's not FUSE backed,
we should error out properly instead of not returning an error.
https://bugzilla.gnome.org/show_bug.cgi?id=699252
|
|
|
|
| |
Needed for ostree to chown symbolic links.
|
|
|
|
|
|
| |
This was tripping a compiler warning in NetworkManager; the right way
to fix it is actually to be less magical in the macro and lose our
synthesized *. Instead add it explicitly for each type.
|
|
|
|
| |
NetworkManager uses strvs quite a lot.
|
|
|
|
| |
Reported-by: Pavel Šimerda <psimerda@redhat.com>
|
|
|
|
| |
It's not useful since we're wrapping the API.
|
|
|
|
| |
I was getting duplicated output on RHEL6.
|
|
|
|
|
|
|
|
|
| |
Will be used by ostree. Since libgsystem will return raw
GUnix{Input,Output}Stream, we need a way to fstat() them. Maybe we
should also have an API to synthesize a #GFileInfo, but that's hard
without duplicating all the complex stuff in GIO.
https://bugzilla.gnome.org/show_bug.cgi?id=706031
|
|
|
|
| |
Since I'm using these more now in ostree, and let's be comprehensive.
|
|
|
|
|
|
| |
I will test my code before pushing.
I will test my code before pushing.
I will test my code before pushing.
|
| |
|
|
|
|
| |
Used in ostree.
|