Snort mailing list archives

Re: Snort 3: Add --disable-txt-docs option to configure_cmake.sh patches


From: Michael Altizer via Snort-devel <snort-devel () lists snort org>
Date: Tue, 20 Mar 2018 10:45:45 -0400

Ok, thanks.  I've attached a patch that should remove the bashisms from all but one of the scripts (which won't execute normally) if you would like to try it.  We'll also pull in your patch since it seems like a useful option to have even if the scripts are working.

On 03/19/2018 11:22 AM, Y M via Snort-devel wrote:

Hi Michael,


Tested with #!/bin/sh on CentOS and FreeBSD. On CentOS it went okay. On FreeBSD, the make output is shown below. Doing an install afterwards did not create the $prefix/doc directory.


[98%] Built target snort
Scanning dependencies of target all_built_sources
[ 98%] Documents: building config.txt with
[ 98%] Documents: building counts.txt with
[ 98%] Documents: building modules.txt with
[ 98%] Documents: building plugins.txt with
[ 98%] Documents: building signals.txt with
../../doc/scripts/generate_help.sh: [[: not found
[ 99%] Documents: building builtin.txt with
../../doc/scripts/generate_help.sh: [[: not found
[ 99%] Documents: building help.txt with
[ 99%] Documents: building options.txt with
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_list.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
[ 99%] Documents: building gids.txt with
[ 99%] Documents: building codec.txt with
[ 99%] Documents: building connector.txt with
../../doc/scripts/generate_list.sh: [[: not found
[ 99%] Documents: building basic.txt with
../../doc/scripts/generate_module.sh: [[: not found
../../doc/scripts/generate_module.sh: [[: not found
[ 99%] Documents: building data.txt with
[ 99%] Documents: building ips_action.txt with
[100%] Documents: building inspector.txt with
[100%] Documents: building ips_option.txt with
../../doc/scripts/generate_module.sh: [[: not found
../../doc/scripts/generate_module.sh: [[: not found
../../doc/scripts/generate_module.sh: [[: not found
../../doc/scripts/generate_module.sh: [[: not found
../../doc/scripts/generate_module.sh: [[: not found
[100%] Documents: building logger.txt with
../../doc/scripts/generate_module.sh: [[: not found
[100%] Documents: building version.txt
[100%] Documents: building commands.txt with
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
../../doc/scripts/generate_help.sh: [[: not found
[100%] Documents: building snort2lua_cmds.txt
[100%] Built target all_built_sources
Scanning dependencies of target snort_manuals
[100%] Built target snort_manuals

------------------------------------------------------------------------
*From:* Snort-devel <snort-devel-bounces () lists snort org> on behalf of Michael Altizer via Snort-devel <snort-devel () lists snort org>
*Sent:* Monday, March 19, 2018 5:49:50 PM
*To:* snort-devel () lists snort org
*Subject:* Re: [Snort-devel] Snort 3: Add --disable-txt-docs option to configure_cmake.sh patches
On 03/16/2018 10:32 AM, Y M via Snort-devel wrote:

Hi,


The attached patch files will add a new option --disable-txt-docs to the configure_cmake.sh script, and wrap the generation of Snort $prefix/doc/* in doc/CMakeList.txt with logic to check if the new option is set. If the option is used, the text files and the $prefix/doc directory will not be generated. This is possible thanks to the existing logic to handle MAKE_TEXT_DOC.


This change stems from the fact that the scripts: doc/scripts/generate_help.sh, doc/scripts/generate_list.sh, and doc/scripts/generate_module.sh use bash "#!/usr/bin/env bash" for the shell. On a pristine FreeBSD image or in cases bash is not installed, the make script will fail with the below error with no obvious way on how to proceed with compiling Snort 3. This occurs in Snort builds 243 and 244.


Scanningdependencies of target codecs
[ 97%] Building CXX object src/codecs/CMakeFiles/codecs.dir/codec_api.cc.o
[ 98%] Linking CXX static library libcodecs.a
[ 98%] Built target codecs
Scanning dependencies of target snort
[ 98%] Building CXX object src/CMakeFiles/snort.dir/main.cc.o
[ 98%] Linking CXX executable snort
[ 98%] Built target snort
Scanning dependencies of target all_built_sources
[ 98%] Documents: building counts.txt with
[ 98%] Documents: building modules.txt with
[ 98%] Documents: building plugins.txt with
[ 98%] Documents: building signals.txt with
[ 98%] Documents: building builtin.txt with
[ 98%] Documents: building options.txt with
[ 98%] Documents: building config.txt with
env: bash: No such file or directory
--- doc/counts.txt ---
*** [doc/counts.txt] Error code 127

...


With the changes applied, Snort builds successfully. I am not sure if this is the best way to handle it, but it avoids missing with the shell scripts portability among the different shells.


Thanks.

YM



Thanks for the patch, but since you seem to have a bash-less FreeBSD system handy, could you try just changing them all to use #!/bin/sh and see if there were any actual bash-isms?  If not, we'll just swap the interpreter.


_______________________________________________
Snort-devel mailing list
Snort-devel () lists snort org
https://lists.snort.org/mailman/listinfo/snort-devel

Please visit http://blog.snort.org for the latest news about Snort!


Attachment: build-Remove-bashisms-from-most-shell-scripts.patch
Description:

_______________________________________________
Snort-devel mailing list
Snort-devel () lists snort org
https://lists.snort.org/mailman/listinfo/snort-devel

Please visit http://blog.snort.org for the latest news about Snort!

Current thread: