Closed Bug 1603530 Opened 3 years ago Closed 2 years ago

moz-phab fails to restart after self-update on Windows

Categories

(Conduit :: moz-phab, defect, P2)

Unspecified
Windows
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bytesized, Assigned: zalun)

References

Details

(Keywords: conduit-triaged)

Attachments

(1 file, 1 obsolete file)

Just ran moz-phab and got this output:

> moz-phab submit bookmark1
Upgrading to version 0.1.67
Collecting MozPhab
  Downloading https://files.pythonhosted.org/packages/b3/3d/edfdc7651c2639805365bb0f880b0fd02b6a430ae37d4ae767d528ae6938/MozPhab-0.1.67.tar.gz (56kB)
     |████████████████████████████████| 61kB 2.0MB/s
Requirement already satisfied, skipping upgrade: setuptools in c:\mozilla-build\python3\lib\site-packages (from MozPhab) (39.1.0)
Installing collected packages: MozPhab
  Found existing installation: MozPhab 0.1.65
    Uninstalling MozPhab-0.1.65:
      Successfully uninstalled MozPhab-0.1.65
    Running setup.py install for MozPhab ... done
Successfully installed MozPhab-0.1.67
Restarting...
c:\mozilla-build\python3\python3.exe: can't open file 'c:/mozilla-build/python3/Scripts/moz-phab': [Errno 2] No such file or directory
CommandError: command 'c:\mozilla-build\python3\python3.exe' failed to complete successfully

Sorry, we've changed the structure of the MozPhab package.
I'll keep it open in case self-update will fail to update from 0.1.67.

Keywords: conduit-triaged
Priority: -- → P2

mkaply ran into an issue similar to this upgrading to 0.1.71.
Here's the associated Slack context:

I got this message "moz-phab is now distributed via PyPI. Please run moz-phab self-update"
So I did that, and now moz-phab doesn't work
-bash: /Users/michaelkaply/.mozbuild/moz-phab/moz-phab: No such file or directory

It sounds like closing and re-opening the shell resolved the issue. Either we should remove the need to close + reopen the shell, or we should have some post-install messaging recommending a shell re-open.


This sounds similar enough to the base issue to tack onto it, I can represent this as a new ticket if that's a better fit.

This sounds similar enough to the base issue to tack onto it, I can represent this as a new ticket if that's a better fit.

What's happening is the shell is caching executable paths. We should recommend running hash -r to clear the cache.
This should only be displayed when running on unix-like environments.

I no longer get the exact error mesage I was getting before, but I am consistently having the same problem as before whenever moz-phab needs to update.

Upgrading to version 0.1.74
Collecting MozPhab
  Downloading https://files.pythonhosted.org/packages/9a/67/e3d42f1d4e284a18cac5f3f0b6df2e8aedaf30bf1c00136c12afcae12e58/MozPhab-0.1.74.tar.gz (56kB)
     |████████████████████████████████| 61kB 1.3MB/s
Requirement already satisfied, skipping upgrade: setuptools in c:\mozilla-build\python3\lib\site-packages (from MozPhab) (41.4.0)
Installing collected packages: MozPhab
  Found existing installation: MozPhab 0.1.73
    Uninstalling MozPhab-0.1.73:
      Successfully uninstalled MozPhab-0.1.73
    Running setup.py install for MozPhab ... done
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\ksteuber\\AppData\\Local\\Temp\\pip-uninstall-x0uvf51u\\moz-phab.exe'
Consider using the `--user` option or check the permissions.

CommandError: command 'c:\mozilla-build\python3\python3.exe' failed to complete successfully
Run moz-phab again with '--trace' to show the stack trace

Really, it seems that it did update successfully:

> moz-phab version
MozPhab (0.1.74)

It looks like maybe it actually just failed to uninstall the old version (maybe because it is still running?), so it wouldn't really bother me much at all, except that it doesn't actually submit my patch, which is the thing I asked it to do.

Assignee: nobody → pzalewa
Status: NEW → ASSIGNED

Steps to reproduce:

  1. pip3 install MozPhab==0.1.72
  2. moz-phab self-update

Windows cannot update an executable if it's running, so pip cannot update c:\mozilla-build\python3\Scripts\moz-phab.exe.
However you can rename an running executable, so the following appears to work (please test!):

    try:
        os.unlink("%s/moz-phab_old.exe" % script_dir)
    except FileNotFoundError:
        pass
    os.rename("%s/moz-phab.exe" % script_dir, "%s/moz-phab_old.exe" % script_dir)
    check_call(command)
Attachment #9124441 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.