gobo-eiffel / gobo

The Gobo Eiffel Project provides the Eiffel community with free and portable Eiffel tools and libraries.
https://sourceforge.net/projects/gobo-eiffel/
Other
59 stars 24 forks source link

Environment problem when running geant1.eant example #51

Closed tj800x closed 3 years ago

tj800x commented 3 years ago

I'm running through the geant documentation and having a problem with OSX 10.15.7. When I run the geant1.eant example it doesn't seem to be setting the global variable "who" in the ../variables/variables5.eant build file.

As you can see the last echo is "hello ${who}" when it should be "hello bart" according to the documentation.

[gobo]$ cd ./tool/geant/example/geant

[geant]$ ls
geant1.eant geant2.eant geant3.eant print.eant

[geant]$ geant -v -b geant1.eant
Loading Project's configuration from geant1.eant
Building Project

geant.one:

  [set global] who=Bart
  [set global] buildfile=../variables/variables5.eant
  [echo]
------------------------
  [echo]
before call of ../variables/variables5.eant
  [geant] geant -v -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Building Project

variables5.var:

  [echo]
Hello ${who}
  [echo]
after call of ../variables/variables5.eant
  [echo]
-------
  [echo]
before call of ../variables/variables5.eant
  [geant] geant -v -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Building Project

variables5.var:

  [echo]
Hello ${who}
  [echo]
after call of ../variables/variables5.eant

Here is the output with debugging.

[geant]$ geant -v -d -b geant1.eant
Loading Project's configuration from geant1.eant
Project 'geant': loading 1 immediate targets.
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'geant': loading target `one'
Building Project
pushing target: one
project 'geant': executing target `geant.one'

geant.one:

  [set global] who=Bart
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [set global] buildfile=../variables/variables5.eant
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
------------------------
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
before call of ../variables/variables5.eant
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [*geant] execute_forked_with_filename_and_target: '../variables/variables5.eant', 'var'
  [*geant] no variable 'geant.geant.level' found
  [geant] geant.geant.level=#
  [geant] geant -v -d -Dgeant.geant.level=# -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Project 'variables5': loading 3 immediate targets.
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `var'
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `setenv'
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `cwd'
Building Project
pushing target: var
project 'variables5': executing target `variables5.var'

variables5.var:

  [echo]
Hello ${who}
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
after call of ../variables/variables5.eant
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
-------
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
before call of ../variables/variables5.eant
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [*geant] execute_forked_with_filename_and_target: '../variables/variables5.eant', 'var'
  [geant] geant.geant.level=##
  [geant] geant -v -d -Dgeant.geant.level=## -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Project 'variables5': loading 3 immediate targets.
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `var'
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `setenv'
  [*GEANT_INTERPRETING_ELEMENT] project.position_table is Void
Project 'variables5': loading target `cwd'
Building Project
pushing target: var
project 'variables5': executing target `variables5.var'

variables5.var:

  [echo]
Hello ${who}
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
  [echo]
after call of ../variables/variables5.eant
changing to directory: '/Users/tjohnson/gobo/tool/geant/example/geant'
tj800x commented 3 years ago

The issue doesn't appear to be just OSX. I was able to reproduce it on ubuntu Ubuntu 20.04.2 LTS (Focal Fossa) on a clean build from master.

root@3c4407323ae3:~/gobo/tool/geant/example/geant# geant -v -b geant1.eant
Loading Project's configuration from geant1.eant
Building Project

geant.one:

  [set global] who=Bart
  [set global] buildfile=../variables/variables5.eant
  [echo]
------------------------
  [echo]
before call of ../variables/variables5.eant
  [geant] geant -v -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Building Project

variables5.var:

  [echo]
Hello ${who}
  [echo]
after call of ../variables/variables5.eant
  [echo]
-------
  [echo]
before call of ../variables/variables5.eant
  [geant] geant -v -b ../variables/variables5.eant var
Loading Project's configuration from ../variables/variables5.eant
Building Project

variables5.var:

  [echo]
Hello ${who}
  [echo]
after call of ../variables/variables5.eant
ebezault commented 3 years ago

I ran it under Windows and I also got:

Hello ${who}

But looking a little bit deeper, it looks like it is the expected behavior. Indeed, if you look at: http://www.gobosoft.com/eiffel/gobo/geant/geant_task.html you see that there is a fork when we specify the option file in line:

<geant file="${buildfile}" target="var"/>

So the variable is not passed to ../variables/variables5.eant.

In order to display:

Hello Bart

we have to specify:

<setenv name="who" value="Bart"/>

so that who is an environment variable which will be passed to the fork process.

ebezault commented 3 years ago

Fixed in https://github.com/gobo-eiffel/gobo/commit/f699cf8e0ecdab24473401c3767e860819fb7eeb.