unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29212: XLockMore displays wrong time
@ 2017-11-08 14:35 Diego Nicola Barbato
  2017-11-08 20:57 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Nicola Barbato @ 2017-11-08 14:35 UTC (permalink / raw)
  To: 29212

Hello Guix,

XLockMore (as invoked by the command `xlock') displays the wrong time on
the lock screen.  Instead of honouring the timezone set in `config.scm'
(as do other programs e.g. the `date' command) it displays UTC.

Greetings

Diego

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#29212: XLockMore displays wrong time
  2017-11-08 14:35 bug#29212: XLockMore displays wrong time Diego Nicola Barbato
@ 2017-11-08 20:57 ` Ludovic Courtès
  2017-11-09  6:29   ` Diego Nicola Barbato
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2017-11-08 20:57 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: 29212

[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]

Hi,

Diego Nicola Barbato <dnbarbato@posteo.de> skribis:

> XLockMore (as invoked by the command `xlock') displays the wrong time on
> the lock screen.  Instead of honouring the timezone set in `config.scm'
> (as do other programs e.g. the `date' command) it displays UTC.

The problem is that setuid programs ignore $TZDIR; quoth ‘tzfile.c’ in
libc:

      /* We must not allow to read an arbitrary file in a setuid
	 program.  So we fail for any file which is not in the
	 directory hierachy starting at TZDIR
	 and which is not the system wide default TZDEFAULT.  */
      if (__libc_enable_secure
	  && ((*file == '/'
	       && memcmp (file, TZDEFAULT, sizeof TZDEFAULT)
	       && memcmp (file, default_tzdir, sizeof (default_tzdir) - 1))
	      || strstr (file, "../") != NULL))
	/* This test is certainly a bit too restrictive but it should
	   catch all critical cases.  */
	goto ret_free_transitions;

Thus, if I set TZ=Europe/Paris, I see that setuid binaries look for
timezone data only under
/gnu/store/3h31zsqxjjg52da5gp3qmhkh4x8klhah-glibc-2.25/share/zoneinfo/Europe/Paris,
which doesn’t exist.

Since GuixSD provides /etc/localtime already, we can actually unset TZ.
And when we do so, setuid binaries simply honor /etc/localtime and don’t
go searching for timezone data elsewhere, and they see the right time.

Can you confirm that:

  (unset TZ; xlock)

works for you?

I’ll commit the patch below if it does.

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 737 bytes --]

diff --git a/gnu/system.scm b/gnu/system.scm
index 5f562b48b..ce2c05f4e 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -727,7 +727,8 @@ use 'plain-file' instead~%")
   "Return the environment variables of OS for
 @var{session-environment-service-type}, to be used in @file{/etc/environment}."
   `(("LANG" . ,(operating-system-locale os))
-    ("TZ" . ,(operating-system-timezone os))
+    ;; Note: No need to set 'TZ' since (1) we provide /etc/localtime, and (2)
+    ;; it doesn't work for setuid binaries.  See <https://bugs.gnu.org/29212>.
     ("TZDIR" . ,(file-append tzdata "/share/zoneinfo"))
     ;; Tell 'modprobe' & co. where to look for modules.
     ("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#29212: XLockMore displays wrong time
  2017-11-08 20:57 ` Ludovic Courtès
@ 2017-11-09  6:29   ` Diego Nicola Barbato
  2017-11-09  9:06     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Nicola Barbato @ 2017-11-09  6:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 29212

Hello Ludo,

ludo@gnu.org (Ludovic Courtès) writes:

> Since GuixSD provides /etc/localtime already, we can actually unset TZ.
> And when we do so, setuid binaries simply honor /etc/localtime and don’t
> go searching for timezone data elsewhere, and they see the right time.
>
> Can you confirm that:
>
>   (unset TZ; xlock)
>
> works for you?

Yes, it displays the correct time.

Thanks,

Diego

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#29212: XLockMore displays wrong time
  2017-11-09  6:29   ` Diego Nicola Barbato
@ 2017-11-09  9:06     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2017-11-09  9:06 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: 29212-done

Diego Nicola Barbato <dnbarbato@posteo.de> skribis:

> Hello Ludo,
>
> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Since GuixSD provides /etc/localtime already, we can actually unset TZ.
>> And when we do so, setuid binaries simply honor /etc/localtime and don’t
>> go searching for timezone data elsewhere, and they see the right time.
>>
>> Can you confirm that:
>>
>>   (unset TZ; xlock)
>>
>> works for you?
>
> Yes, it displays the correct time.

Awesome, pushed as 5475749960d44163a4c6c4d1d1cb1be9872b861e.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-09  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 14:35 bug#29212: XLockMore displays wrong time Diego Nicola Barbato
2017-11-08 20:57 ` Ludovic Courtès
2017-11-09  6:29   ` Diego Nicola Barbato
2017-11-09  9:06     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).