public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Ondrej Holy <oholy@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gvfs] f45: Fix SSH agent discovery with oo7
Date: Fri, 16 Oct 2026 09:04:32 GMT	[thread overview]
Message-ID: <179214147231.1.3672707010279446841.rpms-gvfs-2c47267c0cbe@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gvfs
            Branch : f45
            Commit : 2c47267c0cbe0fddfd61dc8ae9ed35985980fd44
            Author : Ondrej Holy <oholy@redhat.com>
            Date   : 2026-10-16T10:59:23+02:00
            Stats  : +186/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/gvfs/c/2c47267c0cbe0fddfd61dc8ae9ed35985980fd44?branch=f45

            Log:
            Fix SSH agent discovery with oo7

Resolves: rhbz#2552171

---
diff --git a/build-Add-an-option-to-start-an-SSH-agent-before-GVfs.patch b/build-Add-an-option-to-start-an-SSH-agent-before-GVfs.patch
new file mode 100644
index 0000000..dc20ea8
--- /dev/null
+++ b/build-Add-an-option-to-start-an-SSH-agent-before-GVfs.patch
@@ -0,0 +1,121 @@
+From bce2cdc57ee9c9cb8b799996230e5ed2294dd512 Mon Sep 17 00:00:00 2001
+From: Ondrej Holy <oholy@redhat.com>
+Date: Fri, 16 Oct 2026 10:47:42 +0200
+Subject: [PATCH] build: Add an option to start an SSH agent before GVfs
+
+Currently, GVfs can start before the session's SSH agent exports its socket.
+This leaves the daemon without `SSH_AUTH_SOCK`. Let's add
+`systemd_ssh_agent_unit` to order agent startup before GVfs. Distributors
+using GCR should set `-Dsystemd_ssh_agent_unit=gcr-ssh-agent.socket`.
+
+Related: https://gitlab.gnome.org/GNOME/gvfs/-/work_items/886
+
+Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
+---
+ daemon/gvfs-daemon.service.in |  2 +-
+ daemon/meson.build            |  7 ++++++-
+ docs/documentation.md         | 15 +++++++++++++++
+ meson.build                   |  8 ++++++++
+ meson_options.txt             |  1 +
+ 5 files changed, 31 insertions(+), 2 deletions(-)
+
+diff --git a/daemon/gvfs-daemon.service.in b/daemon/gvfs-daemon.service.in
+index a70ee3af..40e60ccc 100644
+--- a/daemon/gvfs-daemon.service.in
++++ b/daemon/gvfs-daemon.service.in
+@@ -1,7 +1,7 @@
+ [Unit]
+ Description=Virtual filesystem service
+ PartOf=graphical-session.target
+-
++@ssh_agent_dependencies@
+ [Service]
+ ExecStart=@libexecdir@/gvfsd
+ Type=dbus
+diff --git a/daemon/meson.build b/daemon/meson.build
+index b3416b2e..469b9333 100644
+--- a/daemon/meson.build
++++ b/daemon/meson.build
+@@ -8,10 +8,15 @@ dbus_systemd_service = ''
+ if install_systemd_systemduserunitdir
+   service = 'gvfs-daemon.service'
+ 
++  ssh_agent_dependencies = ''
++  if enable_systemd_ssh_agent
++    ssh_agent_dependencies = 'Wants=@0@\nAfter=@0@\n'.format(systemd_ssh_agent_unit)
++  endif
++
+   configure_file(
+     input: service + '.in',
+     output: '@BASENAME@',
+-    configuration: service_conf,
++    configuration: service_conf + {'ssh_agent_dependencies': ssh_agent_dependencies},
+     install: true,
+     install_dir: systemd_systemduserunitdir,
+   )
+diff --git a/docs/documentation.md b/docs/documentation.md
+index 2355af5c..42ad522e 100644
+--- a/docs/documentation.md
++++ b/docs/documentation.md
+@@ -32,6 +32,21 @@ using standard `GMountOperation` object.
+ All daemons are listening to session bus changes and will exit once the bus is
+ torn down. Should this not be true, please file a bug.
+ 
++### SSH agent integration
++
++SFTP uses the runtime `SSH_AUTH_SOCK` inherited from `gvfsd`, falling back to
++GNOME Keyring when unset or empty. For systemd sessions, configure agent startup
++ordering with:
++
++```
++meson setup build -Dsystemd_ssh_agent_unit=gcr-ssh-agent.socket
++```
++
++This adds `Wants=` and `After=` to `gvfs-daemon.service`. The selected unit must
++export `SSH_AUTH_SOCK` to the systemd user manager before startup completes,
++as GCR's socket does. The default is empty, adding no dependencies. The option
++only affects systemd-activated GVfs and is unrelated to `gcr` certificate support.
++
+ ## Environment variables
+ 
+ See also
+diff --git a/meson.build b/meson.build
+index 25973eb1..1a5b6d4a 100644
+--- a/meson.build
++++ b/meson.build
+@@ -273,6 +273,13 @@ gio_schemasdir = gio_dep.get_variable(
+ systemd_systemduserunitdir = get_option('systemduserunitdir')
+ install_systemd_systemduserunitdir = (systemd_systemduserunitdir != 'no')
+ 
++systemd_ssh_agent_unit = get_option('systemd_ssh_agent_unit')
++enable_systemd_ssh_agent = (systemd_ssh_agent_unit != '')
++if enable_systemd_ssh_agent
++  assert(systemd_ssh_agent_unit.endswith('.socket') or systemd_ssh_agent_unit.endswith('.service'),
++         'systemd_ssh_agent_unit must name a socket or service unit')
++endif
++
+ systemd_tmpfilesdir = get_option('tmpfilesdir')
+ install_systemd_tmpfilesdir = (systemd_tmpfilesdir != 'no')
+ 
+@@ -512,6 +519,7 @@ gnome.post_install(
+ summary({
+   'busy_processes_command': busy_processes_command,
+   'systemduserunitdir': systemd_systemduserunitdir,
++  'systemd_ssh_agent_unit': systemd_ssh_agent_unit,
+   'tmpfilesdir': systemd_tmpfilesdir,
+   'privileged_group': privileged_group,
+ }, section: 'Configuration')
+diff --git a/meson_options.txt b/meson_options.txt
+index 60ca4935..86ad4902 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,5 +1,6 @@
+ option('busy_processes_command', type: 'combo', choices: ['lsof', 'fuser'], value: 'lsof', description: 'Command used to detect processes blocking unmount')
+ option('systemduserunitdir', type: 'string', value: '', description: 'custom directory for systemd user units, or \'no\' to disable')
++option('systemd_ssh_agent_unit', type: 'string', value: '', description: 'systemd unit exporting SSH_AUTH_SOCK (empty to use session environment)')
+ option('tmpfilesdir', type: 'string', value: '', description: 'custom directory for tmpfiles.d config files, or \'no\' to disable')
+ option('privileged_group', type: 'string', value: 'wheel', description: 'custom name for group that has elevated permissions')
+ 
+-- 
+2.56.0
+

diff --git a/gvfs.spec b/gvfs.spec
index 8a55753..7a4ee3c 100644
--- a/gvfs.spec
+++ b/gvfs.spec
@@ -28,6 +28,12 @@ License: LGPL-2.0-or-later AND GPL-3.0-only AND MPL-2.0 AND BSD-3-Clause-Sun
 URL:     https://wiki.gnome.org/Projects/gvfs
 Source0: https://download.gnome.org/sources/%{name}/%{gnome_major_minor_version}/%{name}-%{version}.tar.xz
 
+# Fix SSH agent discovery with oo7
+# https://gitlab.gnome.org/GNOME/gvfs/-/commit/bce2cdc57ee9c9cb8b799996230e5ed2294dd512
+# https://gitlab.gnome.org/GNOME/gvfs/-/commit/5524028eba7c382be2b9e8a674e37badf311e3ca
+Patch: build-Add-an-option-to-start-an-SSH-agent-before-GVfs.patch
+Patch: sftp-Prefer-SSH_AUTH_SOCK-over-GNOME-Keyring.patch
+
 BuildRequires: meson
 BuildRequires: gcc
 BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
@@ -191,6 +197,7 @@ file services.
 %build
 %meson \
        -Dman=true \
+       -Dsystemd_ssh_agent_unit=gcr-ssh-agent.socket \
 %ifarch s390 s390x
        -Dafc=false \
        -Dgphoto2=false \

diff --git a/sftp-Prefer-SSH_AUTH_SOCK-over-GNOME-Keyring.patch b/sftp-Prefer-SSH_AUTH_SOCK-over-GNOME-Keyring.patch
new file mode 100644
index 0000000..078c815
--- /dev/null
+++ b/sftp-Prefer-SSH_AUTH_SOCK-over-GNOME-Keyring.patch
@@ -0,0 +1,58 @@
+From 5524028eba7c382be2b9e8a674e37badf311e3ca Mon Sep 17 00:00:00 2001
+From: Ondrej Holy <oholy@redhat.com>
+Date: Fri, 16 Oct 2026 10:47:48 +0200
+Subject: [PATCH] sftp: Prefer SSH_AUTH_SOCK over GNOME Keyring
+
+Currently, SFTP always queries GNOME Keyring for its SSH agent socket,
+potentially overriding the session's agent. This also fails in sessions
+using oo7 instead of GNOME Keyring. Let's use an inherited `SSH_AUTH_SOCK`
+when available and keep the legacy lookup only as a fallback, with warnings
+explaining how to configure the environment or agent startup ordering.
+
+Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/work_items/886
+
+Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
+---
+ daemon/gvfsbackendsftp.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
+index 2c9a45e0..7ed35fed 100644
+--- a/daemon/gvfsbackendsftp.c
++++ b/daemon/gvfsbackendsftp.c
+@@ -430,12 +430,19 @@ setup_ssh_environment (void)
+   GError *error;
+   GVariant *iter;
+   gchar *env;
+-  
++  const gchar *ssh_auth_sock;
++
++  ssh_auth_sock = g_getenv ("SSH_AUTH_SOCK");
++  if (ssh_auth_sock && ssh_auth_sock[0])
++    return;
++
+   error = NULL;
+   conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+   if (! conn)
+     {
+-      g_warning ("Failed to setup SSH evironment: %s (%s, %d)",
++      g_warning ("Failed to obtain SSH_AUTH_SOCK from GNOME Keyring: %s (%s, %d). "
++                 "Set SSH_AUTH_SOCK in the GVfs activation environment, or configure "
++                 "systemd_ssh_agent_unit at build time.",
+                  error->message, g_quark_to_string (error->domain), error->code);
+       g_error_free (error);
+       return;
+@@ -455,7 +462,9 @@ setup_ssh_environment (void)
+   if (! iter)
+     {
+       g_dbus_error_strip_remote_error (error);
+-      g_warning ("Failed to setup SSH evironment: %s (%s, %d)",
++      g_warning ("Failed to obtain SSH_AUTH_SOCK from GNOME Keyring: %s (%s, %d). "
++                 "Set SSH_AUTH_SOCK in the GVfs activation environment, or configure "
++                 "systemd_ssh_agent_unit at build time.",
+                  error->message, g_quark_to_string (error->domain), error->code);
+       g_error_free (error);
+     }
+-- 
+2.56.0
+

                 reply	other threads:[~2026-10-16  9:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179214147231.1.3672707010279446841.rpms-gvfs-2c47267c0cbe@fedoraproject.org \
    --to=oholy@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox