Comment 1 for bug 910948

Revision history for this message
bcbc (bcbc) wrote : Re: wubi.exe for ubuntu 11.10 isn't start in win7 32bit

This looks like a bug caused by the attempt to remove "wubi.exe" from the startup folder. This logic was introduced in 11.04 I believe, which inserts wubi.exe in the startup folder if a user tries to do a normal dual boot but all four primary partitions are used.

The problem is that the startup folder is not set. It looks like ntpath.py should handle this, but it probably isn't. The workaround is likely to set the startup environment variable by editing the registry (regedit) and setting:
                 'HKEY_LOCAL_MACHINE', 'SOFTWARE\Microsoft\Windows\CurrentVersion'
                '\Explorer\Shell Folders',
                'Common Startup'

Relevant code:
\lib\wubi\backends\win32\backend.py

    def remove_existing_binary(self):
        binary = os.path.join(self.get_startup_folder(), 'wubi.exe')
        if os.path.exists(binary):
            try:
                MOVEFILE_DELAY_UNTIL_REBOOT = 4
                ctypes.windll.kernel32.MoveFileExW(binary, None,
                        MOVEFILE_DELAY_UNTIL_REBOOT)
            except (OSError, IOError):
                log.exception("Couldn't remove Wubi from startup:")
============

\lib\wubi\backends\win32\backend.py

def join(a, *p):
    """Join two or more pathname components, inserting "\\" as needed"""
    path = a
    for b in p:
        b_wins = 0 # set to 1 iff b makes path irrelevant
        if path == "":
            b_wins = 1

        elif isabs(b):
            # This probably wipes out path so far. However, it's more
            # complicated if path begins with a drive letter:
            # 1. join('c:', '/a') == 'c:/a'
            # 2. join('c:/', '/a') == 'c:/a'
                # But
            # 3. join('c:/a', '/b') == '/b'
            # 4. join('c:', 'd:/') = 'd:/'
            # 5. join('c:/', 'd:/') = 'd:/'
            if path[1:2] != ":" or b[1:2] == ":":
                # Path doesn't start with a drive letter, or cases 4 and 5.
                b_wins = 1

            # Else path has a drive letter, and b doesn't but is absolute.
            elif len(path) > 3 or (len(path) == 3 and
                                   path[-1] not in "/\\"):
                # case 3
                b_wins = 1

        if b_wins:
            path = b
        else:
            # Join, and ensure there's a separator.
            assert len(path) > 0
            if path[-1] in "/\\": <== line 90, should never get here