pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
109 stars 46 forks source link

#basicFileID was sent to nil #614

Open santana opened 1 year ago

santana commented 1 year ago

Describe the bug When running Pharo Launcher as a non-admin user an error message pops up. Pharo Launcher is still usable after clicking on "Ignore".

To Reproduce Steps to reproduce the behavior:

  1. Install Pharo Launcher as an admin user in macOS
  2. Switch to another user and execute Pharo Launcher
  3. You will then see the error

Expected behavior No error message

Screenshots

error

Version information:

Expected development cost Given enough context, the solution shouldn't take more than an hour. I can give it a try.

Additional context The problem is that Pharo Launcher has a hack in place to get a sessionID from the baicFileID of the Pharo Launcher image file, after opening it for writing. That file however is not writable for a non-admin user.

debug
Bajger commented 1 year ago

@santana Can you paste more of the stack content? I see just these 3 lines, but I'd like to see what is the chain of message sending during startup. I've looked by whom is that sessionID needed and it seems only sender of session ID is deprecated file stream, co maybe code can be removed, but we'd need to check it by someone from core devs.

santana commented 1 year ago

Thanks @Bajger , here it is:

Screenshot 2023-05-17 at 9 50 25 PM
capsulecorplab commented 10 months ago

I'm also encountering the same issue Screenshot from 2024-01-02 20-45-27

demarey commented 10 months ago

Hello,

Thank you for the report. The first analysis is right: the error is due to a lack of permissions to read / write the file. OSSubProcess still uses an old API. Maybe you could try to redefine the #initializeSessionIDmethod with:

initializeSessionID
    sessionID := Smalltalk image imagePath asFileReference binaryReadStreamDo: 
        [ :stream | 
        (ZnEndianessReadWriteStream on: stream) nextLittleEndianNumber: self systemAccessor sizeOfInt ].

It will not survive Pharo Launcher restart but it will let us know if the fix is valid or not.

capsulecorplab commented 10 months ago

I get a FileDoesNotExistException when attempting to redefine initializeSessionID Screenshot from 2024-01-03 15-18-30 Screenshot from 2024-01-03 15-18-41 Screenshot from 2024-01-03 15-19-22

demarey commented 10 months ago

Thanks for trying. What I do not understand is that the file not found refers to an Epicea file (.ombu extension) and that the given path looks like the path used on the CI server to build the Pharo Launcher package. What does give the evaluation of Smalltalk image imagePath in the debugger?

capsulecorplab commented 10 months ago

Inspector evaluation of Smalltalk image imagePath Screenshot from 2024-01-04 02-34-07

demarey commented 10 months ago

ok, then would it be possible for you to track down where does come the reference to the Epicea file (.ombu extension) ?

capsulecorplab commented 10 months ago

I'm not an expert with the debugger, but my guess would be something to do with an OmBlockFileStore object Screenshot from 2024-01-04 03-00-27

demarey commented 10 months ago

if you go down in the stack displayed by the debugger, you will find who triggers Epicea (OMxxx classes)

capsulecorplab commented 10 months ago

Screenshot from 2024-01-04 03-37-43

demarey commented 10 months ago

I can't get the information from the screenshot. Would it be possible to scroll the stack to have the selected entry on the top of the displayed stack? It will show callers that are hidden for now

capsulecorplab commented 10 months ago

I can't get the information from the screenshot. Would it be possible to scroll the stack to have the selected entry on the top of the displayed stack? It will show callers that are hidden for now

Not sure I follow. As in go through each call in the stack trace?

demarey commented 10 months ago

ah sorry, I did not see. There is no more stack entry. A new process was spawn and the interesting information is in another stack.

I guess when you edited the method, Epicea tries to log this change. Maybe you could evaluate EpMonitor current disable before saving the initializeSessionID method?

capsulecorplab commented 10 months ago

I seem to be getting a PrimitiveFailed error after evaluating EpMonitor current disable :confused: Screenshot from 2024-01-04 04-48-25 Screenshot from 2024-01-04 04-48-37

capsulecorplab commented 10 months ago

So, I'm noticing the #basicFileID was sent to nil error occurs when pharo-launcher is installed in /opt but not if it's installed in my home directory (where writable files can persist). Are there any files created in the pharo-launcher directory at runtime? Perhaps that's what's causing the issue

capsulecorplab commented 10 months ago

So, I'm noticing the #basicFileID was sent to nil error occurs when pharo-launcher is installed in /opt but not if it's installed in my home directory (where writable files can persist). Are there any files created in the pharo-launcher directory at runtime? Perhaps that's what's causing the issue

Follow-up; although the #basicFileID was sent to nil issue disappears when installed in home directory, I'm getting a #firstSubMorph was sent to nil error with pharo-launcher running on Pharo 11. Pharo 10 seems to have neither issue.

Screenshot from 2024-01-08 17-58-36