Opened 5 years ago

Closed 5 years ago

#1725 closed defect (fixed)

the top level make file may be run with parallelism enabled

Reported by: Pierre Labastie Owned by: alfs-log@…
Priority: normal Milestone: 3.0
Component: jhalfs Version: SVN
Severity: normal Keywords:
Cc:

Description

Symptom: from J Michmerhuizen on alfs-discuss:

Building the system...
make[1]: Entering directory '/Proj/LFS/bld/jhalfs'
--------------------------------------------------------------------------------
mk_SETUP
stty: 'standard input': Inappropriate ioctl for device
--------------------------------------------------
Terminal too small:  columns x  lines
Minimum: 80 columns x 24 lines
--------------------------------------------------
Makefile:78: recipe for target 'ck_terminal' failed
make[1]: *** [ck_terminal] Error 1
make[1]: *** Waiting for unfinished jobs....
ROOT privilege is required to perform a number of commands
sudo will request a password in order to execute all high privilege commands
--------------------------------------------------------------------------------
  Building target save-luser
User lfs exists with ID 1001

  Target save-luser OK
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
  Building target 026-creatingtoolsdir
Makefile:207: recipe for target '026-creatingtoolsdir' failed
make: *** [026-creatingtoolsdir] Error 1
Makefile:88: recipe for target 'mk_SETUP' failed
make[1]: *** [mk_SETUP] Error 2
make[1]: Leaving directory '/Proj/LFS/bld/jhalfs'


ERROR:  Error 2 at common/common-functions line 39!

<jhalfs> exit
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 2

One obvious issue is that the top level make has -jN with N>1, which is not expected.

The second issue is that the "ck_terminal" target lacks a terminal.

Change History (3)

comment:1 by Pierre Labastie, 5 years ago

With the present code, there is a global variable MAKEFLAGS in jhalfs, which is set to -j<N> if optimization is asked. Obviously, it is exported to "make" when "Run the makefile" is ticked.

So several target are started in parallel, and according to make documentation, only one can get a terminal, on a first arrived first served basis. This is explained in "info make" paragraph 5.4.2:

Two processes cannot both take input from the same device at the same
time.  To make sure that only one recipe tries to take input from the
terminal at once, 'make' will invalidate the standard input streams of
all but one running recipe.  If another recipe attempts to read from
standard input it will usually incur a fatal error (a 'Broken pipe'
signal).

   It is unpredictable which recipe will have a valid standard input
stream (which will come from the terminal, or wherever you redirect the
standard input of 'make').  The first recipe run will always get it
first, and the first recipe started after that one finishes will get it
next, and so on.

although it is not clear whether this influences the stty command.

Anyway, I think the global MAKEFLAGS should be renamed to a name-spaced variable JH_MAKFLAGS. Let's do that and test again.

comment:2 by Pierre Labastie, 5 years ago

Looks like the change to the variable name allows to fix the issue.

comment:3 by Pierre Labastie, 5 years ago

Resolution: fixed
Status: newclosed

Fixed at r4165

Note: See TracTickets for help on using tickets.