GNOME Bugzilla – Bug 322711
%d and other %X variables in welcome string are not interpreted correctly
Last modified: 2005-12-25 01:28:44 UTC
Please describe the problem: the %X variables for the welcome string (aside from %n) are not working properly anymore. some variables don't show anything, while %d is showing the auto-login timeout value! Also, %c puts a time in the string, but %c shouldn't do anything. I asked about this on the gdm mailing list and Brian Cameron noticed that "gdmgreeter never calls a function like gdm_parse_enriched_string(). It probably should." Steps to reproduce: 1. in gdm.conf set: DefaultWelcome=false Welcome=Welcome to %h %d #and down below GraphicalTheme=happygnome #or some other theme that displays a welcome message 2. restart gdm 3. look at the welcome message Actual results: the welcome message shows "<hostname> 30" (30 or whatever TimedLoginDelay is set to!) Expected results: the welcome message should show the display number, :0 on a single user machine Does this happen every time? yes Other information: we have simultaneous multi-user machines, so it is nice to know which display is which when the machine boots up
just tried 2.8.0.7 and same behaviour occurred
I'm looking into this further now. I notice that the greeter program has a similar function called greeter_item_expand_text. So the greeter supports: %% - print a % %n - uname.nodename %h - calls gethostname and prints the hostname or "localhost" if no return %o - calls getdomainname and prints the domainname or "localdomain" no return %d - current timed delay %s - timed username %c - clock time \n - replaced with a real \n It also changes strings that contain "_" characters so that the underlines are replaced with <u> and </u> like "_hello_" to "<u>hello</u>". This same function is used by all label's that are used by the greeter, as defined in the xml file. On the other hand, gdmlogin uses the aforementioned gdm_parse_translated_string function which supports the following: %% - % character, same as greeter %h - hostname, same as greeter %n - uname.nodename, same as greeter %d - the DISPLAY environment variable (not timed delay like greeter) %s - uname.sysname (not timed username like greeter) %r - uname.release (not supported in greeter) %m - uname.machine (not supported in greeter) \n - replaced with a real \n. So, this rater a mess. It's also undocumented. Nowhere does the GDM documentation explain how any of this works. It would probably be better if both gdmlogin and gdmgreeter used the same function and supported the same special characters. I recommend we change both to use a common function that translate's the strings using the following codes: %% - print a % %c - clock time %d - the DISPLAY environment variable (not timed delay like greeter) %h - calls gethostname and prints the hostname or "localhost" if no return %m - uname.machine %n - uname.nodename %o - calls getdomainname and prints the domainname or "localdomain" no return %r - uname.release %s - uname.sysname (not timed username like greeter) %t - current timed delay (redefined from %d - display is a better choice for %d) %u - timed username (%redefined from %s) \n - replaced with a real \n This is obviously overkill for the welcome message, but it means that any string defined in a gdmgreeter label will be processed the same way as the welcome string. Redefining %d to %t and %s to %u probably won't cause anybody any problems because I don't think any themes would use these. Instead these are used in a hardcoded string defined in parse_stock() in the greeter_parser.c file. So I can just change that hardcoded string to use %t and %u instead of %d and %s. This is a minor change to the GDM interfaces, but since it is an undocumented interface, I think it's safe to change it in this minor way. Then I can add documentation to docs/C/gdm.xml to let people know that they can use these strings in the welcome message or any label defined for gdmgreeter. That's probably a big improvement.
I fixed this in CVS head, using my proposal. I also rearranged the code so that gdmlogin and gdmgreeter share the same logic for processing this. Much cleaner and consistant I think. Also the GDM docs have been updated to explain how all this works.