Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146425

After change 8142907 'EXCLUDE_FILE' is wrongly interpreted as pattern

XMLWordPrintable

    • b101

      Change "8142907: Integration of minor fixes from the build-infra project" has introduced a new parameter called EXCLUDE_PATTERN for calls to SetupNativeCompilation.

      Unfortunately this change also altered the semantics of EXCLUDE_FILE which is now interpreted as a pattern of the form "*EXCLUDE_FILE". This is because of the following code:

         ifneq ($$($1_ALL_EXCLUDE_FILES),)
           $1_EXCLUDE_FILES_PAT := $$($1_ALL_EXCLUDE_FILES) \
               $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_ALL_EXCLUDE_FILES)))
           $1_EXCLUDE_FILES_PAT := $$(addprefix %,$$($1_EXCLUDE_FILES_PAT))
           $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PAT),$$($1_SRCS))

      $1_EXCLUDE_FILES_PAT is initialized to contain all the simple file names which are to be excluded plus all of these file names prefixed with each src path. In the next step, all the entries in $1_EXCLUDE_FILES_PAT are converted to patterns by prefixing them with the wildcard character "%". Finally, the patterns are matched against all the existing source files. This leads to the problem that every file which was given as EXCLUDE_FILES will be converted into a "%EXCLUDE_FILES" pattern thus effectively exluding not just files with the name EXCLUDE_FILES but actually all files ending in EXCLUDE_FILES.

      This hit us badly on AIX where we have the implementation file AixNativeThread.c and the exclude NativeThread.c. After change 8142907 AixNativeThread.c was silently excluded from the compilation leading to errors during runtime because the file contained some native methods from sun.nio.ch which are not always used.

      A change which fixes this problem would be this one:

         ifneq ($$($1_ALL_EXCLUDE_FILES),)
      - $1_EXCLUDE_FILES_PAT := $$($1_ALL_EXCLUDE_FILES) \
      + $1_EXCLUDE_FILES_PAT := \
               $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_ALL_EXCLUDE_FILES)))
           $1_EXCLUDE_FILES_PAT := $$(addprefix %,$$($1_EXCLUDE_FILES_PAT))
           $1_SRCS := $$(filter-out $$($1_EXCLUDE_FILES_PAT),$$($1_SRCS))

            simonis Volker Simonis
            simonis Volker Simonis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: