Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ericvw
Copy link

@ericvw ericvw commented Apr 18, 2017

A race condition occurs during make install when any directory up to
the installation prefix doesn't exist (i.e., configure --prefix <prefix-dir>) and more than one make job is specified.

For example, invoking make -j 2 install when <prefix-dir> does not
exist results in two jobs attempting to create <prefix-dir>. One of
the invocations of src/mkinstalldirs fails because it calls mkdir
(mkdir, without -p, returns a non-zero exit status due to
directories already created). However, due to the dash, -, for the
make recipe, the failure is ignored. Thus, this issue manifests itself
as other installation operations failing.

To address this, use autoconf's AC_PROG_MKDIR_P macro to set MKDIR_P
for safely creating directories, and parent directories, in parallel.
Remove mkinstalldirs in favor of automake's install-sh script, which
is needed for AC_PROG_MKDIR_P as a fallback mechanism. Note that
install-sh is safe to run in parallel.

Signed-off-by: Eric N. Vander Weele [email protected]

A race condition occurs during `make install` when any directory up to
the installation prefix doesn't exist (i.e., `configure --prefix
<prefix-dir>`) and more than one make job is specified.

For example, invoking `make -j 2 install` when `<prefix-dir>` does not
exist results in two jobs attempting to create `<prefix-dir>`.  One of
the invocations of `src/mkinstalldirs` fails because it calls `mkdir`
(`mkdir`, without `-p`, returns a non-zero exit status due to
directories already created).  However, due to the dash, `-`, for the
make recipe, the failure is ignored.  Thus, this issue manifests itself
as other installation operations failing.

To address this, use autoconf's `AC_PROG_MKDIR_P` macro to set `MKDIR_P`
for safely creating directories, and parent directories, in parallel.
Remove `mkinstalldirs` in favor of automake's `install-sh` script, which
is needed for `AC_PROG_MKDIR_P` as a fallback mechanism.  Note that
`install-sh` is safe to run in parallel.

Signed-off-by: Eric N. Vander Weele <[email protected]>
@codecov-io
Copy link

Codecov Report

Merging #1639 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1639      +/-   ##
==========================================
+ Coverage   74.82%   74.83%   +<.01%     
==========================================
  Files          76       76              
  Lines      124861   124822      -39     
==========================================
- Hits        93433    93409      -24     
+ Misses      31428    31413      -15
Impacted Files Coverage Δ
src/if_xcmdsrv.c 84.25% <0%> (-1.12%) ⬇️
src/if_py_both.h 75.56% <0%> (-0.46%) ⬇️
src/gui_gtk_x11.c 47.49% <0%> (+0.05%) ⬆️
src/gui.c 45.56% <0%> (+0.05%) ⬆️
src/term.c 53.44% <0%> (+0.05%) ⬆️
src/ex_cmds2.c 79.61% <0%> (+0.1%) ⬆️
src/window.c 81.22% <0%> (+0.13%) ⬆️
src/channel.c 83.87% <0%> (+0.27%) ⬆️
src/os_unix.c 58.78% <0%> (+0.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43d1ac6...b588200. Read the comment docs.

@brammool brammool closed this in c039441 Apr 20, 2017
desvp pushed a commit to desvp/vim that referenced this pull request May 30, 2017
Problem:    Can't run make with several jobs, creating directories has a race
            condition.
Solution:   Use the MKDIR_P autoconf mechanism. (Eric N. Vander Weele,
            closes vim#1639)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants