canonical / lightdm

Display Manager
GNU General Public License v3.0
824 stars 138 forks source link

Make location of .xsession-errors configurable #95

Open dorsiflexion opened 4 years ago

dorsiflexion commented 4 years ago

LightDM always uses $HOME/.xsession-errors as the log file because it is harcoded. There are several possible reasons for someone to define another location, for example to write it into the RAM or to just have a tidier $HOME-folder.

$HOME just isn't the right place for the file. ~$XDG_RUNTIME_DIR (that's /run/user/$UID with systemd) or $XDG_CACHE_HOME (= $HOME/.cache)~ $XDG_STATE_HOME, which defaults to $HOME/.local/state is much more suitable.

Currently there is no way around this one path. So please make it configurable. I could live with a hardcoded path, too, if it was the aforementioned plus an xorg subfolder.

Edit 2023-06-06: Updated to $XDG_STATE_HOME.

hosxy commented 4 years ago

I think so.
.xsession-errors in $HOME is not a good idea, I think it will be more suitable where it is in $XDG_CACHE_HOME or $XDG_RUNTIME_DIR

nefigtut commented 4 years ago

+1 to this, it would be great to have a configurable location for .xsession-errors. i ended up binary hacking /usr/sbin/lightdm to change the hardcoded name to the ".cache/xs-errors".

funny enough, this issue dates back to 2012 (if not earlier): https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1001035

Alexander-Shukaev commented 4 years ago

This is a simple, but useful change. Uncontrollable growth of .xsession-errors in $HOME and, in general, its presence there drive people nuts all over the web. Please, fix this in the upcoming release.

haarp commented 4 years ago

Quick'n'dirty hack:

--- a/src/session.c     2018-08-30 02:28:55.000000000 +0200
+++ b/src/session.c     2020-01-08 14:57:16.495681494 +0100
@@ -981,7 +981,7 @@
 {
     SessionPrivate *priv = session_get_instance_private (session);

-    priv->log_filename = g_strdup (".xsession-errors");
+    priv->log_filename = g_strdup (".cache/xsession-errors");
     priv->log_mode = LOG_MODE_BACKUP_AND_TRUNCATE;
     priv->to_child_input = -1;
     priv->from_child_output = -1;

doesn't follow $XDG_CACHE_HOME but works for me.

azureblue commented 3 years ago

There's even dirtier hack that doesn't require recompilling or anything... you can just edit /usr/sbin/lightdm in ghex (or any binary editor) and find the null ended string '.xsession-errors', and replace it.

Very important: you shouldn't change the the size of the string but you can put a dirname (with /) there..

Alexander-Shukaev commented 3 years ago

There's even dirtier hack that doesn't require recompilling or anything... you can just edit /usr/sbin/lightdm in ghex (or any binary editor) and find the null ended string '.xsession-errors', and replace it.

Very important: you shouldn't change the the size of the string but you can put a dirname (with /) there..

Just discussed today with colleagues, this pandemic drastically changed everyone. You seem to have become very bold, Sir. :)

azureblue commented 3 years ago

It was just obsessive for me to fix it today and apt build-dep lightdm wanted too many staff so that's what I did... ;)

btw. I remember modifying mbr using ghex and dd to resize root partition without unmounting so... ;P

tricktux commented 3 years ago

Any updates on this simple but useful change?

kuator commented 2 years ago

Friendly bump

kuator commented 2 years ago

Here's a small script I compiled from the above answers. Ubuntu 22.04

if strings /usr/sbin/lightdm | grep -q '.xsession-errors' ; then
  sudo apt install bbe
  bbe -e 's/.xsession-errors/.cache\x2Fxs-errors/' /usr/sbin/lightdm > outfile
  chmod +x outfile
  sudo mv /usr/sbin/lightdm /usr/sbin/lightdm-back
  sudo mv outfile /usr/sbin/lightdm
fi
devnoot commented 1 year ago

Another friendly bump. Having the .xsession-errors file in $HOME doesn't make a lot of sense to me.

Manix80 commented 1 year ago

Wouldn't there be some crazy coder to add this useful feature? Strange that no one is looking into it, complicated to implement maybe.

hildebro commented 1 year ago

another bump

HerroBert commented 1 year ago

bumpy ride...

lockie commented 1 year ago

@robert-ancell would you please kindly have a look at #287 or provide a reason why this change is unwelcome?