No more autologin in live CD

Bug #505140 reported by Didier Roche-Tolomelli
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Binary package hint: casper

Similarly to bug #500786, the custom.conf file is messed up again without \n interpretation:
[daemon]
AutomaticLoginEnable=true\nAutomaticLogin=didrocks\nTimedLoginEnable=true\nTimedLogin=didrocks\nTimedLoginDelay=10

The issue is in 15autologin:
printf '[daemon]\n%s' "$AutologinParameters" >> $GDMCustomFile
changed in 1.212:
  * 15autologin: Use printf rather than echo -e, since its behaviour is
    portable across shells.

The first \n is interpreted contrary to those in $AutologinParameters (probably %s take the string content vanilla). I didn't found any option to switch that. So, I reverted to echo -e for now.

---------------
casper (1.213) UNRELEASED; urgency=low

  * 15autologin: revert to echo -e as printf doesn't interpret \n in
    '%s' string.

Changed in casper (Ubuntu):
status: New → Triaged
Revision history for this message
Colin Watson (cjwatson) wrote :

From IRC:

Sorry about the breakage. However, I *really* don't like using echo -e; it has a habit of producing weird side-effects later when things are run under a shell you didn't expect. How about this trick to ensure that the same syntax is acceptable in either case?

  sed -i "\$s/\$/\n$AutologinParameters/" >> $GDMCustomFile

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Colin, I'll rather propose that (simplifying the code):

     # Prevent from updating if parameters already present (persistent usb key)
     if ! `grep -qs 'AutomaticLoginEnable' $GDMCustomFile` ; then
        if ! `grep -qs '\[daemon\]' $GDMCustomFile` ; then
            printf '[daemon]' >> $GDMCustomFile
        fi
        sed -i "s/\[daemon\]/\[daemon\]\n$AutologinParameters/" $GDMCustomFile
     fi

With that, we handle every cases:
- no GDMCustomFile, create the autologin part with [daemon]
- GDMCustomFile already exists with [daemon] section but without the autologin part (case of ubutu derivatives): add it
- GDMCustomFile exists without [daemon] section: add all the autologin stuff and the section (don't know if that can happen with current GDM implementation, but it'll surely later)
- GDMCustomFile exists with [daemon] section and autologin stuff in place (case of persistent usb key): don't do anything

And we get our \n interpreted by sed :)
This new proposal is in my linked branch.

Changed in casper (Ubuntu):
importance: Undecided → High
Revision history for this message
Evan (ev) wrote :

For what it's worth, I uploaded a changed casper that fixes the immediate issue, before being made aware of this discussion. It's casper 1.213.

My sincerest apologies for missing this.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.214

---------------
casper (1.214) lucid; urgency=low

  * 15autologin: simplify the code with escape character evaluation
    (LP: #505140)
 -- Didier Roche <email address hidden> Tue, 12 Jan 2010 08:57:05 +0100

Changed in casper (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.