Bug 322793

Summary: Time and Date Format doesn't use configured settings.
Product: [Applications] KSystemLog Reporter: kdebugs
Component: generalAssignee: Nicolas Ternisien <nicolas.ternisien>
Status: REPORTED ---    
Severity: wishlist    
Priority: NOR    
Version First Reported In: 0.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description kdebugs 2013-07-24 22:07:03 UTC
If you're in "Configure KSystemLog..." on the "General" tab under "Date Format" you see various options in which the date format may be shown.  However these options do not reflect settings chosen under Country/Region & Language settings (/usr/bin/kcmshell4 language).

Reproducible: Always

Steps to Reproduce:
1. Run "kcmshell4 language", click the "Date & Time" tab, enter a custom format for date, time, etc.  Press OK.
2. Run ksystemlog, click "Settings", "Configure KSystemLog..."
3. See that options available don't match.


Expected Results:  
If I've configured (for example) "YYYY-MM-DD" as my short date format and "HH:MM:SS" as my time format, KSystemLog should then show for its "Short date format" something like "2013-07-24 22:00:00" instead of "07/24/13 10:00:00 PM".

Yes, it is possible, even though KSystemLog is run as root.  It should find out whose Plasma session it's running under, and use the settings configured for that user.
Comment 1 Christoph Feck 2013-08-11 14:31:21 UTC
> use the settings configured for that user

So if you configure the date formats also as root, it works?
Comment 2 kdebugs 2013-08-14 02:41:21 UTC
(In reply to comment #1)
> > use the settings configured for that user
> 
> So if you configure the date formats also as root, it works?

Let me see if I can be clearer, which may be hard given the crazy way this program is distributed on various distros.

On PCLinux OS, the file /var/log/syslog is owned by root:root with permissions 0600, so ksystemlog has to be run as root.  When started from the menu, ksystemlog will be launched via kdesu so that the person must enter root's password and then the log files can be read.

On Ubuntu, the file /var/log/syslog is owned by syslog:adm with permissions 0640, so default users who are in the adm group can read it without special permissions.  For some reason, however, when launched from the menu, it launches through kdesudo (not kdesu) so the user has to insert his password even though it doesn't get him any more access than simply running "ksystemlog".

The result of either distribution is that when launching normally from the menu, the user will end up with a ksystemlog process owned by root.  As "root" is almost invariably not going to be the current user (who would have set up Time/Date format settings under his own account instead), this means that the Time/Date formats available will be the defaults for the "root" account instead of the Time/Date formats that the user really wants.

What I'm proposing is that if ksystemlog is run as root (which it almost always will be), that instead of using settings for the "root" account to display Dates/Time, the program should determine who the logged-in user is (the user logged into the current X session / Plasma desktop) and use his settings to display Dates/Times.

I'm not sure what the programmatic equivalent is, but what I mean by the "current user" is illustrated with this:
johndoe@doe-pc:~$ who am i
johndoe    pts/4        2013-08-12 22:28 (:0)
johndoe@doe-pc:~$ sudo su
[sudo] password for johndoe: 
root@doe-pc:/home/johndoe# who am i
johndoe    pts/4        2013-08-12 22:28 (:0)
root@doe-pc:/home/johndoe#