Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running make check can ends up in rm -rf / with enchant 2.2.3 (and probably master too) #201

Closed
iamleot opened this issue Oct 26, 2018 · 2 comments · Fixed by #203
Closed

Comments

@iamleot
Copy link
Contributor

iamleot commented Oct 26, 2018

Issue #185 seems that still happens with enchant-2.2.3 and probably also the latest
master (on NetBSD-current) and it is actually an rm -rf / (so please be careful if you would like to reproduce the following steps!):

% tar xzf enchant-2.2.3.tar.gz
% cd enchant-2.2.3
% ./configure --enable-relocatable
[...]
% make
[...]
% make check
[...]
mv -f Provider/.deps/providers_test-provider_request_dict.Tpo Provider/.deps/providers_test-provider_request_dict.Po
make libenchant-copy
rm -rf /
rm: /usr/bin/agrep: Permission denied
rm: /usr/bin/atf-config: Permission denied
[...]

After a quick skim I think that the following rm -rf' are the problematic ones (probably same one of the issue reported), in tests/Makefile.am`:

    35  libenchant-copy:
    36          rm -rf $(libdir_subdir)/
    37          $(MKDIR_P) $(libdir_subdir)/enchant-@ENCHANT_MAJOR_VERSION@
    38          cp -r $(top_builddir)/src/@objdir@ $(libdir_subdir)/
    39          cp $(top_builddir)/src/libenchant-@ENCHANT_MAJOR_VERSION@.la $(libdir_subdir)/

...and in tests/enchant_providers/Makefile.am:

    30  libenchant-copy:
    31          rm -rf $(libdir_subdir)/
    32          $(MKDIR_P) $(libdir_subdir)/enchant-@ENCHANT_MAJOR_VERSION@
    33          cp -r $(top_builddir)/src/@objdir@ $(libdir_subdir)/
    34          cp $(top_builddir)/src/libenchant-@ENCHANT_MAJOR_VERSION@.la $(libdir_subdir)/

I think it would be better to remove the trailing / and then try
to adjust libdir_subdir as neeeded.

@iamleot
Copy link
Contributor Author

iamleot commented Oct 26, 2018

Unfortunately the problem is not just in the above Makefile.am but also in m4/gnu-make.m4 that has wrong assumptions:

    11  # Set GNU_MAKE if we are using a recent-enough version of GNU make.
    12
    13  # Use --version AND trailing junk, because SGI Make doesn't fail on --version.
    14
    15  AC_DEFUN([gl_GNU_MAKE],
    16  [
    17    AM_CONDITIONAL([GNU_MAKE],
    18      [${MAKE-make} --version /cannot/make/this >/dev/null 2>&1])
    19  ])

(Of course on NetBSD make --version /cannot/make/this cleanly return a succesfull exit status!)

...and indeed in config.log we can see:

[...]
GNU_MAKE_FALSE='#'
GNU_MAKE_TRUE=''
[...]

If libdir_subdir is manually initialized to:

libdir_subdir = lib

in tests/Makefile and tests/enchant_providers/Makefile, then make check no longer rm -rf but fails with:

make libenchant-copy
rm -rf lib
../../build-aux/install-sh -c -d lib/enchant-2
cp -r ../../src/.libs lib/
cp ../../src/libenchant-2.la lib/
../../build-aux/install-sh -c -d config
cp  config/
usage: cp [-R [-H | -L | -P]] [-f | -i] [-alNpv] src target
       cp [-R [-H | -L | -P]] [-f | -i] [-alNpv] src1 ... srcN directory

@iamleot
Copy link
Contributor Author

iamleot commented Oct 27, 2018

The cp config/ was due the $(APPLESPELL_CONFIG) target in
tests/enchant_providers/Makefile.am:

    36  APPLESPELL_CONFIG = config/AppleSpell.config
    37  $(APPLESPELL_CONFIG): $(top_srcdir)/providers/AppleSpell.config
    38          $(MKDIR_P) config
    39          cp $< config/

The target run unconditionally and $< was empty.

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 a pull request may close this issue.

1 participant