After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630485 - Minor fix to avoid runtime directory not being created.
Minor fix to avoid runtime directory not being created.
Status: RESOLVED OBSOLETE
Product: gdm
Classification: Core
Component: general
2.31.x
Other Solaris
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
: 683951 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-24 05:23 UTC by Brian Cameron
Modified: 2018-05-24 10:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch fixing issue. (621 bytes, patch)
2010-09-24 05:23 UTC, Brian Cameron
none Details | Review
daemon: Extract unsafe code from GSpawnChildSetupFunc (6.40 KB, patch)
2012-09-13 20:25 UTC, Colin Walters
reviewed Details | Review
daemon: Delete unused group code (6.62 KB, patch)
2012-09-13 20:25 UTC, Colin Walters
accepted-commit_now Details | Review
daemon: Do global uid-specific setup before launching dbus (8.40 KB, patch)
2012-09-13 20:25 UTC, Colin Walters
reviewed Details | Review
daemon: Further cleanup of error handling (6.62 KB, patch)
2012-09-13 20:25 UTC, Colin Walters
reviewed Details | Review
daemon: Create home directory for greeter user (1.34 KB, patch)
2012-09-13 20:25 UTC, Colin Walters
reviewed Details | Review
daemon: Major cleanup of greeter environment setup (19.93 KB, patch)
2012-09-14 00:19 UTC, Colin Walters
committed Details | Review
daemon: Create home directory for greeter user (1.18 KB, patch)
2012-09-14 00:19 UTC, Colin Walters
committed Details | Review

Description Brian Cameron 2010-09-24 05:23:55 UTC
Created attachment 170999 [details] [review]
patch fixing issue.

Since GDM allows the screenshot directory (GDM_SCREENSHOT_DIR) to be configured via --with-screenshot-dir, it isn't necessarily in the same directory as the GDM_XAUTH_DIR (/var/run/gdm).  So, GDM can fail if the specified directory is in a subdirectory that doesn't exist.  This minor patch fixes this issue.  It's a trivial fix and makes GDM a bit more robust, so I'm hoping this can go upstream.
Comment 1 André Klapper 2012-02-03 13:47:27 UTC
Comment on attachment 170999 [details] [review]
patch fixing issue.

[Setting "patch" flag and correcting mime type so this can actually be queried for.]
Comment 2 Colin Walters 2012-09-13 20:25:12 UTC
Created attachment 224268 [details] [review]
daemon: Extract unsafe code from GSpawnChildSetupFunc

For example, g_warning() can try to lock a mutex; if another thread
happened to be holding that mutex from before we forked, we'd
deadlock.
Comment 3 Colin Walters 2012-09-13 20:25:18 UTC
Created attachment 224269 [details] [review]
daemon: Delete unused group code

gdm-simple-slave is only passing user-name, so this group lookup
stuff is unnecessary complication.

I can't imagine a use case for it either - you really want the default
group for the user, not some arbitrary other group.
Comment 4 Colin Walters 2012-09-13 20:25:21 UTC
Created attachment 224270 [details] [review]
daemon: Do global uid-specific setup before launching dbus

We want to create the runtime dir for example before we do anything
else.

This also cleans up the code significantly by not looking up the
username twice; we just pass the passwd entry down into child
functions.
Comment 5 Colin Walters 2012-09-13 20:25:25 UTC
Created attachment 224271 [details] [review]
daemon: Further cleanup of error handling

Rather than an incoherent mess of "sometimes print errors, sometimes
pass them up, sometimes do both", clean up the chain of dbus-launch
running to consistently pass errors up, and print in the first public
API that doesn't throw a GError.
Comment 6 Colin Walters 2012-09-13 20:25:29 UTC
Created attachment 224272 [details] [review]
daemon: Create home directory for greeter user

For OSTree, I'm trying to move components to a model where they
automatically create whatever directories/files are needed in /var.
This helps with upgrade/downgrade scenarios.

In GDM's case, this is pretty easy to do because we start with full
root privileges.
Comment 7 Colin Walters 2012-09-13 20:26:26 UTC
Blah, these were meant to go on bug 683951
Comment 8 Colin Walters 2012-09-13 20:26:40 UTC
*** Bug 683951 has been marked as a duplicate of this bug. ***
Comment 9 Colin Walters 2012-09-13 20:30:07 UTC
(In reply to comment #0)
> Created an attachment (id=170999) [details] [review]
> patch fixing issue.
> 
> Since GDM allows the screenshot directory (GDM_SCREENSHOT_DIR) to be configured
> via --with-screenshot-dir, it isn't necessarily in the same directory as the
> GDM_XAUTH_DIR (/var/run/gdm).  So, GDM can fail if the specified directory is
> in a subdirectory that doesn't exist.  This minor patch fixes this issue.  It's
> a trivial fix and makes GDM a bit more robust, so I'm hoping this can go
> upstream.

Hi Brian - can you elaborate? In what cases would the screenshot parent directory not exist?

I'm not sure gdm should be the process creating e.g. /var/run automatically...you really want the ownership/permissions to be propagated from a process that handles that more centrally.
Comment 10 Ray Strode [halfline] 2012-09-13 20:55:53 UTC
Review of attachment 224268 [details] [review]:

::: daemon/gdm-launch-environment.c
@@ +382,3 @@
 typedef struct {
+        struct passwd   *pwent;
+        struct group    *grent;

pwent and grent point to glibc owned memory with that could go away accidentally at any time. Even if it's okay with the current circumstances, I don't like the idea of maintaining a pointer to them in a data struct (conceptually it rubs me the wrong way).  I'd rather you copy the fields you need.
Comment 11 Ray Strode [halfline] 2012-09-13 20:57:00 UTC
Review of attachment 224269 [details] [review]:

decruftification request graciously accepted.
Comment 12 Ray Strode [halfline] 2012-09-13 21:02:49 UTC
Review of attachment 224270 [details] [review]:

::: daemon/gdm-launch-environment.c
@@ +439,3 @@
 static gboolean
+spawn_command_line_sync_as_user (const char      *command_line,
+                                 struct passwd   *pwent,

hmm again, i think i'd rather the fields you use get passed in directly.  I don't really like keeping this memory that can disappear at any moment hanging around in a data structure (even if it's safe as written currently)
Comment 13 Ray Strode [halfline] 2012-09-13 21:05:48 UTC
Review of attachment 224271 [details] [review]:

sure

::: daemon/gdm-launch-environment.c
@@ +556,2 @@
  out:
+        if (match_info)

!= NULL

@@ +557,3 @@
+        if (match_info)
+                g_match_info_free (match_info);
+        if (re)

!= NULL

@@ +601,2 @@
  out:
+        if (env) {

!= NULL

@@ +767,3 @@
 
+        if (!start_dbus_daemon (launch_environment, passwd_entry, error))
+                goto out;

braces
Comment 14 Ray Strode [halfline] 2012-09-13 21:07:38 UTC
Review of attachment 224272 [details] [review]:

::: daemon/gdm-launch-environment.c
@@ +769,3 @@
+        if (!ensure_directory_with_uid_gid (passwd_entry->pw_dir,
+                                            passwd_entry->pw_uid, passwd_entry->pw_gid,
+                                            error))

all arguments on their own line if any arguments on their own line. I was going to say add braces too, but none of the surround coding does so...
Comment 15 Colin Walters 2012-09-14 00:19:23 UTC
Created attachment 224289 [details] [review]
daemon: Major cleanup of greeter environment setup

Ok, this is a rollup of the other 4 - trying to address the comments I
got cascading conflicts.  Let me know if you have a non-small desire
for it to be split again.
Comment 16 Colin Walters 2012-09-14 00:19:33 UTC
Created attachment 224290 [details] [review]
daemon: Create home directory for greeter user

Rebased
Comment 17 Ray Strode [halfline] 2012-09-14 16:07:38 UTC
I'd prefer if the patches were split, but i'm not going to sweat it.  So feel free to push these guys.

I'm not super happy that various debug messages are getting dropped from the child func, but I understand your deadlock concern.

Eventually we'll use sd_journal_stream_fd for debugging and can just drop to doing write() calls to get debug back in slippery areas like that I suppose.
Comment 18 Colin Walters 2012-09-15 14:27:25 UTC
(In reply to comment #17)
> I'd prefer if the patches were split, but i'm not going to sweat it.  So feel
> free to push these guys.

Thanks for the review!

> I'm not super happy that various debug messages are getting dropped from the
> child func, but I understand your deadlock concern.

Yeah, I agree:

> Eventually we'll use sd_journal_stream_fd for debugging and can just drop to
> doing write() calls to get debug back in slippery areas like that I suppose.

To report errors correctly from child->parent, you create a pipe dedicated to errors, and write them over that.  This is what gspawn.c does.

Maybe in the GSubprocess future we could have a helper for making the pipe and turning child errors into GErrors.
Comment 19 Colin Walters 2012-09-15 14:28:41 UTC
Attachment 224289 [details] pushed as aea73de - daemon: Major cleanup of greeter environment setup
Attachment 224290 [details] pushed as a5df862 - daemon: Create home directory for greeter user
Comment 20 Ray Strode [halfline] 2012-09-17 17:36:02 UTC
well bubbling them to the parent is one idea, i was just saying log straight to the journal.
Comment 21 GNOME Infrastructure Team 2018-05-24 10:30:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdm/issues/37.