Revision: 76035
http://sourceforge.net/p/brlcad/code/76035
Author: starseeker
Date: 2020-06-05 17:59:25 +0000 (Fri, 05 Jun 2020)
Log Message:
-----------
Merge changes from trunk - r75987 through r76034
Modified Paths:
--------------
brlcad/branches/dm-fb-merge/CMakeLists.txt
brlcad/branches/dm-fb-merge/INSTALL
brlcad/branches/dm-fb-merge/README
brlcad/branches/dm-fb-merge/db/CMakeLists.txt
brlcad/branches/dm-fb-merge/doc/CMakeLists.txt
brlcad/branches/dm-fb-merge/doc/docbook/CMakeLists.txt
brlcad/branches/dm-fb-merge/doc/docbook/README
brlcad/branches/dm-fb-merge/doc/docbook/resources/CMakeLists.txt
brlcad/branches/dm-fb-merge/include/common.h
brlcad/branches/dm-fb-merge/misc/CMake/BRLCAD_Util.cmake
brlcad/branches/dm-fb-merge/misc/CMake/DocBook.cmake
brlcad/branches/dm-fb-merge/misc/CMake/Path_Setup.cmake
brlcad/branches/dm-fb-merge/misc/flawfinder
brlcad/branches/dm-fb-merge/misc/win32-msvc/Dll/CMakeLists.txt
brlcad/branches/dm-fb-merge/regress/burst/regress-burst.cmake.in
brlcad/branches/dm-fb-merge/regress/flawfinder.sh
brlcad/branches/dm-fb-merge/regress/nurbs/regress-nurbs-test.cmake.in
brlcad/branches/dm-fb-merge/regress/rtwizard/regress-rtwiz.cmake.in
Added Paths:
-----------
brlcad/branches/dm-fb-merge/db/conv_run.cmake.in
brlcad/branches/dm-fb-merge/doc/docbook/db_dir_info.c
brlcad/branches/dm-fb-merge/doc/docbook/resources/brlcad/CMakeLists.txt
brlcad/branches/dm-fb-merge/doc/docbook/resources/other/CMakeLists.txt
brlcad/branches/dm-fb-merge/doc/notes/cmake_paths/
Removed Paths:
-------------
brlcad/branches/dm-fb-merge/doc/docbook/resources/other/expand.cmake
Property Changed:
----------------
brlcad/branches/dm-fb-merge/
brlcad/branches/dm-fb-merge/db/
brlcad/branches/dm-fb-merge/doc/
brlcad/branches/dm-fb-merge/include/
brlcad/branches/dm-fb-merge/regress/
Index: brlcad/branches/dm-fb-merge
===================================================================
--- brlcad/branches/dm-fb-merge 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge 2020-06-05 17:59:25 UTC (rev 76035)
Property changes on: brlcad/branches/dm-fb-merge
___________________________________________________________________
Modified: svn:mergeinfo
## -8,4 +8,4 ##
/brlcad/branches/osg:62110-62113
/brlcad/branches/prep-cache:68236-68933
/brlcad/branches/tcltk86:68300-75257
-/brlcad/trunk:75440-75987
\ No newline at end of property
+/brlcad/trunk:75440-76034
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/CMakeLists.txt 2020-06-05 17:56:16 UTC (rev
76034)
+++ brlcad/branches/dm-fb-merge/CMakeLists.txt 2020-06-05 17:59:25 UTC (rev
76035)
@@ -2111,7 +2111,7 @@
# llvm-style USE
if("${pgo_flags_found}" STREQUAL "")
cmake_push_check_state()
- set(flags "fprofile-use=\"${BRLCAD_PGO_PATH}\"")
+ set(flags "fprofile-use=\"${BRLCAD_PGO_PATH}\"
-Wno-profile-instr-out-of-date -Wno-profile-instr-unprofiled")
set(CMAKE_REQUIRED_FLAGS "-${flags}")
CHECK_C_FLAG("${flags}" GROUPS OPTIMIZE_C_FLAGS VARS pgo_flags_found)
CHECK_CXX_FLAG("${flags}" GROUPS OPTIMIZE_CXX_FLAGS)
Modified: brlcad/branches/dm-fb-merge/INSTALL
===================================================================
--- brlcad/branches/dm-fb-merge/INSTALL 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/INSTALL 2020-06-05 17:59:25 UTC (rev 76035)
@@ -52,35 +52,32 @@
to source code distributions of BRL-CAD.
For the impatient or simplistic, the following steps should compile,
-test, and install an optimized BRL-CAD quickly into the /usr/brlcad/rel-X.Y.Z
-directory if CMake is installed on your system:
+test, and install an optimized BRL-CAD quickly into the
+/usr/brlcad/rel-VERSION directory if CMake is alrady installed:
- gunzip brlcad-X.Y.Z.tar.gz
- tar -xvf brlcad-X.Y.Z.tar
- mkdir brlcad-build
- cd brlcad-build
- cmake ../brlcad-X.Y.Z -DBRLCAD_BUNDLED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
- make
- make benchmark
- make regress
- make install # as root, e.g. sudo make install
+ tar -zxvf brlcad-VERSION.tar
+ mkdir brlcad-VERSION/build
+ cd brlcad-VERSION/build
+ cmake .. -DBRLCAD_BUNDLED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
+ make -j4
+ make check
+ make install
-If any of the listed steps fail, then something unexpected happened.
-See the REPORTING PROBLEMS section of this document to report the
-problem or the INSTALLING FROM SOURCE section for more comprehensive
+See the REPORTING PROBLEMS section of this document to report any
+problems or the INSTALLING FROM SOURCE section for more comprehensive
instructions.
-Once installed, add /usr/brlcad/rel-X.Y.Z/bin to your path, and you should be
+Once installed, add /usr/brlcad/rel-VERSION/bin to your path, and you should be
able to run any of the 400+ applications that constitute BRL-CAD. For
example, to run the MGED solid modeler:
-PATH=/usr/brlcad/rel-X.Y.Z/bin:$PATH ; export PATH
+PATH=/usr/brlcad/rel-VERSION/bin:$PATH ; export PATH
mged
If you use tcsh or another C-shell based command shell, use this
instead:
-set path=( /usr/brlcad/rel-X.Y.Z/bin $path ) ; rehash
+set path=( /usr/brlcad/rel-VERSION/bin $path ) ; rehash
mged
@@ -126,9 +123,10 @@
Mac OS X Disk Mounting Image:
Mount the .dmg and run the Installer .pkg contained therein. This
-will install into /usr/brlcad/rel-X.Y.Z and will only require confirming that
-your environment is set up properly (i.e. add /usr/brlcad/rel-X.Y.Z/bin to your
-path) as described in the Quick Installation section.
+will install into /usr/brlcad/rel-X.Y.Z and will only require
+confirming that your environment is set up properly (i.e. add
+/usr/brlcad/rel-X.Y.Z/bin to your path) as described in the Quick
+Installation section.
INSTALLING FROM SOURCE
@@ -242,6 +240,14 @@
-DBRLCAD_FLAGS_OPTIMIZATION=ON
+Profile-guided optimization builds are possible via two-pass
+compilation. Compile with this flag set, run the benchmark suite,
+clean the build, and then compile again with this flag set. Supported
+compilers will utilize data from the first pass to guide optimization,
+typically resulting in a significant performance increase:
+
+ -DBRLCAD_PGO=ON
+
See the CONFIGURATION OPTIONS below for more details on all of the
possible settings.
@@ -287,20 +293,32 @@
TESTING FUNCTIONALITY
---------------------
-To test BRL-CAD before installation, you can run the BRL-CAD benchmark.
-The benchmark will report if the results are correct, testing a
-majority of the core functionality of BRL-CAD in addition to testing
-your system's performance:
+The primary build target to validate a compilation of BRL-CAD is:
+ make check
+
+That runs a trio of test sets including "benchmark", "regress", and
+"unit". The first set is a performance test that also validates
+whether ray tracing behavior is correct:
+
make benchmark
-Note that the benchmark target will build ONLY the pieces required for
-the benchmark tests, unless a general make has already been performed.
-For more testing, you can run the regression test suite:
+The second test set is our regression tests that run a host of
+rigorous integration tests and validate essential behavior:
make regress
+The third set runs unit tests that validate low-level behavior in
+BRL-CAD's core libraries:
+ make unit
+
+Last but not least, one may simply run all available tests, though
+note that some tests will intentionally fail:
+
+ make test
+
+
POST-INSTALLATION
-----------------
Modified: brlcad/branches/dm-fb-merge/README
===================================================================
--- brlcad/branches/dm-fb-merge/README 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/README 2020-06-05 17:59:25 UTC (rev 76035)
@@ -69,34 +69,21 @@
COMPILE AND INSTALL
-------------------
-See the INSTALL file for details on configuring, compiling, and
-installing BRL-CAD. In order to compile and install BRL-CAD from a
-source distribution, the build tool CMake is required - see the website
-at http://www.cmake.org for source and binary installers. CMake is also
-available in many Linux and *BSD distributions.
+In order to compile and install BRL-CAD from a source distribution,
+the CMake ( http://www.cmake.org ) configuration tool is requird.
-Once CMake is installed, the following steps may be taken for a full
-default install (starting with a source tarball):
+The following steps should result in a successful install:
- tar -xvzf brlcad-X.Y.Z.tar.gz
- mkdir brlcad-build
- cd brlcad-build
- cmake ../brlcad-X.Y.Z
- make
+ tar -xvzf brlcad-VERSION.tar.gz
+ mkdir brlcad-VERSION/build
+ cd brlcad-VERSION/build
+ cmake .. -DBRLCAD_ENABLE_STRICT=OFF -DCMAKE_BUILD_TYPE=Release
+ make -j4
make install
-where "X.Y.Z" is the version number of BRL-CAD. For those who prefer
-a curses interface, substitute ccmake for cmake above. If the graphical
-interface available from CMake is installed cmake-gui may be
-substituted for cmake. These interfaces will display the various
-configuration options available when building BRL-CAD, or the options
-may be set directly via command line -D options.
-The configure wrapper script may be substituted for cmake in the above
-steps for a more autotools-like configuration experience.
+See the INSTALL file for explanation of the various configuration
+options available when building BRL-CAD.
-Users on multiprocessor systems will be able to speed up their builds
-by passing the -j option to make (e.g. make -j4, assuming GNU make).
-
Once the build completes and assuming you have proper filesystem
permissions, you should be able to begin the installation by running
the "make install" . By default, the package is configured to install
Index: brlcad/branches/dm-fb-merge/db
===================================================================
--- brlcad/branches/dm-fb-merge/db 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/db 2020-06-05 17:59:25 UTC (rev 76035)
Property changes on: brlcad/branches/dm-fb-merge/db
___________________________________________________________________
Modified: svn:mergeinfo
## -6,4 +6,5 ##
/brlcad/branches/opencl/db:65867-66137
/brlcad/branches/osg/db:62110-62113
/brlcad/branches/prep-cache/db:68236-68933
-/brlcad/branches/tcltk86/db:68300-75257
\ No newline at end of property
+/brlcad/branches/tcltk86/db:68300-75257
+/brlcad/trunk/db:75988-76034
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/db/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/db/CMakeLists.txt 2020-06-05 17:56:16 UTC
(rev 76034)
+++ brlcad/branches/dm-fb-merge/db/CMakeLists.txt 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -53,21 +53,15 @@
# the sense that it uses libgcv...)
if(${MODEL_TYPE} STREQUAL "3dm")
- # Because we won't know the output directory in the script reliably until
run time,
- # we append CURRENT_BUILD_DIR as a string to the arguments - it is the
script's
- # responsibility to handle it correctly at run time.
- set(CMD_ARGS "-o" "CURRENT_BUILD_DIR/${output_file}"
"${CMAKE_CURRENT_SOURCE_DIR}/${in_model}")
-
+ set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${in_model}")
+ set(OUTPUT_FILE "${output_file}")
# Use the model name for the script, since the output file is specific to
this input
- set(script_file "${CMAKE_CURRENT_BINARY_DIR}/${in_model_root}.cmake")
+ configure_file("${CMAKE_SOURCE_DIR}/db/conv_run.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${in_model_root}.cmake" @ONLY)
- # We know enough - write the script
- generate_cmd_script(3dm-g "${script_file}" OLOG "${log_file}" ELOG
"${log_file}" CARGS "${CMD_ARGS}")
-
# Define the target
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BUILD_DIR_SCRIPT}/${output_file}
- COMMAND ${CMAKE_COMMAND} -P "${script_file}"
+ COMMAND ${CMAKE_COMMAND} -DEXEC=$<TARGET_FILE:3dm-g> -P
"${CMAKE_CURRENT_BINARY_DIR}/${in_model_root}.cmake"
DEPENDS 3dm-g ${CMAKE_CURRENT_SOURCE_DIR}/${in_model}
)
Copied: brlcad/branches/dm-fb-merge/db/conv_run.cmake.in (from rev 76034,
brlcad/trunk/db/conv_run.cmake.in)
===================================================================
--- brlcad/branches/dm-fb-merge/db/conv_run.cmake.in
(rev 0)
+++ brlcad/branches/dm-fb-merge/db/conv_run.cmake.in 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -0,0 +1,41 @@
+string(REPLACE "\\" "" GCV_EXEC "${EXEC}")
+set(INPUT_FILE "@INPUT_FILE@")
+set(OUTPUT_FILE "@OUTPUT_FILE@")
+
+# NOTE: OUTPUT_FILE needs to be defined in terms of a path relative to the root
+# of the build diretory, not as an absolute path. Since that root may change
+# at runtime in multiconfig builds, the full output path cannot be encoded
+# directly into the generated script.
+get_filename_component(OF_ABS "${OUTPUT_FILE}" ABSOLUTE)
+if ("${OF_ABS}" STREQUAL "${OUTPUT_FILE}")
+ message(FATAL_ERROR "Absoute output file path \"${OUTPUT_FILE}\" supplied
for conversion of \"${INPUT_FILE}\" - path must be relative.")
+endif ("${OF_ABS}" STREQUAL "${OUTPUT_FILE}")
+
+# Because the build directory changes at runtime in multiconfig builds, we
+# need to deduce its current value from GCV_EXEC.
+# TODO - this breaks if the bin directory is more than one deep...
+get_filename_component(CBDIR "${GCV_EXEC}" DIRECTORY)
+get_filename_component(CROOT "${CBDIR}" DIRECTORY)
+
+# BRLCAD_ROOT is the hammer that makes certain we are running
+# things found in the build directory.
+set(ENV{BRLCAD_ROOT} "${CROOT}")
+
+# Now that we know the root, finalize the full path output file location
+set(OUTPUT_FILE "${CROOT}/${OUTPUT_FILE}")
+
+execute_process(
+ COMMAND "${GCV_EXEC}" -o "${OUTPUT_FILE}" "${INPUT_FILE}"
+ RESULT_VARIABLE conv_result OUTPUT_VARIABLE conv_log ERROR_VARIABLE conv_log
+ )
+
+if(conv_result)
+ message(FATAL_ERROR "[geometry conversion] Failure:
${conv_result}\n${GCV_EXEC} -o \"${OUTPUT_FILE}\"
\"${INPUT_FILE}\"\n\n${conv_log}")
+endif(conv_result)
+
+# Local Variables:
+# tab-width: 8
+# mode: cmake
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=2 tabstop=8
Index: brlcad/branches/dm-fb-merge/doc
===================================================================
--- brlcad/branches/dm-fb-merge/doc 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/doc 2020-06-05 17:59:25 UTC (rev 76035)
Property changes on: brlcad/branches/dm-fb-merge/doc
___________________________________________________________________
Modified: svn:mergeinfo
## -8,4 +8,4 ##
/brlcad/branches/osg/doc:62110-62113
/brlcad/branches/prep-cache/doc:68236-68933
/brlcad/branches/tcltk86/doc:68300-75257
-/brlcad/trunk/doc:75512-75597,75630-75814,75935-75987
\ No newline at end of property
+/brlcad/trunk/doc:75512-75597,75630-75814,75935-76034
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/doc/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/doc/CMakeLists.txt 2020-06-05 17:56:16 UTC
(rev 76034)
+++ brlcad/branches/dm-fb-merge/doc/CMakeLists.txt 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -212,6 +212,10 @@
STARTERS
STRATEGY
notes/bsd_semaphore_bug.txt
+ notes/cmake_paths/CMakeLists.txt
+ notes/cmake_paths/README.txt
+ notes/cmake_paths/dir_info.c
+ notes/cmake_paths/test.cmake.in
notes/cmake_vars.txt
notes/csv_to_comgeom.txt
notes/implicit_constraints.txt
Modified: brlcad/branches/dm-fb-merge/doc/docbook/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/CMakeLists.txt 2020-06-05
17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/doc/docbook/CMakeLists.txt 2020-06-05
17:59:25 UTC (rev 76035)
@@ -1,27 +1,16 @@
+# Define a build target that builds a no-op executable, so we can ensure
+# a target for generator expression use regardless of other changes elsewhere
+# in the build system
+add_executable(db_dir_info db_dir_info.c)
+
# We need various configuration files set up for DocBook processing tools
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/brlcad/)
+add_subdirectory(resources)
-# First, define the commands to expand the third party components we will need
to handle
-# DocBook processing from their archives into the build directory
-include(${CMAKE_CURRENT_SOURCE_DIR}/resources/other/expand.cmake)
-
# Rework CMake binary and source paths for DocBook templates - if we
# have spaces in the paths, they will cause a problem.
string(REPLACE " " "%20" DOCBOOK_BINARY_DIR "${CMAKE_BINARY_DIR}")
string(REPLACE " " "%20" DOCBOOK_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
-# Common stylesheets for all DocBook sources
-if(BRLCAD_EXTRADOCS_HTML OR BRLCAD_EXTRADOCS_PDF OR BRLCAD_EXTRADOCS_MAN OR
BRLCAD_EXTRADOCS_PHP OR BRLCAD_EXTRADOCS_PPT)
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/brlcad/brlcad-common.xsl.in
- ${CMAKE_CURRENT_BINARY_DIR}/resources/brlcad/brlcad-common.xsl)
- # Fonts definition
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/brlcad/brlcad-fonts.xsl.in
- ${CMAKE_CURRENT_BINARY_DIR}/resources/brlcad/brlcad-fonts.xsl)
- # Wordpress
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/brlcad/wordpress.xsl.in
- ${CMAKE_CURRENT_BINARY_DIR}/resources/brlcad/wordpress.xsl)
-endif(BRLCAD_EXTRADOCS_HTML OR BRLCAD_EXTRADOCS_PDF OR BRLCAD_EXTRADOCS_MAN OR
BRLCAD_EXTRADOCS_PHP OR BRLCAD_EXTRADOCS_PPT)
-
# Files for PDF products
if(BRLCAD_EXTRADOCS_PDF)
# Apache FOP needs a couple of config files set up
@@ -29,32 +18,35 @@
configure_file(${CMAKE_SOURCE_DIR}/doc/docbook/fop.xconf.in
${CMAKE_BINARY_DIR}/doc/docbook/fop.xconf)
endif(BRLCAD_EXTRADOCS_PDF)
+# For the html files, we need brlcad.css
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/brlcad_css-${CMAKE_CFG_INTDIR}-done
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/css/brlcad.css
$<TARGET_FILE_DIR:db_dir_info>/${RBIN_DIR}/${DOC_DIR}/html/css/brlcad.css
+ COMMAND "${CMAKE_COMMAND}" -E touch
${CMAKE_CURRENT_BINARY_DIR}/brlcad_css-${CMAKE_CFG_INTDIR}-done
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/css/brlcad.css
+ )
+add_custom_target(brlcad_css DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/brlcad_css-${CMAKE_CFG_INTDIR}-done)
+install(FILES css/brlcad.css DESTINATION ${DOC_DIR}/html/css)
+
# Include CMake macros for DocBook.
include(${BRLCAD_SOURCE_DIR}/misc/CMake/DocBook.cmake)
-# For the html files, we need brlcad.css
-if(NOT CMAKE_CONFIGURATION_TYPES)
- configure_file(css/brlcad.css
${CMAKE_BINARY_DIR}/${DOC_DIR}/html/css/brlcad.css)
-else(NOT CMAKE_CONFIGURATION_TYPES)
- foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
- string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
- configure_file(css/brlcad.css
${CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}}/${DOC_DIR}/html/css/brlcad.css)
- endforeach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
-endif(NOT CMAKE_CONFIGURATION_TYPES)
-install(FILES css/brlcad.css DESTINATION ${DOC_DIR}/html/css)
-
add_subdirectory(articles)
add_subdirectory(books)
add_subdirectory(lessons)
add_subdirectory(presentations)
-add_subdirectory(resources)
add_subdirectory(specifications)
add_subdirectory(system)
-CMAKEFILES(README fop.xconf.in log4j.properties)
-CMAKEFILES(README.DB_authors_notes)
-CMAKEFILES(css/brlcad.css)
-CMAKEFILES(CMakeLists.txt)
+set(ignore_files
+ CMakeLists.txt
+ README
+ README.DB_authors_notes
+ css/brlcad.css
+ fop.xconf.in
+ log4j.properties
+ )
+CMAKEFILES(${ignore_files})
# Local Variables:
# tab-width: 8
Modified: brlcad/branches/dm-fb-merge/doc/docbook/README
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/README 2020-06-05 17:56:16 UTC
(rev 76034)
+++ brlcad/branches/dm-fb-merge/doc/docbook/README 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -149,52 +149,12 @@
VALIDATION
----------
-It is possible to add a validation step to DocBook compilation by
-defining the CMake variable BRLCAD_EXTRADOCS_VALIDATE to ON.
+It is possible to add a validation step to DocBook compilation by defining the
+CMake variable BRLCAD_EXTRADOCS_VALIDATE to ON. This will use xmllint to
+validate the xml files as they are built.
-By default, this will use xmllint to validate the xml files as
-they are built.
+By default, this option is enable if the BRL-CAD strict build is enabled.
-In order to use a different validation program the user must obtain some
-external tools that are not presently part of the BRL-CAD package:
-
- For the 'msv' validation method (a recommended method):
-
- * msv
- Oracle Multi-Schema XML Validator (MSV) (see http://msv.java.net/)
-
- * Java
- a working Java run-time environment
-
- For the 'nvdl' validation method:
-
- * onvdl.jar
- a Java jar file with the oNVDL validation tool (see
- https://sourceforge.net/projects/onvdl/
-
- * Java
- a working Java run-time environment
-
- For the 'rnv' validation method:
-
- * rnv
- http://sourceforge.net/projects/rnv/
-
- * expat library
- present in most Linux/Unix distributions, see
- http://expat.sourceforge.net/
-
-To use these tools, a <toolname>.cmake.in file must be present
-in the misc/CMake source directory. This file tells CMake how
-to run the tool in question. Examples for msv and rnv are already
-present - see misc/CMake/rnv.cmake.in and misc/CMake/msv.cmake.in
-
-Once the correct file is present, configure CMake with options
-similar to the following (alter for your specific tool):
-
-cmake .. -DBRLCAD_EXTRADOCS_VALIDATE=ON -DVALIDATE_EXECUTABLE=msv
-
-
OTHER CONSIDERATIONS
--------------------
Copied: brlcad/branches/dm-fb-merge/doc/docbook/db_dir_info.c (from rev 76034,
brlcad/trunk/doc/docbook/db_dir_info.c)
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/db_dir_info.c
(rev 0)
+++ brlcad/branches/dm-fb-merge/doc/docbook/db_dir_info.c 2020-06-05
17:59:25 UTC (rev 76035)
@@ -0,0 +1,32 @@
+/* D B _ D I R _ I N F O . C
+ * BRL-CAD
+ *
+ * Published in 2020 by the United States Government.
+ * This work is in the public domain.
+ *
+ */
+/** @file dir_info.c
+ *
+ * This is a stub file, whose purpose is to provide the Docbook logic with an
+ * add_executable build target that can be passed to scripts in order to decode
+ * at runtime what the location of BR-CAD's build directory is.
+ *
+ * Unlike most other BRL-CAD logic, Docbook building may be done without any
+ * software build targets needing to be processed if the necessary system
+ * tools are in place. Since it is otherwise difficult to reliably get the
+ * location of the current build directory in multiconfig build tools, this
+ * file is used to provide a db_dir_info build target to reference in CMake.
+ */
+
+int main() {
+}
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Modified: brlcad/branches/dm-fb-merge/doc/docbook/resources/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/resources/CMakeLists.txt
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/doc/docbook/resources/CMakeLists.txt
2020-06-05 17:59:25 UTC (rev 76035)
@@ -1,62 +1,11 @@
-set(dr_ignore_files
+add_subdirectory(brlcad)
+add_subdirectory(other)
+
+set(ignore_files
CMakeLists.txt
README
- brlcad/brlcad-article-fo-stylesheet.xsl.in
- brlcad/brlcad-article-xhtml-stylesheet.xsl.in
- brlcad/brlcad-book-fo-stylesheet.xsl.in
- brlcad/brlcad-book-xhtml-stylesheet.xsl.in
- brlcad/brlcad-common.xsl.in
- brlcad/brlcad-fo-stylesheet.xsl.in
- brlcad/brlcad-fonts.xsl.in
- brlcad/brlcad-gendata.xsl
- brlcad/brlcad-lesson-fo-stylesheet.xsl.in
- brlcad/brlcad-lesson-xhtml-stylesheet.xsl.in
- brlcad/brlcad-man-fo-stylesheet.xsl.in
- brlcad/brlcad-man-stylesheet.xsl.in
- brlcad/brlcad-man-xhtml-stylesheet.xsl.in
- brlcad/brlcad-presentation-fo-stylesheet.xsl.in
- brlcad/brlcad-presentation-xhtml-stylesheet.xsl.in
- brlcad/brlcad-specification-fo-stylesheet.xsl.in
- brlcad/brlcad-specification-xhtml-stylesheet.xsl.in
- brlcad/brlcad-xhtml-header-navigation.xsl
- brlcad/brlcad-xhtml-stylesheet.xsl.in
- brlcad/center-table-print.xsl
- brlcad/images/brlcad-logo-669966.svg
- brlcad/images/brlcad-logo-6699cc.svg
- brlcad/images/brlcad-logo-blue.svg
- brlcad/images/brlcad-logo-cc6666.svg
- brlcad/images/brlcad-logo-cc9966.svg
- brlcad/images/brlcad-logo-green.svg
- brlcad/images/brlcad-logo-limegreen.svg
- brlcad/images/brlcad-logo-red.svg
- brlcad/images/logo-vm-gears.png
- brlcad/images/logo-vm-gears.svg
- brlcad/presentation.xsl.in
- brlcad/tutorial-cover-template.xsl.in
- brlcad/tutorial-template.xsl.in
- brlcad/wordpress.xsl.in
- other/README.schema
- other/docbook-5.0.tar.bz2
- other/docbook5xi.rnc
- other/docbookxi.nvdl
- other/expand.cmake
- other/fonts/README
- other/fonts/dejavu-lgc-fonts.tar.bz2
- other/fonts/dejavu_COPYING.txt
- other/fonts/stix-fonts.tar.bz2
- other/fonts/stix_COPYING.txt
- other/fonts/y14.5.tar.bz2
- other/fonts/y14.5_COPYING.txt
- other/offo/README.offo
- other/offo/licenses.txt
- other/offo/offo-2.0.tar.bz2
- other/standard/README.svg
- other/standard/README.xsl
- other/standard/docbook-xsl-ns.tar.bz2
- other/standard/met-fonts.xsl
- other/standard/w3_svg_dtd.tar.bz2
)
-CMAKEFILES(${dr_ignore_files})
+CMAKEFILES(${ignore_files})
# Local Variables:
# tab-width: 8
Copied: brlcad/branches/dm-fb-merge/doc/docbook/resources/brlcad/CMakeLists.txt
(from rev 76034, brlcad/trunk/doc/docbook/resources/brlcad/CMakeLists.txt)
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/resources/brlcad/CMakeLists.txt
(rev 0)
+++ brlcad/branches/dm-fb-merge/doc/docbook/resources/brlcad/CMakeLists.txt
2020-06-05 17:59:25 UTC (rev 76035)
@@ -0,0 +1,68 @@
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/brlcad/)
+
+# Rework CMake binary and source paths for DocBook templates - if we
+# have spaces in the paths, they will cause a problem.
+string(REPLACE " " "%20" DOCBOOK_BINARY_DIR "${CMAKE_BINARY_DIR}")
+string(REPLACE " " "%20" DOCBOOK_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
+
+# Because the core resources for Docbook are not different between the various
+# build configurations, we maintain one copy of the "set up" files for all
+# configurations rather than building the entire resources setup per-config.
+
+# Common xsl for all outputs
+configure_file(brlcad-common.xsl.in
${CMAKE_CURRENT_BINARY_DIR}/brlcad-common.xsl)
+
+# Fonts definition
+configure_file(brlcad-fonts.xsl.in
${CMAKE_CURRENT_BINARY_DIR}/brlcad-fonts.xsl)
+
+# Wordpress
+configure_file(wordpress.xsl.in ${CMAKE_CURRENT_BINARY_DIR}/wordpress.xsl)
+
+# Make sure distcheck knows about all files in directory
+set(ignore_files
+ CMakeLists.txt
+ brlcad-article-fo-stylesheet.xsl.in
+ brlcad-article-xhtml-stylesheet.xsl.in
+ brlcad-book-fo-stylesheet.xsl.in
+ brlcad-book-xhtml-stylesheet.xsl.in
+ brlcad-common.xsl.in
+ brlcad-fo-stylesheet.xsl.in
+ brlcad-fonts.xsl.in
+ brlcad-gendata.xsl
+ brlcad-lesson-fo-stylesheet.xsl.in
+ brlcad-lesson-xhtml-stylesheet.xsl.in
+ brlcad-man-fo-stylesheet.xsl.in
+ brlcad-man-stylesheet.xsl.in
+ brlcad-man-xhtml-stylesheet.xsl.in
+ brlcad-presentation-fo-stylesheet.xsl.in
+ brlcad-presentation-xhtml-stylesheet.xsl.in
+ brlcad-specification-fo-stylesheet.xsl.in
+ brlcad-specification-xhtml-stylesheet.xsl.in
+ brlcad-xhtml-header-navigation.xsl
+ brlcad-xhtml-stylesheet.xsl.in
+ center-table-print.xsl
+ images/brlcad-logo-669966.svg
+ images/brlcad-logo-6699cc.svg
+ images/brlcad-logo-blue.svg
+ images/brlcad-logo-cc6666.svg
+ images/brlcad-logo-cc9966.svg
+ images/brlcad-logo-green.svg
+ images/brlcad-logo-limegreen.svg
+ images/brlcad-logo-red.svg
+ images/logo-vm-gears.png
+ images/logo-vm-gears.svg
+ presentation.xsl.in
+ tutorial-cover-template.xsl.in
+ tutorial-template.xsl.in
+ wordpress.xsl.in
+ )
+
+CMAKEFILES(${ignore_files})
+
+# Local Variables:
+# tab-width: 8
+# mode: cmake
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=2 tabstop=8
+
Copied: brlcad/branches/dm-fb-merge/doc/docbook/resources/other/CMakeLists.txt
(from rev 76034, brlcad/trunk/doc/docbook/resources/other/CMakeLists.txt)
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/resources/other/CMakeLists.txt
(rev 0)
+++ brlcad/branches/dm-fb-merge/doc/docbook/resources/other/CMakeLists.txt
2020-06-05 17:59:25 UTC (rev 76035)
@@ -0,0 +1,116 @@
+
+# Define the commands to expand the third party components we will need to
handle
+# DocBook processing from their archives into the build directory
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docbook-schema)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/docbook-schema)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fonts/dejavu-lgc)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/fonts/dejavu-lgc)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fonts/stix)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/fonts/stix)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/offo)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/offo/source)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/offo/binary)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/offo/README)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/standard/svg)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/standard/svg)
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/standard/xsl)
+DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/standard/xsl)
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/docbook-schema/schema.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/docbook-5.0.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/docbookxi.nvdl
${CMAKE_CURRENT_BINARY_DIR}/docbook-schema/docbookxi.nvdl
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/docbook-schema/schema.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/docbookxi.nvdl
${CMAKE_CURRENT_SOURCE_DIR}/docbook-5.0.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+add_custom_target(schema-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/docbook-schema/schema.sentinel)
+SetTargetFolder(schema-expand "DocBook")
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fonts/dejavu-lgc/dejavu-lgc.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/fonts/dejavu-lgc-fonts.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/fonts/dejavu-lgc/dejavu-lgc.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fonts/dejavu-lgc-fonts.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fonts
+ )
+add_custom_target(fonts-dejavu-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/fonts/dejavu-lgc/dejavu-lgc.sentinel)
+SetTargetFolder(fonts-dejavu-expand "DocBook")
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fonts/stix/stix.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/fonts/stix-fonts.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/fonts/stix/stix.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fonts/stix-fonts.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fonts
+ )
+add_custom_target(fonts-stix-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/fonts/stix/stix.sentinel)
+SetTargetFolder(fonts-stix-expand "DocBook")
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/offo/offo2_0.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/offo/offo-2.0.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/offo/offo2_0.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/offo/offo-2.0.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ )
+add_custom_target(offo-2-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/offo/offo2_0.sentinel)
+SetTargetFolder(offo-2-expand "DocBook")
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/standard/svg/svg.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/standard/w3_svg_dtd.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/standard/met-fonts.xsl
${CMAKE_CURRENT_BINARY_DIR}/standard/svg/met-fonts.xsl
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/standard/svg/svg.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/standard/met-fonts.xsl
${CMAKE_CURRENT_SOURCE_DIR}/standard/w3_svg_dtd.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/standard
+ )
+add_custom_target(svg-dtd-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/standard/svg/svg.sentinel)
+SetTargetFolder(svg-dtd-expand "DocBook")
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/standard/xsl/xsl.sentinel
+ COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/standard/docbook-xsl-ns.tar.bz2
+ COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/standard/xsl/xsl.sentinel
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/standard/docbook-xsl-ns.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/standard
+ )
+add_custom_target(xsl-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/standard/xsl/xsl.sentinel)
+SetTargetFolder(xsl-expand "DocBook")
+
+# Build up the set of targets defining resources, and write it to the cache
+# immediately so targets in other directories can see it
+set(DOCBOOK_RESOURCE_FILES schema-expand fonts-dejavu-expand fonts-stix-expand
offo-2-expand svg-dtd-expand xsl-expand)
+set(DOCBOOK_RESOURCE_FILES "${DOCBOOK_RESOURCE_FILES}" CACHE STRING "DocBook
target list")
+
+set(ignore_files
+ CMakeLists.txt
+ README.schema
+ docbook-5.0.tar.bz2
+ docbook5xi.rnc
+ docbookxi.nvdl
+ fonts/README
+ fonts/dejavu-lgc-fonts.tar.bz2
+ fonts/dejavu_COPYING.txt
+ fonts/stix-fonts.tar.bz2
+ fonts/stix_COPYING.txt
+ fonts/y14.5.tar.bz2
+ fonts/y14.5_COPYING.txt
+ offo/README.offo
+ offo/licenses.txt
+ offo/offo-2.0.tar.bz2
+ standard/README.svg
+ standard/README.xsl
+ standard/docbook-xsl-ns.tar.bz2
+ standard/met-fonts.xsl
+ standard/w3_svg_dtd.tar.bz2
+ )
+CMAKEFILES(${ignore_files})
+
+
+# Local Variables:
+# tab-width: 8
+# mode: cmake
+# indent-tabs-mode: t
+# End:
+# ex: shiftwidth=2 tabstop=8
Deleted: brlcad/branches/dm-fb-merge/doc/docbook/resources/other/expand.cmake
===================================================================
--- brlcad/branches/dm-fb-merge/doc/docbook/resources/other/expand.cmake
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/doc/docbook/resources/other/expand.cmake
2020-06-05 17:59:25 UTC (rev 76035)
@@ -1,81 +0,0 @@
-
-# Define the commands to expand the third party components we will need to
handle
-# DocBook processing from their archives into the build directory
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema)
-file(MAKE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/dejavu-lgc)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/dejavu-lgc)
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/stix)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/stix)
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/source)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/binary)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/README)
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg)
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/xsl)
-DISTCLEAN(${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/xsl)
-
-add_custom_command(
- OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema/schema.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/docbook-5.0.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/docbookxi.nvdl
${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema/docbookxi.nvdl
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema/schema.sentinel
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resources/other/docbookxi.nvdl
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/docbook-5.0.tar.bz2
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other
- )
-add_custom_target(schema-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/docbook-schema/schema.sentinel)
-SetTargetFolder(schema-expand "DocBook")
-
-add_custom_command(
- OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/dejavu-lgc/dejavu-lgc.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/fonts/dejavu-lgc-fonts.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/dejavu-lgc/dejavu-lgc.sentinel
- DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/fonts/dejavu-lgc-fonts.tar.bz2
- WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts
- )
-add_custom_target(fonts-dejavu-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/dejavu-lgc/dejavu-lgc.sentinel)
-SetTargetFolder(fonts-dejavu-expand "DocBook")
-
-add_custom_command(
- OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/stix/stix.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/fonts/stix-fonts.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/stix/stix.sentinel
- DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/fonts/stix-fonts.tar.bz2
- WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts
- )
-add_custom_target(fonts-stix-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/fonts/stix/stix.sentinel)
-SetTargetFolder(fonts-stix-expand "DocBook")
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/offo2_0.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/offo/offo-2.0.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/offo2_0.sentinel
- DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/offo/offo-2.0.tar.bz2
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources/other/
- )
-add_custom_target(offo-2-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/offo/offo2_0.sentinel)
-SetTargetFolder(offo-2-expand "DocBook")
-
-add_custom_command(
- OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg/svg.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/w3_svg_dtd.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/met-fonts.xsl
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg/met-fonts.xsl
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg/svg.sentinel
- DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/met-fonts.xsl
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/w3_svg_dtd.tar.bz2
- WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard
- )
-add_custom_target(svg-dtd-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/svg/svg.sentinel)
-SetTargetFolder(svg-dtd-expand "DocBook")
-
-add_custom_command(
- OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/xsl/xsl.sentinel
- COMMAND ${CMAKE_COMMAND} -E tar xjf
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/docbook-xsl-ns.tar.bz2
- COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/xsl/xsl.sentinel
- DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/other/standard/docbook-xsl-ns.tar.bz2
- WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard
- )
-add_custom_target(xsl-expand DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/resources/other/standard/xsl/xsl.sentinel)
-SetTargetFolder(xsl-expand "DocBook")
-
-set(DOCBOOK_RESOURCE_FILES schema-expand fonts-dejavu-expand fonts-stix-expand
offo-2-expand svg-dtd-expand xsl-expand)
Index: brlcad/branches/dm-fb-merge/include
===================================================================
--- brlcad/branches/dm-fb-merge/include 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/include 2020-06-05 17:59:25 UTC (rev 76035)
Property changes on: brlcad/branches/dm-fb-merge/include
___________________________________________________________________
Modified: svn:mergeinfo
## -8,4 +8,4 ##
/brlcad/branches/osg/include:62110-62113
/brlcad/branches/prep-cache/include:68236-68933
/brlcad/branches/tcltk86/include:68300-75257
-/brlcad/trunk/include:75463-75467,75630-75814,75880-75987
\ No newline at end of property
+/brlcad/trunk/include:75463-75467,75630-75814,75880-76034
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/include/common.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/common.h 2020-06-05 17:56:16 UTC
(rev 76034)
+++ brlcad/branches/dm-fb-merge/include/common.h 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -524,6 +524,19 @@
# define CPP_FILELINE __FILE__ ":" CPP_XSTR(__LINE__)
#endif
+/**
+ * If we've not already defined COMPILER_DLLEXPORT and COMPILER_DLLIMPORT,
+ * define them away so code including the *_EXPORT header logic won't
+ * fail.
+ */
+#ifndef COMPILER_DLLEXPORT
+# define COMPILER_DLLEXPORT
+#endif
+
+#ifndef COMPILER_DLLIMPORT
+# define COMPILER_DLLIMPORT
+#endif
+
#endif /* COMMON_H */
/** @} */
Modified: brlcad/branches/dm-fb-merge/misc/CMake/BRLCAD_Util.cmake
===================================================================
--- brlcad/branches/dm-fb-merge/misc/CMake/BRLCAD_Util.cmake 2020-06-05
17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/misc/CMake/BRLCAD_Util.cmake 2020-06-05
17:59:25 UTC (rev 76035)
@@ -469,63 +469,6 @@
endfunction(ADD_TARGET_DEPS tname)
#---------------------------------------------------------------------------
-# Write out an execution script to run commands with the necessary
-# variables set to allow execution in the build directory, even if
-# there are installed libraries present in the final installation
-# directory.
-function(generate_cmd_script cmd_exe script_file)
-
- cmake_parse_arguments(GCS "" "OLOG;ELOG" "CARGS" ${ARGN})
-
- # Initialize file
- file(WRITE "${script_file}" "# Script to run ${cmd_exe}\n")
-
- # Handle multiconfig (must be run-time determination for Visual Studio and
XCode)
- # TODO - logic writing this trick needs to become some sort of standard
routine...
- file(APPEND "${script_file}" "if(EXISTS
\"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
- file(APPEND "${script_file}" " set(CBDIR
\"${CMAKE_BINARY_DIR}/Release\")\n")
- file(APPEND "${script_file}" "elseif(EXISTS
\"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Debug\")\n")
- file(APPEND "${script_file}" " set(CBDIR \"${CMAKE_BINARY_DIR}/Debug\")\n")
- file(APPEND "${script_file}" "else(EXISTS
\"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
- file(APPEND "${script_file}" " set(CBDIR \"${CMAKE_BINARY_DIR}\")\n")
- file(APPEND "${script_file}" "endif(EXISTS
\"${CMAKE_BINARY_DIR}/CMakeTmp/CURRENT_PATH/Release\")\n")
-
- # BRLCAD_ROOT is the hammer that makes certain we are running
- # things found in the build directory
- file(APPEND "${script_file}" "set(ENV{BRLCAD_ROOT} \"\${CBDIR}\")\n")
-
- # Substitute in the correct binary path anywhere it is needed in the args
- file(APPEND "${script_file}" "string(REPLACE \"CURRENT_BUILD_DIR\"
\"\${CBDIR}\" FIXED_CMD_ARGS \"${GCS_CARGS}\")\n")
-
- # Use the CMake executable to figure out if we need an extension
- get_filename_component(EXE_EXT "${CMAKE_COMMAND}" EXT)
-
- # Write the actual cmake command to run the process
- file(APPEND "${script_file}" "execute_process(COMMAND
\"\${CBDIR}/${BIN_DIR}/${cmd_exe}${EXE_EXT}\" \${FIXED_CMD_ARGS}
RESULT_VARIABLE CR OUTPUT_VARIABLE CO ERROR_VARIABLE CE)\n")
-
- # Log the outputs, if we are supposed to do that
- if(GCS_OLOG)
- file(APPEND "${script_file}" "file(APPEND \"${GCS_OLOG}\" \"\${CO}\")\n")
- endif(GCS_OLOG)
- if(GCS_ELOG)
- file(APPEND "${script_file}" "file(APPEND \"${GCS_ELOG}\" \"\${CE}\")\n")
- endif(GCS_ELOG)
-
- # Fail the command if the result was non-zero
- file(APPEND "${script_file}" "if(CR)\n")
- file(APPEND "${script_file}" " message(FATAL_ERROR
\"\${CBDIR}/${BIN_DIR}/${cmd_exe}${EXE_EXT} failure:
\${CR}\\n\${CO}\\n\${CE}\")\n")
- file(APPEND "${script_file}" "endif(CR)\n")
-
- # If we are doing distclean, let CMake know to remove the script and log
files
- if(COMMAND distclean)
- set(distclean_files "${script_file}" "${GCS_OLOG}" "${GCS_ELOG}")
- list(REMOVE_DUPLICATES distclean_files)
- distclean(${distclean_files})
- endif(COMMAND distclean)
-
-endfunction(generate_cmd_script)
-
-#---------------------------------------------------------------------------
# Set variables reporting time of configuration. Sets CONFIG_DATE and
# CONFIG_DATESTAMP in parent scope.
#
Modified: brlcad/branches/dm-fb-merge/misc/CMake/DocBook.cmake
===================================================================
--- brlcad/branches/dm-fb-merge/misc/CMake/DocBook.cmake 2020-06-05
17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/misc/CMake/DocBook.cmake 2020-06-05
17:59:25 UTC (rev 76035)
@@ -148,6 +148,9 @@
# Convenience target to launch all DocBook builds
add_custom_target(docbook ALL)
set_target_properties(docbook PROPERTIES FOLDER "DocBook")
+if (TARGET brlcad_css)
+ add_dependencies(docbook brlcad_css)
+endif (TARGET brlcad_css)
macro(ADD_DOCBOOK fmts in_xml_files outdir deps_list)
@@ -256,6 +259,9 @@
# the docbook targets are built.
#add_custom_target(docbook-${fname_root}-${path_md5} DEPENDS ${outputs})
#set_target_properties(docbook-${fname_root}-${path_md5} PROPERTIES
FOLDER "DocBook")
+ #if (TARGET brlcad_css)
+ # add_dependencies(docbook-${fname_root}-${path_md5} brlcad_css)
+ #endif (TARGET brlcad_css)
endif(NOT "${outputs}" STREQUAL "")
endforeach(fname ${xml_files})
Modified: brlcad/branches/dm-fb-merge/misc/CMake/Path_Setup.cmake
===================================================================
--- brlcad/branches/dm-fb-merge/misc/CMake/Path_Setup.cmake 2020-06-05
17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/misc/CMake/Path_Setup.cmake 2020-06-05
17:59:25 UTC (rev 76035)
@@ -40,6 +40,21 @@
set(BIN_DIR bin)
endif(NOT BIN_DIR)
+# Define a relative path that will "reset" a path back to
+# the point before BIN_DIR was appended. This is primarily
+# useful when working with generator expressions
+unset(RBIN_DIR CACHE)
+set(LBIN_DIR "${BIN_DIR}")
+while (NOT "${LBIN_DIR}" STREQUAL "")
+ get_filename_component(LBDIR "${LBIN_DIR}" DIRECTORY)
+ set(LBIN_DIR "${LBDIR}")
+ if ("${RBIN_DIR}" STREQUAL "")
+ set(RBIN_DIR "..")
+ else ("${RBIN_DIR}" STREQUAL "")
+ set(RBIN_DIR "../${RBIN_DIR}")
+ endif ("${RBIN_DIR}" STREQUAL "")
+endwhile (NOT "${LBIN_DIR}" STREQUAL "")
+
# The location in which to install BRL-CAD libraries.
if(NOT LIB_DIR)
set(LIB_DIR lib)
Modified: brlcad/branches/dm-fb-merge/misc/flawfinder
===================================================================
--- brlcad/branches/dm-fb-merge/misc/flawfinder 2020-06-05 17:56:16 UTC (rev
76034)
+++ brlcad/branches/dm-fb-merge/misc/flawfinder 2020-06-05 17:59:25 UTC (rev
76035)
@@ -14,7 +14,7 @@
#
# Currently this program can only analyze C/C++ code.
#
-# Copyright (C) 2001-2017 David A. Wheeler.
+# Copyright (C) 2001-2019 David A. Wheeler.
# This is released under the
# GNU General Public License (GPL) version 2 or later (GPL-2.0+):
#
@@ -55,7 +55,7 @@
import hashlib
# import formatter
-version = "2.0.4"
+version = "2.0.11"
# Program Options - these are the default values.
# TODO: Switch to boolean types where appropriate.
@@ -80,7 +80,7 @@
patch_file = "" # File containing (unified) diff output.
loadhitlist = None
savehitlist = None
-diffhitlist = None
+diffhitlist_filename = None
quiet = 0
showheading = 1 # --dataonly turns this off
output_format = 0 # 0 = normal, 1 = html.
@@ -91,6 +91,10 @@
required_regex = None # If non-None, regex that must be met to report
required_regex_compiled = None
+ERROR_ON_DISABLED_VALUE = 999
+error_level = ERROR_ON_DISABLED_VALUE # Level where we're return error code
+error_level_exceeded = False
+
displayed_header = 0 # Have we displayed the header yet?
num_ignored_hits = 0 # Number of ignored hits (used if never_ignore==0)
@@ -112,10 +116,7 @@
sloc = 0 # Physical SLOC
starttime = time.time() # Used to determine analyzed lines/second.
-line_beginning = re.compile(r'(?m)^')
-blank_line = re.compile(r'(?m)^\s+$')
-
# Send warning message. This is written this way to work on
# Python version 2.5 through Python 3.
def print_warning(message):
@@ -183,9 +184,9 @@
# Also, "newfile" can have " (comment)" postpended. Find and eliminate this.
# Note that the expression below is Y10K (and Y100K) ready. :-).
diff_findjunk = re.compile(
- r'^(?P<filename>.*)(' +
- r'(\s\d\d\d\d+-\d\d-\d\d\s+\d\d:\d[0-9:.]+Z?(\s+[\-\+0-9A-Z]+)?)|' +
- r'(\s[A-Za-z][a-z]+\s[A-za-z][a-z]+\s\d+\s\d+:\d[0-9:.]+Z?' +
+ r'^(?P<filename>.*)('
+ r'(\s\d\d\d\d+-\d\d-\d\d\s+\d\d:\d[0-9:.]+Z?(\s+[\-\+0-9A-Z]+)?)|'
+ r'(\s[A-Za-z][a-z]+\s[A-za-z][a-z]+\s\d+\s\d+:\d[0-9:.]+Z?'
r'(\s[\-\+0-9]*)?\s\d\d\d\d+)|'
r'(\s\(.*\)))\s*$'
)
@@ -222,10 +223,6 @@
return None
-git_splitter = ' b/'
-len_git_splitter = len(git_splitter)
-
-
def git_diff_get_filename(sLine):
return diff_git_filename.match(sLine)
@@ -242,7 +239,7 @@
hPatch = open(input_patch_file, 'r')
except BaseException:
print("Error: failed to open", h(input_patch_file))
- sys.exit(1)
+ sys.exit(10)
patched_filename = "" # Name of new file patched by current hunk.
@@ -256,7 +253,7 @@
fn_get_filename = gnu_diff_get_filename
else:
print("Error: Unrecognized patch format")
- sys.exit(1)
+ sys.exit(11)
while True: # Loop-and-half construct. Read a line, end loop when no more
@@ -268,7 +265,7 @@
if patched_filename in patch:
error("filename occurs more than once in the patch: %s" %
patched_filename)
- sys.exit(1)
+ sys.exit(12)
else:
patch[patched_filename] = {}
else:
@@ -276,10 +273,10 @@
if hunk_match:
if patched_filename == "":
error(
- "wrong type of patch file : " +
+ "wrong type of patch file : "
"we have a line number without having seen a filename"
)
- sys.exit(1)
+ sys.exit(13)
initial_number = hunk_match.group('linenumber')
line_counter = 0
else:
@@ -311,10 +308,12 @@
# Take s, and return legal (UTF-8) HTML.
return s.replace("&", "&").replace("<", "<").replace(">", ">")
+
def h(s):
# htmlize s if we're generating html, otherwise just return s.
return htmlize(s) if output_format else s
+
def print_multi_line(text):
# Print text as multiple indented lines.
width = 78
@@ -331,11 +330,12 @@
position = starting_position
print(' ', end='')
print(w, end='')
- position = position + len(w) + 1
+ position += len(w) + 1
+
# This matches references to CWE identifiers, so we can HTMLize them.
# We don't refer to CWEs with one digit, so we'll only match on 2+ digits.
-link_cwe_pattern = re.compile(r'(CWE-([1-9][0-9]+))([,()])')
+link_cwe_pattern = re.compile(r'(CWE-([1-9][0-9]+))([,()!/])')
# This matches the CWE data, including multiple entries.
find_cwe_pattern = re.compile(r'\(CWE-[^)]*\)')
@@ -394,6 +394,16 @@
def __getitem__(self, X): # Define this so this works: "%(line)" % hit
return getattr(self, X)
+ def __eq__(self, other):
+ return (self.filename == other.filename
+ and self.line == other.line
+ and self.column == other.column
+ and self.level == other.level
+ and self.name == other.name)
+
+ def __ne__(self, other):
+ return not self == other
+
# return CWEs
def cwes(self):
result = find_cwe_pattern.search(self.warning)
@@ -439,7 +449,7 @@
main_text = h("%(warning)s. " % self)
if output_format: # Create HTML link to CWE definitions
main_text = link_cwe_pattern.sub(
- r'<a
href="http://cwe.mitre.org/data/definitions/\2.html">\1</a>\3',
+ r'<a
href="https://cwe.mitre.org/data/definitions/\2.html">\1</a>\3',
main_text)
if single_line:
print(main_text, end='')
@@ -448,8 +458,8 @@
print(' ' + h(self.note), end='')
else:
if self.suggestion:
- main_text = main_text + h(self.suggestion) + ". "
- main_text = main_text + h(self.note)
+ main_text += h(self.suggestion) + ". "
+ main_text += h(self.note)
print()
print_multi_line(main_text)
if output_format:
@@ -476,13 +486,12 @@
if required_regex and (required_regex_compiled.search(hit.warning) is
None):
return
- if hit.level >= minimum_level:
- if linenumber == ignoreline:
- num_ignored_hits = num_ignored_hits + 1
- else:
- hitlist.append(hit)
- if show_immediately:
- hit.show()
+ if linenumber == ignoreline:
+ num_ignored_hits += 1
+ else:
+ hitlist.append(hit)
+ if show_immediately:
+ hit.show()
def internal_warn(message):
@@ -501,12 +510,12 @@
if text[i] == '(':
break
elif text[i] in string.whitespace:
- i = i + 1
+ i += 1
else:
return []
else: # Never found a reasonable ending.
return []
- i = i + 1
+ i += 1
parameters = [""] # Insert 0th entry, so 1st parameter is parameter[1].
currentstart = i
parenlevel = 1
@@ -526,11 +535,11 @@
# parse that deeply, we just need to know we'll stay
# in string mode:
elif c == '\\':
- i = i + 1
+ i += 1
elif incomment:
if c == '*' and text[i:i + 2] == '*/':
incomment = 0
- i = i + 1
+ i += 1
else:
if c == '"':
instring = 1
@@ -538,20 +547,20 @@
instring = 2
elif c == '/' and text[i:i + 2] == '/*':
incomment = 1
- i = i + 1
+ i += 1
elif c == '/' and text[i:i + 2] == '//':
while i < len(text) and text[i] != "\n":
- i = i + 1
+ i += 1
elif c == '\\' and text[i:i + 2] == '\\"':
- i = i + 1 # Handle exposed '\"'
+ i += 1 # Handle exposed '\"'
elif c == '(':
- parenlevel = parenlevel + 1
+ parenlevel += 1
elif c == ',' and (parenlevel == 1):
parameters.append(
p_trailingbackslashes.sub('',
text[currentstart:i]).strip())
currentstart = i + 1
elif c == ')':
- parenlevel = parenlevel - 1
+ parenlevel -= 1
if parenlevel <= 0:
parameters.append(
p_trailingbackslashes.sub(
@@ -565,9 +574,10 @@
"Parsing failed to find end of parameter list; "
"semicolon terminated it in %s" % text[pos:pos + 200])
return parameters
- i = i + 1
+ i += 1
internal_warn("Parsing failed to find end of parameter list in %s" %
text[pos:pos + 200])
+ return [] # Treat unterminated list as an empty list
# These patterns match gettext() and _() for internationalization.
@@ -577,8 +587,8 @@
# In practice, this doesn't seem to be a problem; gettext() is usually
# wrapped around the entire parameter.
# The ?s makes it posible to match multi-line strings.
-gettext_pattern = re.compile(r'(?s)^\s*' + 'gettext' + r'\s*\((.*)\)\s*$')
-undersc_pattern = re.compile(r'(?s)^\s*' + '_(T(EXT)?)?' + r'\s*\((.*)\)\s*$')
+gettext_pattern = re.compile(r'(?s)^\s*' 'gettext' r'\s*\((.*)\)\s*$')
+undersc_pattern = re.compile(r'(?s)^\s*' '_(T(EXT)?)?' r'\s*\((.*)\)\s*$')
def strip_i18n(text):
@@ -604,6 +614,7 @@
"Returns true if text is a C string with 0 or 1 character."
return 1 if p_c_singleton_string.search(text) else 0
+
# This string defines a C constant.
p_c_constant_string = re.compile(r'^\s*L?"([^\\]|\\[^0-6]|\\[0-6]+)*"$')
@@ -614,7 +625,20 @@
# Precompile patterns for speed.
+p_memcpy_sizeof = re.compile(r'sizeof\s*\(\s*([^)\s]*)\s*\)')
+p_memcpy_param_amp = re.compile(r'&?\s*(.*)')
+def c_memcpy(hit):
+ if len(hit.parameters) < 4: # 3 parameters
+ add_warning(hit)
+ return
+
+ m1 = re.search(p_memcpy_param_amp, hit.parameters[1])
+ m3 = re.search(p_memcpy_sizeof, hit.parameters[3])
+ if not m1 or not m3 or m1.group(1) != m3.group(1):
+ add_warning(hit)
+
+
def c_buffer(hit):
source_position = hit.source_position
if source_position <= len(hit.parameters) - 1:
@@ -628,7 +652,7 @@
add_warning(hit)
-p_dangerous_strncat = re.compile(r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+' +
+p_dangerous_strncat = re.compile(r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+'
r'\s*(\)\s*)?(-\s*1\s*)?$')
# This is a heuristic: constants in C are usually given in all
# upper case letters. Yes, this need not be true, but it's true often
@@ -666,7 +690,7 @@
hit.level = 5
hit.note = (
"Risk is high; the length parameter appears to be a constant, "
- + "instead of computing the number of characters left.")
+ "instead of computing the number of characters left.")
add_warning(hit)
return
c_buffer(hit)
@@ -744,9 +768,9 @@
elif p_low_risk_scanf_format.search(source):
# This is often okay, but sometimes extremely serious.
hit.level = 1
- hit.warning = ("It's unclear if the %s limit in the " +
+ hit.warning = ("It's unclear if the %s limit in the "
"format string is small enough (CWE-120)")
- hit.suggestion = ("Check that the limit is sufficiently " +
+ hit.suggestion = ("Check that the limit is sufficiently "
"small, or use a different input function")
else:
# No risky scanf request.
@@ -756,16 +780,16 @@
hit.note = "No risky scanf format detected."
else:
# Format isn't a constant.
- hit.note = ("If the scanf format is influenceable " +
+ hit.note = ("If the scanf format is influenceable "
"by an attacker, it's exploitable.")
add_warning(hit)
-p_dangerous_multi_byte = re.compile(r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+' +
+p_dangerous_multi_byte = re.compile(r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+'
r'\s*(\)\s*)?(-\s*1\s*)?$')
p_safe_multi_byte = re.compile(
- r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+\s*(\)\s*)?' +
- r'/\s*sizeof\s*\(\s*?[A-Za-z_$0-9]+\s*' + r'\[\s*0\s*\]\)\s*(-\s*1\s*)?$')
+ r'^\s*sizeof\s*(\(\s*)?[A-Za-z_$0-9]+\s*(\)\s*)?'
+ r'/\s*sizeof\s*\(\s*?[A-Za-z_$0-9]+\s*\[\s*0\s*\]\)\s*(-\s*1\s*)?$')
def c_multi_byte_to_wide_char(hit):
@@ -778,7 +802,7 @@
hit.level = 5
hit.note = (
"Risk is high, it appears that the size is given as bytes, but
the "
- + "function requires size as characters.")
+ "function requires size as characters.")
elif p_safe_multi_byte.search(num_chars_to_copy):
# This isn't really risk-free, since it might not be the
destination,
# or the destination might be a character array (if it's a char
pointer,
@@ -816,6 +840,14 @@
add_warning(hit) # Found a static array, warn about it.
+def cpp_unsafe_stl(hit):
+ # Use one of the overloaded classes from the STL in C++14 and higher
+ # instead of the <C++14 versions of theses functions that did not
+ # if the second iterator could overflow
+ if len(hit.parameters) <= 4:
+ add_warning(hit)
+
+
def normal(hit):
add_warning(hit)
@@ -850,7 +882,7 @@
"Consider using a function version that stops copying at the end of the
buffer",
"buffer", "", {}),
"memcpy|CopyMemory|bcopy":
- (normal, 2, # I've found this to have a lower risk in practice.
+ (c_memcpy, 2, # I've found this to have a lower risk in practice.
"Does not check for buffer overflows when copying to destination
(CWE-120)",
"Make sure destination can always hold the source data",
"buffer", "", {}),
@@ -865,7 +897,7 @@
"",
"buffer", "", {}),
# TODO: Do more analysis. Added because they're in MS banned list.
-
"StrCat|StrCatA|StrcatW|lstrcatA|lstrcatW|strCatBuff|StrCatBuffA|StrCatBuffW|StrCatChainW|_tccat|_mbccat|_ftcsat|StrCatN|StrCatNA|StrCatNW|StrNCat|StrNCatA|StrNCatW|lstrncat|lstrcatnA|lstrcatnW":
+
"StrCat|StrCatA|StrcatW|lstrcatA|lstrcatW|strCatBuff|StrCatBuffA|StrCatBuffW|StrCatChainW|_tccat|_mbccat|_ftcscat|StrCatN|StrCatNA|StrCatNW|StrNCat|StrNCatA|StrNCatW|lstrncat|lstrcatnA|lstrcatnW":
(normal, 4,
"Does not check for buffer overflows when concatenating to destination
[MS-banned] (CWE-120)",
"",
@@ -875,7 +907,7 @@
1, # Low risk level, because this is often used correctly when FIXING
security
# problems, and raising it to a higher risk level would cause many false
# positives.
- "Easily used incorrectly; doesn't always \\0-terminate or " +
+ "Easily used incorrectly; doesn't always \\0-terminate or "
"check for invalid pointers [MS-banned] (CWE-120)",
"",
"buffer", "", {}),
@@ -884,7 +916,7 @@
1, # Low risk level, because this is often used correctly when FIXING
security
# problems, and raising it to a higher risk levle would cause many false
# positives.
- "Easily used incorrectly; doesn't always \\0-terminate or " +
+ "Easily used incorrectly; doesn't always \\0-terminate or "
"check for invalid pointers [MS-banned] (CWE-120)",
"",
"buffer", "", {}),
@@ -911,9 +943,9 @@
"buffer", "", {}),
"char|TCHAR|wchar_t": # This isn't really a function call, but it works.
(c_static_array, 2,
- "Statically-sized arrays can be improperly restricted, " +
+ "Statically-sized arrays can be improperly restricted, "
"leading to potential overflows or other issues (CWE-119!/CWE-120)",
- "Perform bounds checking, use functions that limit length, " +
+ "Perform bounds checking, use functions that limit length, "
"or ensure that the size is larger than the maximum possible length",
"buffer", "", {'extract_lookahead': 1}),
@@ -943,7 +975,7 @@
# The "syslog" hook will raise "format" issues.
"syslog":
(c_printf, 4,
- "If syslog's format strings can be influenced by an attacker, " +
+ "If syslog's format strings can be influenced by an attacker, "
"they can be exploited (CWE-134)",
"Use a constant format string for syslog",
"format", "", {'format_position': 2}),
@@ -950,7 +982,7 @@
"snprintf|vsnprintf|_snprintf|_sntprintf|_vsntprintf":
(c_printf, 4,
- "If format strings can be influenced by an attacker, they can be " +
+ "If format strings can be influenced by an attacker, they can be "
"exploited, and note that sprintf variations do not always \\0-terminate
(CWE-134)",
"Use a constant for the format specification",
"format", "", {'format_position': 3}),
@@ -957,7 +989,7 @@
"scanf|vscanf|wscanf|_tscanf|vwscanf":
(c_scanf, 4,
- "The scanf() family's %s operation, without a limit specification, " +
+ "The scanf() family's %s operation, without a limit specification, "
"permits buffer overflows (CWE-120, CWE-20)",
"Specify a limit to %s, or use a different input function",
"buffer", "", {'input': 1}),
@@ -974,8 +1006,8 @@
# Often this isn't really a risk, and even when it is, at worst it
# often causes a program crash (and nothing worse).
1,
- "Does not handle strings that are not \\0-terminated; " +
- "if given one it may perform an over-read (it could cause a crash " +
+ "Does not handle strings that are not \\0-terminated; "
+ "if given one it may perform an over-read (it could cause a crash "
"if unprotected) (CWE-126)",
"",
"buffer", "", {}),
@@ -1001,10 +1033,10 @@
"realpath":
(normal, 3,
- "This function does not protect against buffer overflows, " +
+ "This function does not protect against buffer overflows, "
"and some implementations can overflow internally (CWE-120/CWE-785!)",
- "Ensure that the destination buffer is at least of size MAXPATHLEN, and" +
- "to protect against implementation problems, the input argument " +
+ "Ensure that the destination buffer is at least of size MAXPATHLEN, and"
+ "to protect against implementation problems, the input argument "
"should also be checked to ensure it is no larger than MAXPATHLEN",
"buffer", "dangers-c", {}),
@@ -1030,43 +1062,43 @@
"access": # ???: TODO: analyze TOCTOU more carefully.
(normal, 4,
- "This usually indicates a security flaw. If an " +
- "attacker can change anything along the path between the " +
- "call to access() and the file's actual use (e.g., by moving " +
+ "This usually indicates a security flaw. If an "
+ "attacker can change anything along the path between the "
+ "call to access() and the file's actual use (e.g., by moving "
"files), the attacker can exploit the race condition (CWE-362/CWE-367!)",
- "Set up the correct permissions (e.g., using setuid()) and " +
+ "Set up the correct permissions (e.g., using setuid()) and "
"try to open the file directly",
"race",
"avoid-race#atomic-filesystem", {}),
"chown":
(normal, 5,
- "This accepts filename arguments; if an attacker " +
+ "This accepts filename arguments; if an attacker "
"can move those files, a race condition results. (CWE-362)",
"Use fchown( ) instead",
"race", "", {}),
"chgrp":
(normal, 5,
- "This accepts filename arguments; if an attacker " +
+ "This accepts filename arguments; if an attacker "
"can move those files, a race condition results. (CWE-362)",
"Use fchgrp( ) instead",
"race", "", {}),
"chmod":
(normal, 5,
- "This accepts filename arguments; if an attacker " +
+ "This accepts filename arguments; if an attacker "
"can move those files, a race condition results. (CWE-362)",
"Use fchmod( ) instead",
"race", "", {}),
"vfork":
(normal, 2,
- "On some old systems, vfork() permits race conditions, and it's " +
+ "On some old systems, vfork() permits race conditions, and it's "
"very difficult to use correctly (CWE-362)",
"Use fork() instead",
"race", "", {}),
"readlink":
(normal, 5,
- "This accepts filename arguments; if an attacker " +
- "can move those files or change the link content, " +
- "a race condition results. " +
+ "This accepts filename arguments; if an attacker "
+ "can move those files or change the link content, "
+ "a race condition results. "
"Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20)",
# This is often just a bad idea, and it's hard to suggest a
# simple alternative:
@@ -1112,7 +1144,7 @@
# Windows. TODO: Detect correct usage approaches and ignore it.
"GetTempFileName":
(normal, 3,
- "Temporary file race condition in certain cases " +
+ "Temporary file race condition in certain cases "
"(e.g., if run as SYSTEM in many versions of Windows) (CWE-377)",
"",
"tmpfile", "avoid-race", {}),
@@ -1121,7 +1153,7 @@
"execl|execlp|execle|execv|execvp|system|popen|WinExec|ShellExecute":
(normal, 4,
"This causes a new program to execute and is difficult to use safely
(CWE-78)",
- "try using a library call that implements the same functionality " +
+ "try using a library call that implements the same functionality "
"if available",
"shell", "", {}),
@@ -1138,16 +1170,16 @@
"CreateProcess":
(c_hit_if_null, 3,
"This causes a new process to execute and is difficult to use safely
(CWE-78)",
- "Specify the application path in the first argument, NOT as part of the
second, " +
+ "Specify the application path in the first argument, NOT as part of the
second, "
"or embedded spaces could allow an attacker to force a different program
to run",
"shell", "", {'check_for_null': 1}),
"atoi|atol|_wtoi|_wtoi64":
(normal, 2,
- "Unless checked, the resulting number can exceed the expected range " +
+ "Unless checked, the resulting number can exceed the expected range "
"(CWE-190)",
- "If source untrusted, check both minimum and maximum, even if the" +
- " input had no minus sign (large numbers can roll over into negative" +
+ "If source untrusted, check both minimum and maximum, even if the"
+ " input had no minus sign (large numbers can roll over into negative"
" number; consider saving to an unsigned value if that is intended)",
"integer", "dangers-c", {}),
@@ -1158,13 +1190,13 @@
"Use a more secure technique for acquiring random values",
"random", "", {}),
- "crypt":
+ "crypt|crypt_r":
(normal, 4,
- "Function crypt is a poor one-way hashing algorithm; " +
- "since it only accepts passwords of 8 characters or less, " +
- "and only a two-byte salt, it is excessively vulnerable to " +
+ "The crypt functions use a poor one-way hashing algorithm; "
+ "since they only accept passwords of 8 characters or fewer "
+ "and only a two-byte salt, they are excessively vulnerable to "
"dictionary attacks given today's faster computing equipment (CWE-327)",
- "Use a different algorithm, such as SHA-256, with a larger " +
+ "Use a different algorithm, such as SHA-256, with a larger, "
"non-repeating salt",
"crypto", "", {}),
@@ -1172,7 +1204,7 @@
"EVP_des_ecb|EVP_des_cbc|EVP_des_cfb|EVP_des_ofb|EVP_desx_cbc":
(normal, 4,
"DES only supports a 56-bit keysize, which is too small given today's
computers (CWE-327)",
- "Use a different patent-free encryption algorithm with a larger keysize,
" +
+ "Use a different patent-free encryption algorithm with a larger keysize, "
"such as 3DES or AES",
"crypto", "", {}),
@@ -1180,7 +1212,7 @@
"EVP_rc4_40|EVP_rc2_40_cbc|EVP_rc2_64_cbc":
(normal, 4,
"These keysizes are too small given today's computers (CWE-327)",
- "Use a different patent-free encryption algorithm with a larger keysize,
" +
+ "Use a different patent-free encryption algorithm with a larger keysize, "
"such as 3DES or AES",
"crypto", "", {}),
@@ -1187,31 +1219,30 @@
"chroot":
(normal, 3,
"chroot can be very helpful, but is hard to use correctly (CWE-250,
CWE-22)",
- "Make sure the program immediately chdir(\"/\")," +
- " closes file descriptors," +
- " and drops root privileges, and that all necessary files" +
+ "Make sure the program immediately chdir(\"/\"), closes file descriptors,"
+ " and drops root privileges, and that all necessary files"
" (and no more!) are in the new root",
"misc", "", {}),
"getenv|curl_getenv":
- (normal, 3, "Environment variables are untrustable input if they can be" +
- " set by an attacker. They can have any content and" +
+ (normal, 3, "Environment variables are untrustable input if they can be"
+ " set by an attacker. They can have any content and"
" length, and the same variable can be set more than once (CWE-807,
CWE-20)",
"Check environment variables carefully before using them",
"buffer", "", {'input': 1}),
"g_get_home_dir":
- (normal, 3, "This function is synonymous with 'getenv(\"HOME\")';" +
- "it returns untrustable input if the environment can be" +
- "set by an attacker. It can have any content and length, " +
+ (normal, 3, "This function is synonymous with 'getenv(\"HOME\")';"
+ "it returns untrustable input if the environment can be"
+ "set by an attacker. It can have any content and length, "
"and the same variable can be set more than once (CWE-807, CWE-20)",
"Check environment variables carefully before using them",
"buffer", "", {'input': 1}),
"g_get_tmp_dir":
- (normal, 3, "This function is synonymous with 'getenv(\"TMP\")';" +
- "it returns untrustable input if the environment can be" +
- "set by an attacker. It can have any content and length, " +
+ (normal, 3, "This function is synonymous with 'getenv(\"TMP\")';"
+ "it returns untrustable input if the environment can be"
+ "set by an attacker. It can have any content and length, "
"and the same variable can be set more than once (CWE-807, CWE-20)",
"Check environment variables carefully before using them",
"buffer", "", {'input': 1}),
@@ -1220,8 +1251,8 @@
# These are Windows-unique:
# TODO: Should have lower risk if the program checks return value.
- "RpcImpersonateClient|ImpersonateLoggedOnUser|CoImpersonateClient|" +
-
"ImpersonateNamedPipeClient|ImpersonateDdeClientWindow|ImpersonateSecurityContext|"
+
+ "RpcImpersonateClient|ImpersonateLoggedOnUser|CoImpersonateClient|"
+
"ImpersonateNamedPipeClient|ImpersonateDdeClientWindow|ImpersonateSecurityContext|"
"SetThreadToken":
(normal, 4, "If this call fails, the program could fail to drop heightened
privileges (CWE-250)",
"Make sure the return value is checked, and do not continue if a failure
is reported",
@@ -1244,7 +1275,7 @@
"SetSecurityDescriptorDacl":
(c_hit_if_null, 5,
- "Never create NULL ACLs; an attacker can set it to Everyone (Deny All
Access), " +
+ "Never create NULL ACLs; an attacker can set it to Everyone (Deny All
Access), "
"which would even forbid administrator access (CWE-732)",
"",
"misc", "", {'check_for_null': 3}),
@@ -1281,7 +1312,7 @@
"gsignal|ssignal":
(normal, 2,
- "These functions are considered obsolete on most systems, and very
non-poertable (Linux-based systems handle them radically different, basically
if gsignal/ssignal were the same as raise/signal respectively, while System V
considers them a separate set and obsolete) (CWE-676)",
+ "These functions are considered obsolete on most systems, and very
non-portable (Linux-based systems handle them radically different, basically if
gsignal/ssignal were the same as raise/signal respectively, while System V
considers them a separate set and obsolete) (CWE-676)",
"Switch to raise/signal, or some other signalling approach",
"obsolete", "", {}),
@@ -1309,6 +1340,15 @@
"Make sure input data is filtered, especially if an attacker could
manipulate it",
"input", "", {'input': 1}),
+ # Unsafe STL functions that don't check the second iterator
+ "equal|mismatch|is_permutation":
+ (cpp_unsafe_stl,
+ # Like strlen, this is mostly a risk to availability; at worst it
+ # often causes a program crash.
+ 1,
+ "Function does not check the second iterator for over-read conditions
(CWE-126)",
+ "This function is often discouraged by most C++ coding standards in favor
of its safer alternatives provided since C++14. Consider using a form of this
function that checks the second iterator before potentially overflowing it",
+ "buffer", "", {}),
# TODO: detect C++'s: cin >> charbuf, where charbuf is a char array; the
problem
# is that flawfinder doesn't have type information, and ">>" is safe
with
@@ -1350,7 +1390,7 @@
if c == '(':
return 1
elif c in string.whitespace:
- i = i + 1
+ i += 1
else:
if falsepositive:
return 0 # No following "(", presume invalid.
@@ -1390,7 +1430,7 @@
if hitlist[i].filename == filename and hitlist[i].line == linenumber:
del hitlist[i] # DESTROY - this is a DESTRUCTIVE iterator.
hitfound = 1 # Don't break, because there may be more than one.
- num_ignored_hits = num_ignored_hits + 1
+ num_ignored_hits += 1
if not hitfound:
ignoreline = linenumber + 1 # Nothing found - ignore next line.
@@ -1426,7 +1466,7 @@
linebegin = 1
codeinline = 0 # 1 when we see some code (so increment sloc at newline)
- if (patch_infos is not None) and (not f in patch_infos):
+ if (patch_infos is not None) and (f not in patch_infos):
# This file isn't in the patch list, so don't bother analyzing it.
if not quiet:
if output_format:
@@ -1442,13 +1482,13 @@
# Symlinks should never get here, but just in case...
if (not allowlink) and os.path.islink(f):
print("BUG! Somehow got a symlink in process_c_file!")
- num_links_skipped = num_links_skipped + 1
+ num_links_skipped += 1
return
try:
my_input = open(f, "r")
except BaseException:
print("Error: failed to open", h(f))
- sys.exit(1)
+ sys.exit(14)
# Read ENTIRE file into memory. Use readlines() to convert \n if
necessary.
# This turns out to be very fast in Python, even on large files, and it
@@ -1465,7 +1505,39 @@
print("Examining", f)
sys.stdout.flush()
- text = "".join(my_input.readlines())
+ # Python3 is often configured to use only UTF-8, and presumes
+ # that inputs cannot have encoding errors.
+ # The real world isn't like that, so provide a prettier warning
+ # in such cases - with some hints on how to solve it.
+ try:
+ text = "".join(my_input.readlines())
+ except UnicodeDecodeError as err:
+ print('Error: encoding error in', h(f))
+ print(err)
+ print()
+ print('Python3 requires input character data to be perfectly encoded;')
+ print('it also requires perfectly correct system encoding settings.')
+ print('Unfortunately, your data and/or system settings are not.')
+ print('Here are some options:')
+ print('1. Run: PYTHONUTF8=0 python3 flawfinder')
+ print(' if your system and and data are all properly set up for')
+ print(' a non-UTF-8 encoding.')
+ print('2. Run: PYTHONUTF8=0 LC_ALL=C.ISO-2022 python3 flawfinder')
+ print(' if your data has a specific encoding such as ISO-2022')
+ print(' (replace "ISO-2022" with the name of your encoding,')
+ print(' and optionally replace "C" with your native language).')
+ print('3. Run: PYTHONUTF8=0 LC_ALL=C.ISO-8859-1 python3 flawfinder')
+ print(' if your data has an unknown or inconsistent encoding')
+ print(' (ISO-8859-1 encoders normally allow anything).')
+ print('4. Convert all your source code to the UTF-8 encoding.')
+ print(' The system program "iconv" or Python program "cvt2utf" can')
+ print(' do this (for cvt2tuf, you can use "pip install cvt2utf").')
+ print('5. Run: python2 flawfinder')
+ print(' (That is, use Python 2 instead of Python 3).')
+ print('Some of these options may not work depending on circumstance.')
+ print('In the long term, we recommend using UTF-8 for source code.')
+ print('For more information, see the documentation.')
+ sys.exit(15)
i = 0
while i < len(text):
@@ -1495,15 +1567,15 @@
i = m.end(0)
continue
if c == "\n":
- linenumber = linenumber + 1
- sumlines = sumlines + 1
+ linenumber += 1
+ sumlines += 1
linebegin = 1
if codeinline:
- sloc = sloc + 1
+ sloc += 1
codeinline = 0
- i = i + 1
+ i += 1
continue
- i = i + 1 # From here on, text[i] points to next character.
+ i += 1 # From here on, text[i] points to next character.
if i < len(text):
nextc = text[i]
else:
@@ -1510,11 +1582,11 @@
nextc = ''
if incomment:
if c == '*' and nextc == '/':
- i = i + 1
+ i += 1
incomment = 0
elif instring:
if c == '\\' and (nextc != "\n"):
- i = i + 1
+ i += 1
elif c == '"' and instring == 1:
instring = 0
elif c == "'" and instring == 2:
@@ -1525,7 +1597,7 @@
i + 1) # Is there a directive here?
if m:
process_directive()
- i = i + 1
+ i += 1
incomment = 1
elif c == '/' and nextc == '/': # "//" comments - skip to EOL.
m = p_directive.match(text,
@@ -1533,7 +1605,7 @@
if m:
process_directive()
while i < len(text) and text[i] != "\n":
- i = i + 1
+ i += 1
elif c == '"':
instring = 1
codeinline = 1
@@ -1574,11 +1646,11 @@
elif p_digits.match(c):
while i < len(text) and p_digits.match(
text[i]): # Process a number.
- i = i + 1
+ i += 1
# else some other character, which we ignore.
# End of loop through text. Wrap up.
if codeinline:
- sloc = sloc + 1
+ sloc += 1
if incomment:
error("File ended while in comment.")
if instring:
@@ -1592,12 +1664,12 @@
# Note that this "for" loop modifies the ruleset while it's iterating,
# so we *must* convert the keys into a list before iterating.
for rule in list(ruleset.keys()):
- if "|" in rule: # We found a rule to expand.
+ if "|" in rule: # We found a rule to expand.
for newrule in rule.split("|"):
if newrule in ruleset:
print("Error: Rule %s, when expanded, overlaps %s" % (
rule, newrule))
- sys.exit(1)
+ sys.exit(15)
ruleset[newrule] = ruleset[rule]
del ruleset[rule]
# To print out the set of keys in the expanded ruleset, run:
@@ -1641,7 +1713,7 @@
if output_format:
print(
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" '
- + '"http://www.w3.org/TR/html4/loose.dtd">')
+ '"http://www.w3.org/TR/html4/loose.dtd">')
print("<html>")
print("<head>")
print('<meta http-equiv="Content-type" content="text/html;
charset=utf8">')
@@ -1652,10 +1724,10 @@
print("<body>")
print("<h1>Flawfinder Results</h1>")
print("Here are the security scan results from")
- print('<a href="http://www.dwheeler.com/flawfinder">Flawfinder
version %s</a>,' % version)
- print('(C) 2001-2017 <a href="http://www.dwheeler.com">David A.
Wheeler</a>.')
+ print('<a href="https://dwheeler.com/flawfinder">Flawfinder
version %s</a>,' % version)
+ print('(C) 2001-2019 <a href="https://dwheeler.com">David A.
Wheeler</a>.')
else:
- print("Flawfinder version %s, (C) 2001-2017 David A. Wheeler." %
version)
+ print("Flawfinder version %s, (C) 2001-2019 David A. Wheeler." %
version)
displayed_header = 1
@@ -1689,7 +1761,7 @@
if (not allowlink) and os.path.islink(f):
if not quiet:
print_warning("Skipping symbolic link directory " + h(f))
- num_links_skipped = num_links_skipped + 1
+ num_links_skipped += 1
return
base_filename = os.path.basename(f)
if (skipdotdir and len(base_filename) > 1
@@ -1696,7 +1768,7 @@
and (base_filename[0] == ".")):
if not quiet:
print_warning("Skipping directory with initial dot " + h(f))
- num_dotdirs_skipped = num_dotdirs_skipped + 1
+ num_dotdirs_skipped += 1
return
for dir_entry in os.listdir(f):
maybe_process_file(os.path.join(f, dir_entry), patch_infos)
@@ -1712,7 +1784,7 @@
if (not allowlink) and os.path.islink(f):
if not quiet:
print_warning("Skipping symbolic link file " + h(f))
- num_links_skipped = num_links_skipped + 1
+ num_links_skipped += 1
elif not os.path.isfile(f):
# Skip anything not a normal file. This is so that
# device files, etc. won't cause trouble.
@@ -1742,7 +1814,7 @@
if (not allowlink) and os.path.islink(f):
if not quiet:
print_warning("Skipping symbolic link " + h(f))
- num_links_skipped = num_links_skipped + 1
+ num_links_skipped += 1
elif os.path.isfile(f) or f == "-":
# If on the command line, FORCE processing of it.
# Currently, we only process C/C++.
@@ -1757,9 +1829,27 @@
maybe_process_file(f, patch_infos)
elif not os.path.exists(f):
if not quiet:
- if h(f).startswith("\342\210\222"):
+ # Help humans avoid a long mysterious debugging session.
+ # Sometimes people copy/paste from HTML that has a leading
+ # en dash (\u2013 aka 0xE2 0x80 0x93) or
+ # em dash (\u2014 aka 0xE2 0x80 0x94) instead of the
+ # correct dash marker (in an attempt to make things "pretty").
+ # These symbols *look* like the regular dash
+ # option marker, but they are not the same characters.
+ # If there's no such file, give a special warning,
+ # because otherwise this can be extremely
+ # difficult for humans to notice. We'll do the check in
+ # this odd way so it works on both Python 2 and Python 3.
+ # (Python 3 wants \u...).
+ # Note that we *only* make this report if the file doesn't
+ # exist - if someone asks to process a file with this crazy
+ # name, and it exists, we'll process it without complaint.
+ if (h(f).startswith("\xe2\x80\x93") or
+ h(f).startswith("\xe2\x80\x94") or
+ h(f).startswith(u"\u2013") or
+ h(f).startswith(u"\u2014")):
print_warning(
- "Skipping non-existent filename starting with UTF-8
long dash "
+ "Skipping non-existent filename starting with em dash
or en dash "
+ h(f))
else:
print_warning("Skipping non-existent file " + h(f))
@@ -1843,6 +1933,14 @@
--quiet | -Q
Don't display status information (i.e., which files are being
examined) while the analysis is going on.
+ --error-level=LEVEL
+ Return a nonzero (false) error code if there is at least one
+ hit of LEVEL or higher. If a diffhitlist is provided,
+ hits noted in it are ignored.
+ This option can be useful within a continuous integration script,
+ especially if you mark known-okay lines as "flawfinder: ignore".
+ Usually you want level to be fairly high, such as 4 or 5.
+ By default, flawfinder returns 0 (true) on a successful run.
Hitlist Management:
--savehitlist=F
@@ -1862,10 +1960,11 @@
global show_context, show_inputs, allowlink, skipdotdir, omit_time
global output_format, minimum_level, show_immediately, single_line
global csv_output, csv_writer
+ global error_level
global required_regex, required_regex_compiled
global falsepositive
global show_columns, never_ignore, quiet, showheading, list_rules
- global loadhitlist, savehitlist, diffhitlist
+ global loadhitlist, savehitlist, diffhitlist_filename
global patch_file
try:
# Note - as a side-effect, this sets sys.argv[].
@@ -1874,6 +1973,7 @@
"falsepositive", "falsepositives", "columns", "listrules",
"omittime", "allowlink", "patch=", "followdotdir", "neverignore",
"regex=", "quiet", "dataonly", "html", "singleline", "csv",
+ "error-level=",
"loadhitlist=", "savehitlist=", "diffhitlist=", "version", "help"
])
for (opt, value) in optlist:
@@ -1912,6 +2012,8 @@
quiet = 1
showheading = 0
csv_writer = csv.writer(sys.stdout)
+ elif opt == "--error-level":
+ error_level = int(value)
elif opt == "--immediate" or opt == "-i":
show_immediately = 1
elif opt == "-n" or opt == "--neverignore":
@@ -1940,7 +2042,7 @@
if showheading:
print("Saving hitlist to", value)
elif opt == "--diffhitlist":
- diffhitlist = value
+ diffhitlist_filename = value
display_header()
if showheading:
print("Showing hits not in", value)
@@ -1969,7 +2071,10 @@
except getopt.error as text:
print("*** getopt error:", text)
usage()
- sys.exit(1)
+ sys.exit(16)
+ if output_format == 1 and list_rules == 1:
+ print('You cannot list rules in HTML format')
+ sys.exit(20)
def process_files():
@@ -1990,19 +2095,23 @@
process_file_args(files, patch_infos)
return True
+
def hitlist_sort_key(hit):
"""Sort key for hitlist."""
return (-hit.level, hit.filename, hit.line, hit.column, hit.name)
+
def show_final_results():
global hitlist
+ global error_level_exceeded
count = 0
count_per_level = {}
count_per_level_and_up = {}
- possible_levels = [0, 1, 2, 3, 4, 5] # Eliminate dependency on range
+ # Name levels directly, to avoid Python "range" (a Python 2/3 difference)
+ possible_levels = (0, 1, 2, 3, 4, 5)
for i in possible_levels: # Initialize count_per_level
count_per_level[i] = 0
- for i in possible_levels: # Initialize count_per_level
+ for i in possible_levels: # Initialize count_per_level_and_up
count_per_level_and_up[i] = 0
if show_immediately or not quiet: # Separate the final results.
print()
@@ -2017,28 +2126,23 @@
# <ul> so that the format differentiates each entry.
# I'm not using <ol>, because its numbers might be confused with
# the risk levels or line numbers.
- if diffhitlist:
- diff_file = open(diffhitlist)
+ if diffhitlist_filename:
+ diff_file = open(diffhitlist_filename, 'rb')
diff_hitlist = pickle.load(diff_file)
- if output_format:
- print("<ul>")
- for hit in hitlist:
- if hit not in diff_hitlist:
+ if output_format:
+ print("<ul>")
+ for hit in hitlist:
+ if not diffhitlist_filename or hit not in diff_hitlist:
+ count_per_level[hit.level] = count_per_level[hit.level] + 1
+ if hit.level >= minimum_level:
hit.show()
- count_per_level[hit.level] = count_per_level[hit.level] + 1
- count = count + 1
- if output_format:
- print("</ul>")
+ count += 1
+ if hit.level >= error_level:
+ error_level_exceeded = True
+ if output_format:
+ print("</ul>")
+ if diffhitlist_filename:
diff_file.close()
- else:
- if output_format:
- print("<ul>")
- for hit in hitlist:
- hit.show()
- count_per_level[hit.level] = count_per_level[hit.level] + 1
- if output_format:
- print("</ul>")
- count = len(hitlist)
# Done with list, show the post-hitlist summary.
if showheading:
if output_format:
@@ -2127,11 +2231,11 @@
print("There may be other security vulnerabilities; review your code!")
if output_format:
print("<br>")
- print("See '<a
href=\"http://www.dwheeler.com/secure-programs\">Secure Programming HOWTO</a>'")
- print("(<a
href=\"http://www.dwheeler.com/secure-programs\">http://www.dwheeler.com/secure-programs</a>)
for more information.")
+ print("See '<a
href=\"https://dwheeler.com/secure-programs\">Secure Programming HOWTO</a>'")
+ print("(<a
href=\"https://dwheeler.com/secure-programs\">https://dwheeler.com/secure-programs</a>)
for more information.")
else:
print("See 'Secure Programming HOWTO'")
- print("(http://www.dwheeler.com/secure-programs) for more
information.")
+ print("(https://dwheeler.com/secure-programs) for more
information.")
if output_format:
print("</body>")
print("</html>")
@@ -2154,10 +2258,11 @@
if process_files():
show_final_results()
save_if_desired()
+ return 1 if error_level_exceeded else 0
if __name__ == '__main__':
try:
- flawfind()
+ sys.exit(flawfind())
except KeyboardInterrupt:
print("*** Flawfinder interrupted")
Modified: brlcad/branches/dm-fb-merge/misc/win32-msvc/Dll/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/misc/win32-msvc/Dll/CMakeLists.txt
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/misc/win32-msvc/Dll/CMakeLists.txt
2020-06-05 17:59:25 UTC (rev 76035)
@@ -86,6 +86,7 @@
../../../../rt^3/src/coreInterface/Sphere.cpp
../../../../rt^3/src/coreInterface/Torus.cpp
../../../../rt^3/src/coreInterface/Unknown.cpp
+ ../../../../rt^3/src/coreInterface/VectorList.cpp
../../../../rt^3/src/coreInterface/globals.cpp
)
Index: brlcad/branches/dm-fb-merge/regress
===================================================================
--- brlcad/branches/dm-fb-merge/regress 2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/regress 2020-06-05 17:59:25 UTC (rev 76035)
Property changes on: brlcad/branches/dm-fb-merge/regress
___________________________________________________________________
Modified: svn:mergeinfo
## -8,4 +8,4 ##
/brlcad/branches/osg/regress:62110-62113
/brlcad/branches/prep-cache/regress:68236-68933
/brlcad/branches/tcltk86/regress:68300-75257
-/brlcad/trunk/regress:75512-75597,75630-75987
\ No newline at end of property
+/brlcad/trunk/regress:75512-75597,75630-76034
\ No newline at end of property
Modified: brlcad/branches/dm-fb-merge/regress/burst/regress-burst.cmake.in
===================================================================
--- brlcad/branches/dm-fb-merge/regress/burst/regress-burst.cmake.in
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/regress/burst/regress-burst.cmake.in
2020-06-05 17:59:25 UTC (rev 76035)
@@ -2,6 +2,7 @@
set(CSDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(BURST_CF "@BURST_CLEAN_FILES@")
set(BURST_IF "@BURST_INPUT_FILES@")
+set(BIN_DIR "@BIN_DIR@")
set(DDIR "@DATA_DIR@")
set(LOGFILE "${CBDIR}/regress-burst.log")
@@ -28,9 +29,10 @@
endforeach(BIF ${BURST_IF})
endif (NOT "${CSDIR}" STREQUAL "${CBDIR}")
-# TODO - this breaks if BIN_DIR is not one deep
+# Find the root path from the executable, and from there the database path
get_filename_component(BDIR "${BURST}" DIRECTORY)
-execute_process(COMMAND "@CMAKE_COMMAND@" -E copy
"${BDIR}/../${DDIR}/db/ktank.g" "${CBDIR}/ktank.g")
+string(REGEX REPLACE "${BIN_DIR}$" "" RDIR "${BDIR}")
+execute_process(COMMAND "@CMAKE_COMMAND@" -E copy "${RDIR}/${DDIR}/db/ktank.g"
"${CBDIR}/ktank.g")
file(APPEND "${LOGFILE}" "Running burst on ktank.g:\n${BURST} -b
${CBDIR}/ktank.b\n")
Modified: brlcad/branches/dm-fb-merge/regress/flawfinder.sh
===================================================================
--- brlcad/branches/dm-fb-merge/regress/flawfinder.sh 2020-06-05 17:56:16 UTC
(rev 76034)
+++ brlcad/branches/dm-fb-merge/regress/flawfinder.sh 2020-06-05 17:59:25 UTC
(rev 76035)
@@ -58,7 +58,8 @@
exit 0
fi
-run ${PATH_TO_THIS}/../misc/flawfinder --followdotdir --minlevel=5
--singleline --neverignore --falsepositive --quiet ${PATH_TO_THIS}/../src/[^o]*
+SRCFILES="`find src -type f \( -name \*.c -o -name \*.cpp -o -name \*.cxx -o
-name \*.cc -o -name \*.h -o -name \*.y -o -name \*.l \) -not -regex
'.*src/other.*' -not -regex '.*~' -not -regex '.*\.log' -not -regex
'.*Makefile.*' -not -regex '.*cache.*' -not -regex '.*\.svn.*' -not -regex
'.*src/libbu/realpath_bsd.c.*'`"
+run ${PATH_TO_THIS}/../misc/flawfinder --context --followdotdir --minlevel=5
--singleline --neverignore --falsepositive --quiet ${SRCFILES} | grep -v running
NUMBER_WRONG=0
if test "x`grep \"No hits found.\" $LOGFILE`" = "x" ; then
Modified: brlcad/branches/dm-fb-merge/regress/nurbs/regress-nurbs-test.cmake.in
===================================================================
--- brlcad/branches/dm-fb-merge/regress/nurbs/regress-nurbs-test.cmake.in
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/regress/nurbs/regress-nurbs-test.cmake.in
2020-06-05 17:59:25 UTC (rev 76035)
@@ -1,6 +1,7 @@
# Values set at CMake configure time
set(CBDIR "@CMAKE_CURRENT_BINARY_DIR@")
set(CSDIR "@CMAKE_CURRENT_SOURCE_DIR@")
+set(BIN_DIR "@BIN_DIR@")
set(LOGFILE "${CBDIR}/regress-nurbs_@[email protected]")
file(WRITE "${LOGFILE}" "Starting nurbs test run\n")
@@ -22,10 +23,8 @@
if ("${GFILE_FP}" STREQUAL "@NHIT_GFILE@")
set(NHIT_G "@NHIT_GFILE@")
else ("${GFILE_FP}" STREQUAL "@NHIT_GFILE@")
- # TODO - need a better answer - if BIN_DIR isn't a single directory this
- # won't work. Really should come in via a generator expression, but
- # that needs to be another argument to the cmake command...
- set(NHIT_G "${BDIR}/../@NHIT_GFILE@")
+ string(REGEX REPLACE "${BIN_DIR}$" "" RDIR "${BDIR}")
+ set(NHIT_G "${RDIR}/@NHIT_GFILE@")
endif ("${GFILE_FP}" STREQUAL "@NHIT_GFILE@")
execute_process(
Modified: brlcad/branches/dm-fb-merge/regress/rtwizard/regress-rtwiz.cmake.in
===================================================================
--- brlcad/branches/dm-fb-merge/regress/rtwizard/regress-rtwiz.cmake.in
2020-06-05 17:56:16 UTC (rev 76034)
+++ brlcad/branches/dm-fb-merge/regress/rtwizard/regress-rtwiz.cmake.in
2020-06-05 17:59:25 UTC (rev 76035)
@@ -3,6 +3,7 @@
set(INPUTFILE "@INPUT_FILE@")
set(CTRLIMG "@CONTROL_IMAGE@")
set(TGTIMG "@TARGET_IMAGE@")
+set(BIN_DIR "@BIN_DIR@")
set(LOGFILE "@LOG_FILE@")
file(WRITE "${LOGFILE}" "Starting rtwizard run\n")
@@ -30,8 +31,9 @@
message(FATAL_ERROR "Unable to find pixcmp, aborting.\nSee ${LOGFILE} for
more details.")
endif (NOT EXISTS "${PIXCMP_EXEC}")
-# TODO - this will break if the binary directory is more than one deep
-set(SRCFILE "${BDIR}/../${INPUTFILE}")
+# Reconstruct the tree root from the EXEC path, and identify the input file
location
+string(REGEX_REPLACE "${BIN_DIR}$" "" RDIR "${BDIR}")
+set(SRCFILE "${RDIR}/${INPUTFILE}")
# Clean up in case we've run before
execute_process(COMMAND "@CMAKE_COMMAND@" -E remove -f "${TGTIMG}")
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits