pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.2k stars 355 forks source link

Pharo 11 - headless option doesn't work, worked on previous version Pharo 8 #16894

Open recursive68 opened 3 months ago

recursive68 commented 3 months ago

Bug description --headless command line option does not work

To Reproduce Steps to reproduce the behavior:

  1. /home/pharo/pharovm/bin/pharo --headless /home/pharo/Pharo11-SNAPSHOT-64bit-aece1b5.image
  2. Image launched with UI, headless cmd line option option ignored.

Expected behavior This option worked with Pharo 8 64bit.

Screenshots If applicable, add screenshots to help explain your problem.

Version information:

welcome[bot] commented 3 months ago

Thanks for opening your first issue! Please check the CONTRIBUTING documents for some tips about which information should be provided. You can find information of how to do a Pull Request here: https://github.com/pharo-project/pharo/wiki/Contribute-a-fix-to-Pharo

GitHub
Contribute a fix to Pharo
Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk. - pharo-project/pharo
Ducasse commented 3 months ago

Thanks you for the report. Could you tell us the VM version: you can get it from the systemReport menu. By any chance could you check with Pharo 12 and the latest VM?

Ducasse commented 3 months ago

BTW I use it often in Pillar Here is the pharo (no ui) script I use. Now I'm on mac so may be there is a difference.

#!/usr/bin/env bash
# some magic to find out the real location of this script dealing with symlinks
DIR=`readlink "$0"` || DIR="$0";
DIR=`dirname "$DIR"`;
cd "$DIR"
DIR=`pwd`
cd - > /dev/null 
# disable parameter expansion to forward all arguments unprocessed to the VM
set -f
# run the VM and pass along all arguments as is
"$DIR"/"pharo-vm/Pharo.app/Contents/MacOS/Pharo" --headless "$@"
recursive68 commented 3 months ago

Hi,

Thanks for replying.

Virtual Machine


/usr/local/pharo/pharovm/lib/pharo

CoInterpreter VMMaker-tonel.1 uuid: b1b69e10-51d8-0d00-af00-2ed90bccb44d Jun 28 2024

StackToRegisterMappingCogit VMMaker-tonel.1 uuid: b1b69e10-51d8-0d00-af00-2ed90bccb44d Jun 28 2024

v10.3.0 - Commit: ce15171 - Date: 2024-06-28 10:12:41 +0200

Pharo 10.3.0 built on Jun 28 2024 10:51:58 Compiler: 5.4.0 20160609

VMMaker versionString v10.3.0 - Commit: ce15171 - Date: 2024-06-28 10:12:41 +0200

CoInterpreter VMMaker-tonel.1 uuid: b1b69e10-51d8-0d00-af00-2ed90bccb44d Jun 28 2024

StackToRegisterMappingCogit VMMaker-tonel.1 uuid: b1b69e10-51d8-0d00-af00-2ed90bccb44d Jun 28 2024



For Pharo 11 I downloaded VM and image from here https://files.pharo.org/get-files/110:

VM: https://files.pharo.org/get-files/110/pharo-vm-Linux-x86_64-stable.zip

Images tried: https://files.pharo.org/get-files/110/pharo64.zip and https://files.pharo.org/get-files/110/pharoImage-x86_64.zip



Unfortunately the pillar script gives me the same result, --headless option is not recognised.



I've tried Pharo 12 and that appears to have same issue, it's not recognising the --headless option even though if you run VM executable without an image it shows that as an option.

./pharo --headless /usr/local/pharo/pharo12/image/Pharo12.0-SNAPSHOT-64bit-4c71938.image

Usage: [] [--help] [--copyright] [--version] [--list] [ --no-quit ]

    --help       print this help message

    --copyright  print the copyrights

    --version    print the version for the image and the vm

    --list       list a description of all active command line handlers

    --no-quit    keep the image running without activating any other command line handler

    --deploymentPassword   if a password needs to be used by the user to launch the command

    --readWriteAccessMode, --readOnlyAccessMode, --writeOnlyAccessMode, --disabledAccessMode

                 specify disk access mode, read-write mode as default

    <subcommand> a valid subcommand in --list

    Preference File Modification:

    --preferences-file   load the preferences from the given <FILE>

    --no-default-preferences    do not load any preferences from the default locations

Documentation:

A PharoCommandLineHandler handles default command line arguments and options.

The PharoCommandLineHandler is activated before all other handlers.

It first checks if another handler is available. If so it will activate the found handler."



Using this VM and image from https://files.pharo.org/get-files/120/

pharoImage-x86_64.zip - https://files.pharo.org/get-files/120/pharoImage-x86_64.zip

pharo-vm-Linux-x86_64-stable.zip - https://files.pharo.org/get-files/120/pharo-vm-Linux-x86_64-stable.zip

Thanks

recursive68 commented 2 months ago

Hi,

Assuming i am looking at the current classes/methods in the Pharo 11 and Pharo 12 images the VirtualMachine headlessOption method returns: vm-display-null if the OS is unix . Trying --vm-display-null as an option doesn't work either.

Looking at the library directory for the Pharo VM version 10.3.0, it no longer contains library vm-display-null.so or any other vm-display-XXX objects, so presumably this is the reason why it doesn't work ?
Thanks

recursive68 commented 2 months ago

Non pharo solution, Pharo UI output sent to xvfb virtual session and run as a pharo user via systemd script:

Install Xvfb Create systemd script to run as a service:

[Unit] Description=Pharo service After=network.target

[Service] Type=simple Restart=always RestartSec=10 User=pharo ExecStart=xvfb-run /usr/local/pharo/pharo11/vm/bin/pharo /usr/local/pharo/pharo11/image/Pharo11-SNAPSHOT-64bit-aece1b5.image

[Install] WantedBy=multi-user.target

Ducasse commented 2 months ago

Thanks for all such information.

Ducasse commented 2 months ago

I saw that you are on OS: RedHat 9 @tesonep may be you have a bit of time before holidays to investigate this issue?

guillep commented 2 months ago

This is strange, I'll check it during the week