Comment 5 for bug 1342424

Revision history for this message
Michael Vogt (mvo) wrote :

@Nick: Yeah! Its kind of ironic that I was using iso dates before and during the internal testing it was suggested to use the dates based on the locale. Oh well.

It turns out that pam-motd runs the update-motd stuff without LANG/LOCALE information.
"""
+ if (!system("/usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin run-parts --lsbsysinit /etc/update-motd.d > /run/motd.dynamic.new"))
"""

So to fix that, something like:
"""
  char cmd[255];
  char *language = pam_getenv(pamh, "LANGUAGE");
  if(language == NULL) language = "";
  char *lang = pam_getenv(pamh, "LANG");
  if(locale == NULL) locale = "";
  snprintf(cmd, sizeof(cmd), "/usr/bin/env -i LANGUAGE=\"%s\" LANG=\"%s\" PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin run-parts --lsbsysinit /etc/update-motd.d > /run/motd.dynamic.new", language, lang);
  if(!system(cmd))
"""
I would love to get feedback from the pam maintainer if that is something we want to support, I'm happy to write the code for this. But given the side-effects that all update-motd scripts are suddenly running localized I think simply going to iso date format in the script is the better option for now.