diff options
author | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-01-31 15:21:32 +0000 |
---|---|---|
committer | iliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-01-31 15:21:32 +0000 |
commit | ed77d429487e776f0268fdab77599dacc9b651a0 (patch) | |
tree | f4ed68096abb2e395d7e83361e96402cde3a948b /TAO | |
parent | fd1e25731b5b09d6553632db5377a5f8d61a5540 (diff) | |
download | ATCD-ed77d429487e776f0268fdab77599dacc9b651a0.tar.gz |
Merged revisions 80513,80520-80521,80523,80525,80527,80529 via svnmerge from
https://svn.dre.vanderbilt.edu/DOC/Middleware/trunk/TAO
........
r80513 | parsons | 2008-01-29 17:02:24 -0600 (Tue, 29 Jan 2008) | 1 line
ChangeLogTag: Tue Jan 29 22:55:23 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
........
r80520 | cleeland | 2008-01-30 12:35:42 -0600 (Wed, 30 Jan 2008) | 1 line
ChangeLogTag: Wed Jan 30 18:34:02 UTC 2008 Chris Cleeland <cleeland@ociweb.com>
........
r80521 | parsons | 2008-01-30 14:18:05 -0600 (Wed, 30 Jan 2008) | 1 line
ChangeLogTag: Wed Jan 30 20:13:18 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
........
r80523 | parsons | 2008-01-30 15:34:28 -0600 (Wed, 30 Jan 2008) | 1 line
ChangeLogTag: Wed Jan 30 20:13:18 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
........
r80525 | parsons | 2008-01-30 17:18:43 -0600 (Wed, 30 Jan 2008) | 1 line
ChangeLogTag: Wed Jan 30 23:17:50 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
........
r80527 | parsons | 2008-01-30 17:19:50 -0600 (Wed, 30 Jan 2008) | 1 line
ChangeLogTag: Wed Jan 30 23:17:50 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
........
r80529 | sma | 2008-01-31 06:16:32 -0600 (Thu, 31 Jan 2008) | 1 line
ChangeLogTag: Thu Jan 31 12:05:00 UTC 2008 Simon Massey <sma@prismtech.com>
........
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 95 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_produce.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_args.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 72 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_init.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_interface_header.cpp | 20 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.ll | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/lex.yy.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/fe_extern.h | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/tao_idl.cpp | 60 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_err.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_global.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_scope.cpp | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_string.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/IFR_Service/be_produce.cpp | 65 | ||||
-rw-r--r-- | TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Security/Crash_Test/client.cpp | 30 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/Security/Crash_Test/run_test.pl | 137 |
18 files changed, 330 insertions, 195 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 80be71fae3f..9b4cd3ead18 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,98 @@ +Thu Jan 31 12:05:00 UTC 2008 Simon Massey <sma@prismtech.com> + + * orbsvcs/tests/Security/Crash_Test/client.cpp + * orbsvcs/tests/Security/Crash_Test/run_test.pl + + Make this test more robust to timing problems. + (NOTE this does not correct the server's BAD_PARAM problem of + previous build.) + +Wed Jan 30 23:17:50 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/include/fe_extern.h: + * TAO_IDL/be/be_produce.cpp: + * TAO_IDL/fe/fe_init.cpp: + * TAO_IDL/fe/fe_interface_header.cpp: + * TAO_IDL/fe/lex.yy.cpp: + * TAO_IDL/fe/idl.ll: + * TAO_IDL/driver/drv_preproc.cpp: + * TAO_IDL/driver/drv_args.cpp: + * TAO_IDL/tao_idl.cpp: + * TAO_IDL/util/utl_err.cpp: + * TAO_IDL/util/utl_global.cpp: + * TAO_IDL/util/utl_string.cpp: + * TAO_IDL/util/utl_scope.cpp: + * orbsvcs/IFR_Service/be_produce.cpp: + * orbsvcs/IFR_Service/ifr_adding_visitor.cpp: + + - Changed the name of exception FE_Bailout to + Bailout. The original name implied that the + exception could be used only in the front + end of the IDL compiler, which was not the + intention. Thanks to Chris Cleeland + <cleeland at ociweb dot com> for the + suggestion. + + - Removed increments of global internal error + count before throwing Bailout, since the + increment is now done in the catch block. + +Wed Jan 30 21:30:49 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/tao_idl.cpp: + + Added local temporary variable in main() to hold the error + count so it can be returned after the IDL_GlobalData class + that contains it is destroyed as part of cleanup. + +Wed Jan 30 20:13:18 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/tao_idl.cpp: + * TAO_IDL/util/utl_global.cpp: + + Cleaned up and made more consistent the way in which the + global internal error count is updated, in conjunction + with the use of the FE_Bailout exception. Thanks to Chris + Cleeland <cleeland at ociweb dot com> for helpful input + on this issue. + +Wed Jan 30 18:34:02 UTC 2008 Chris Cleeland <cleeland@ociweb.com> + + * TAO_IDL/tao_idl.cpp (main): + + Bump up the value of "status" when FE_Bailout is caught. This + insures that tao_ifr (and tao_idl) exit with a non-zero error + condition whenever FE_Bailout is thrown. The correct fix is to + go through and find all the places where FE_bailout is thrown + without incrementing the error count and fix those, but this + will suffice for now. The downside to this change is that the + exit status is supposed to indicate the number of errors + encountered, and this change could make it be higher than actual + errors. I tend to think that this is a better alternative to + what we had before, which is that the exit status could indicate + a LOWER number of errors...namely, zero. + +Tue Jan 29 22:55:23 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> + + * orbsvcs/IFR_Service/be_produce.cpp(BE_ifr_repo_init): + + Added catch block for CORBA::ORB::InvalidName exception, which + is what will be thrown if no -ORBInitRef option is passed to + the IFR loader and multicast fails. In this catch block, the + error count is incremented (which affects the return value of + main()) and the FE_Bailout exception is thrown so proper + cleanup will happen. + + * orbsvcs/IFR_Service/ifr_adding_visitor.cpp(element_type): + + One of two things happens in this method - either the element + type is visited or its repo id is looked up. If either action + fails, we now increment the global error count and throw + FE_Bailout, to get proper cleanup and exit value. + + Thanks to Chris Cleeland <cleeland at ociweb dot com> for + reporting these bugs. + Fri Jan 25 18:45:53 UTC 2008 Jonathan Pollack <pollack_j@ociweb.com> * NEWS: diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index 1dd77deda1a..2ae24299e3c 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -93,7 +93,7 @@ BE_abort (void) "Fatal Error - Aborting\n")); // BE_cleanup will be called after the exception is caught. - throw FE_Bailout (); + throw Bailout (); } void diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index fd584c8d756..150fbbd3f9a 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -572,8 +572,7 @@ DRV_parse_args (long ac, char **av) ACE_TEXT ("temporary directory "), tmpdir)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } } diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 748fb1af461..245934f1d45 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -133,8 +133,7 @@ DRV_cpp_putarg (const char *str) DRV_MAX_ARGCOUNT, "arguments to preprocessor")); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } DRV_arglist[DRV_argcount++] = ACE::strnew (str); @@ -553,8 +552,7 @@ DRV_cpp_post_init (void) ACE_ERROR ((LM_ERROR, "DRV_cpp_post_init: ACE_OS::getcwd failed\n")); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // If first arg is non-zero, adds an include path and filename @@ -566,8 +564,7 @@ DRV_cpp_post_init (void) "DRV_cpp_post_init: DRV_sweep_dirs (%s) failed\n", idl_global->recursion_start ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // This is redundant for most backends, but not if the call to @@ -578,8 +575,7 @@ DRV_cpp_post_init (void) "DRV_cpp_post_init: ACE_OS::chdir (%s) failed\n", cwd_path)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } } @@ -667,8 +663,7 @@ DRV_check_for_include (const char* buf) ACE_TEXT ("TAO_IDL: No input files\n"))); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // Find the closing " or < character. @@ -814,8 +809,7 @@ DRV_convert_includes (const char* buf) ACE_TEXT ("TAO_IDL: No input files\n"))); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // Find the closing '"' character. @@ -856,8 +850,7 @@ DRV_get_orb_idl_includes (void) "TAO_IDL: cannot open or find file: %s\n", orb_idl_path.c_str ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } } else @@ -893,8 +886,7 @@ DRV_copy_input (FILE *fin, idl_global->prog_name (), fn)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } if (fin == 0) @@ -904,8 +896,7 @@ DRV_copy_input (FILE *fin, idl_global->prog_name (), ": cannot open input file\n")); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } #if !defined (ACE_WIN32) @@ -1010,8 +1001,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } ACE_OS::strcpy (tmp_file, tmpdir); @@ -1031,8 +1021,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } char tmp_cpp_file [MAXPATHLEN + 1] = { 0 }; @@ -1107,8 +1096,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // Remove any existing output file. @@ -1141,8 +1129,7 @@ DRV_pre_proc (const char *myfile) t_file)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } cpp_options.set_handles (ACE_INVALID_HANDLE, fd); @@ -1156,8 +1143,7 @@ DRV_pre_proc (const char *myfile) DRV_arglist[0])); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } if (fd != ACE_INVALID_HANDLE) @@ -1171,8 +1157,7 @@ DRV_pre_proc (const char *myfile) t_file)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } } @@ -1189,8 +1174,7 @@ DRV_pre_proc (const char *myfile) "%s: wait for child process failed\n", idl_global->prog_name ())); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } if (WIFEXITED ((status))) @@ -1205,8 +1189,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), DRV_arglist[0])); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } } else @@ -1220,8 +1203,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), DRV_arglist[0])); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // TODO: Manage problems in the pre-processor, in the previous // version the current process would exit if the pre-processor @@ -1240,8 +1222,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), t_file)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } FE_set_yyin (yyin); @@ -1259,8 +1240,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), t_file)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } // ACE_DEBUG sends to stderr - we want stdout for this dump @@ -1295,8 +1275,7 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), t_ifile)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } if (ACE_OS::unlink (t_file) == -1) @@ -1306,13 +1285,6 @@ DRV_pre_proc (const char *myfile) idl_global->prog_name (), t_file)); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); - } - - if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC) - { - // Go straight to cleanup, exit normally. - throw FE_Bailout (); + throw Bailout (); } } diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index 23caa1efd4b..d68fc6a99d8 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -656,7 +656,7 @@ FE_populate (void) ACE_TEXT ("IDL: idl_global->gen() not initialized, exiting\n") )); - throw FE_Bailout (); + throw Bailout (); } // Create a global root for the AST. Note that the AST root has no name. @@ -672,7 +672,7 @@ FE_populate (void) ACE_TEXT ("IDL: FE init failed to create AST root, exiting\n") )); - throw FE_Bailout (); + throw Bailout (); } // Push it on the stack diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp index c3232879c02..2b91253902b 100644 --- a/TAO/TAO_IDL/fe/fe_interface_header.cpp +++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp @@ -371,7 +371,7 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces, // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Look it up. @@ -418,7 +418,7 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces, // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Not an appropriate interface? @@ -675,7 +675,7 @@ FE_OBVHeader::compile_supports (UTL_NameList *supports) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Look it up. @@ -703,7 +703,7 @@ FE_OBVHeader::compile_supports (UTL_NameList *supports) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Remove typedefs, if any. @@ -886,7 +886,7 @@ FE_ComponentHeader::compile_inheritance (UTL_ScopedName *base_component) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } if (d->node_type () == AST_Decl::NT_typedef) @@ -942,7 +942,7 @@ FE_ComponentHeader::compile_supports (UTL_NameList *supports) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Look it up. @@ -970,7 +970,7 @@ FE_ComponentHeader::compile_supports (UTL_NameList *supports) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } // Not an appropriate interface? @@ -1100,7 +1100,7 @@ FE_HomeHeader::compile_inheritance (UTL_ScopedName *base_home) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } if (d->node_type () == AST_Decl::NT_typedef) @@ -1135,7 +1135,7 @@ FE_HomeHeader::compile_managed_component (UTL_ScopedName *managed_component) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } if (d->node_type () == AST_Decl::NT_typedef) @@ -1170,7 +1170,7 @@ FE_HomeHeader::compile_primary_key (UTL_ScopedName *primary_key) // This is probably the result of bad IDL. // We will crash if we continue from here. - throw FE_Bailout (); + throw Bailout (); } AST_Decl::NodeType nt = d->node_type (); diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index 54dd7a13fb8..3e751e33945 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -436,8 +436,7 @@ idl_parse_line_and_file (char *buf) ACE_ERROR ((LM_ERROR, ACE_TEXT ("IDL: No input files\n"))); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } else { diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index cf56abd50c3..dc9c3a36ac8 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -2649,8 +2649,7 @@ idl_parse_line_and_file (char *buf) ACE_ERROR ((LM_ERROR, ACE_TEXT ("IDL: No input files\n"))); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + throw Bailout (); } else { diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h index f630c943774..79252d3e693 100644 --- a/TAO/TAO_IDL/include/fe_extern.h +++ b/TAO/TAO_IDL/include/fe_extern.h @@ -99,7 +99,7 @@ FE_new_UTL_Indenter (void); // Also used when command line options limit the output to // usage, version or preprocessed files. Catch block is just // before front end cleanup and exit. -class TAO_IDL_FE_Export FE_Bailout +class TAO_IDL_FE_Export Bailout { }; diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp index 052cb98d41c..8106ce99f70 100644 --- a/TAO/TAO_IDL/tao_idl.cpp +++ b/TAO/TAO_IDL/tao_idl.cpp @@ -112,7 +112,8 @@ DRV_init (int &argc, char *argv[]) // Initialize front end. FE_init (); - // Initialize driver private data + // Initialize driver private data. DRV_nfiles will be updated + // by DRV_parse_args(). DRV_nfiles = 0; DRV_file_index = 0; @@ -204,6 +205,13 @@ DRV_drive (const char *s) DRV_pre_proc (s); + if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC) + { + // Go straight to cleanup, process the next file, if any. + DRV_refresh (); + return; + } + // Parse. if (idl_global->compile_flags () & IDL_CF_INFORMATIVE) { @@ -219,7 +227,8 @@ DRV_drive (const char *s) (void) FE_yyparse (); // Filename set by FE_yyparse(), so we output it immediately after. - ACE_DEBUG ((LM_DEBUG, "processing %s\n", + ACE_DEBUG ((LM_DEBUG, + "processing %s\n", idl_global->filename ()->get_string ())); // We must do this as late as possible to make sure any @@ -243,7 +252,7 @@ DRV_drive (const char *s) : ACE_TEXT (""))))); // Backend will be cleaned up after the exception is caught. - throw FE_Bailout (); + throw Bailout (); } // Dump the code. @@ -285,7 +294,7 @@ DRV_drive (const char *s) } else { - throw FE_Bailout (); + throw Bailout (); } DRV_refresh (); @@ -296,41 +305,36 @@ DRV_drive (const char *s) ** ** 1. Initialize compiler driver ** 2. Parse command line args -** 3. If more than one file to parse, fork -** 4. Otherwise, for the single file, invoke DRV_drive +** 3. Invoke DRV_drive iteratively on each file passed in */ int main (int argc, char *argv[]) { - // Return status. - int status = 0; - try { - // Initialize driver and global variables. - status = DRV_init (argc, argv); - - if (0 != status) + if (0 != DRV_init (argc, argv)) { - throw FE_Bailout (); + throw Bailout (); } // Parse arguments. DRV_parse_args (argc, argv); - // If a version message is requested, print it and exit. + // If a version message is requested, print it and exit cleanly. if (idl_global->compile_flags () & IDL_CF_VERSION) { DRV_version (); - throw FE_Bailout (); + DRV_cleanup (); + return 0; } - // If a usage message is requested, give it and exit. + // If a usage message is requested, print it and exit cleanly. if (idl_global->compile_flags () & IDL_CF_ONLY_USAGE) { DRV_usage (); - throw FE_Bailout (); + DRV_cleanup (); + return 0; } // If there are no input files, and we are not using the @@ -340,8 +344,7 @@ main (int argc, char *argv[]) ACE_ERROR ((LM_ERROR, ACE_TEXT ("IDL: No input files\n"))); - ++status; - throw FE_Bailout (); + throw Bailout (); } AST_Generator *gen = be_global->generator_init (); @@ -354,8 +357,7 @@ main (int argc, char *argv[]) ACE_TEXT ("generator, exiting\n") )); - ++status; - throw FE_Bailout (); + throw Bailout (); } else { @@ -375,15 +377,17 @@ main (int argc, char *argv[]) DRV_drive (DRV_files[DRV_file_index]); } } - catch (FE_Bailout) + catch (Bailout) { + // Incrementing here may be redundant, but the error count + // is the exit value, and we want to make sure it isn't 0 + // if there was in fact an error. If a non-zero value is + // off by 1, it's not so important. + idl_global->set_err_count (idl_global->err_count () + 1); } - // Case 1: init error, status = 1, nothing added here. - // Case 2: other error(s), status = 0, error count added here. - status += idl_global->err_count (); - + int retval = idl_global->err_count (); DRV_cleanup (); - return status; + return retval; } diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp index 15e4d85ea4c..59f6065e563 100644 --- a/TAO/TAO_IDL/util/utl_err.cpp +++ b/TAO/TAO_IDL/util/utl_err.cpp @@ -635,7 +635,7 @@ UTL_Error::syntax_error (IDL_GlobalData::ParseState ps) // Better to bail here than to increment the error count and // try to avoid further bogus error messages and crashes // that may arise. - throw FE_Bailout (); + throw Bailout (); } void diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 102653122d8..4f671f70fc9 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -75,6 +75,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "utl_indenter.h" #include "utl_err.h" #include "utl_string.h" +#include "fe_extern.h" #include "nr_extern.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" @@ -1716,11 +1717,12 @@ IDL_GlobalData::check_primary_keys (void) while (!this->primary_keys_.is_empty ()) { // Dequeue the element at the head of the queue. - if (this->primary_keys_.dequeue_head (holder)) + if (this->primary_keys_.dequeue_head (holder) != 0) { - ACE_ERROR((LM_ERROR, - "(%N:%l) idl_global::check_primary_keys - " - "dequeue_head failed\n")); + ACE_ERROR ((LM_ERROR, + "(%N:%l) idl_global::check_primary_keys - " + "dequeue_head failed\n")); + throw Bailout (); } if (!holder->legal_for_primary_key ()) diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 2a7f212ce9e..4373cea7356 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -2185,7 +2185,7 @@ UTL_Scope::add_to_scope (AST_Decl *e, ref_string); // if we try to continue from here, we risk a crash. - throw FE_Bailout (); + throw Bailout (); } // If the spellings differ only by case, it's also an error, // unless one, but not both of the identifiers were escaped. @@ -2199,7 +2199,7 @@ UTL_Scope::add_to_scope (AST_Decl *e, // if we try to continue from here, we risk a crash. - throw FE_Bailout (); + throw Bailout (); } else { @@ -2229,7 +2229,7 @@ UTL_Scope::add_to_scope (AST_Decl *e, ); // if we try to continue from here, we risk a crash. - throw FE_Bailout (); + throw Bailout (); } else if (decl_name->case_compare_quiet (parent_name) == true) { @@ -2241,7 +2241,7 @@ UTL_Scope::add_to_scope (AST_Decl *e, ); // if we try to continue from here, we risk a crash. - throw FE_Bailout (); + throw Bailout (); } else { diff --git a/TAO/TAO_IDL/util/utl_string.cpp b/TAO/TAO_IDL/util/utl_string.cpp index e718114dbe6..e413fc8a18b 100644 --- a/TAO/TAO_IDL/util/utl_string.cpp +++ b/TAO/TAO_IDL/util/utl_string.cpp @@ -188,8 +188,8 @@ UTL_String::compare (UTL_String *s) idl_global->err ()->name_case_error (this->p_str, s->get_string ()); - // If we try to continue from here, we risk a crash. - throw FE_Bailout (); + // If we try to continue from here, we risk a crash. + throw Bailout (); } else { diff --git a/TAO/orbsvcs/IFR_Service/be_produce.cpp b/TAO/orbsvcs/IFR_Service/be_produce.cpp index d9a779052d3..b2b5595cfe5 100644 --- a/TAO/orbsvcs/IFR_Service/be_produce.cpp +++ b/TAO/orbsvcs/IFR_Service/be_produce.cpp @@ -95,7 +95,7 @@ BE_abort (void) ACE_TEXT ("Fatal Error - Aborting\n"))); // BE_cleanup will be called after the exception is caught. - throw FE_Bailout (); + throw Bailout (); } void @@ -128,33 +128,42 @@ BE_create_holding_scope (void) int BE_ifr_repo_init (void) { - CORBA::Object_var object = - be_global->orb ()->resolve_initial_references ("InterfaceRepository"); - - if (CORBA::is_nil (object.in ())) - { - ACE_ERROR_RETURN (( - LM_ERROR, - ACE_TEXT ("Null objref from resolve_initial_references\n") - ), - -1 - ); - } - - CORBA::Repository_var repo = - CORBA::Repository::_narrow (object.in ()); - - if (CORBA::is_nil (repo.in ())) - { - ACE_ERROR_RETURN (( - LM_ERROR, - ACE_TEXT ("CORBA::Repository::_narrow failed\n") - ), - -1 - ); - } - - be_global->repository (repo._retn ()); + try + { + CORBA::Object_var object = + be_global->orb ()->resolve_initial_references ("InterfaceRepository"); + + if (CORBA::is_nil (object.in ())) + { + ACE_ERROR_RETURN (( + LM_ERROR, + ACE_TEXT ("Null objref from resolve_initial_references\n") + ), + -1 + ); + } + + CORBA::Repository_var repo = + CORBA::Repository::_narrow (object.in ()); + + if (CORBA::is_nil (repo.in ())) + { + ACE_ERROR_RETURN (( + LM_ERROR, + ACE_TEXT ("CORBA::Repository::_narrow failed\n") + ), + -1 + ); + } + + be_global->repository (repo._retn ()); + } + catch (CORBA::ORB::InvalidName &) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("resolution of Interface Repository failed\n"))); + throw Bailout (); + } return 0; } diff --git a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp index 8b7eb1418dd..d92e5cc681d 100644 --- a/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp +++ b/TAO/orbsvcs/IFR_Service/ifr_adding_visitor.cpp @@ -33,6 +33,7 @@ #include "utl_identifier.h" #include "utl_string.h" #include "utl_exceptlist.h" +#include "fe_extern.h" #include "nr_extern.h" #include "ifr_adding_visitor.h" @@ -2548,6 +2549,8 @@ ifr_adding_visitor::element_type (AST_Type *base_type, bool owned) ACE_TEXT ("(%N:%l) ifr_adding_visitor::element_type -") ACE_TEXT (" failed to accept visitor\n") )); + + throw Bailout (); } } else @@ -2562,6 +2565,8 @@ ifr_adding_visitor::element_type (AST_Type *base_type, bool owned) ACE_TEXT ("(%N:%l) ifr_adding_visitor::element_type -") ACE_TEXT (" lookup_id failed\n") )); + + throw Bailout (); } this->ir_current_ = CORBA::IDLType::_narrow (contained.in ()); diff --git a/TAO/orbsvcs/tests/Security/Crash_Test/client.cpp b/TAO/orbsvcs/tests/Security/Crash_Test/client.cpp index 63089aa0cbf..840a7f574a4 100644 --- a/TAO/orbsvcs/tests/Security/Crash_Test/client.cpp +++ b/TAO/orbsvcs/tests/Security/Crash_Test/client.cpp @@ -105,21 +105,45 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) wait_time)); ACE_OS::sleep (wait_time); } + catch (const CORBA::TRANSIENT&) + { + // If this happens second time then we are done. + if (i != 0) + throw; + + // Waiting for server to come back + ACE_DEBUG ((LM_DEBUG, + "CLIENT (%P): Caught CORBA::TRANSIENT. " + "Assuming server crashed and will come up soon.\n" + "CLIENT (%P): Waiting for %d seconds...\n", + wait_time)); + ACE_OS::sleep (wait_time); + } } if (call_shutdown) { // Let other clients to finish their task if any - ACE_OS::sleep (3); + ACE_OS::sleep (wait_time); ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Calling shutdown...\n")); - server->shutdown (); + try + { + server->shutdown (); + } + catch (const CORBA::COMM_FAILURE&) + { + // Ignored + } + catch (const CORBA::TRANSIENT&) + { + // Ignored + } } - orb->destroy (); ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/orbsvcs/tests/Security/Crash_Test/run_test.pl b/TAO/orbsvcs/tests/Security/Crash_Test/run_test.pl index 2524c1e179c..5e7087a5faa 100755 --- a/TAO/orbsvcs/tests/Security/Crash_Test/run_test.pl +++ b/TAO/orbsvcs/tests/Security/Crash_Test/run_test.pl @@ -27,10 +27,10 @@ $client_args = "-ORBSvcConf $client_conf -w $client_wait_time -k file://$iorfile #$ENV{'SSL_CERT_FILE'} = 'cacert.pem'; $SV = new PerlACE::Process ("server", - "-o $iorfile " . - "-ORBSvcConf $server_conf " . - "-ORBdotteddecimaladdresses 1 " . - "-ORBEndpoint iiop://:/ssl_port=1235"); + "-o $iorfile " . + "-ORBSvcConf $server_conf " . + "-ORBdotteddecimaladdresses 1 " . + "-ORBEndpoint iiop://:/ssl_port=1235"); $CL1 = new PerlACE::Process ("client", "-s $client_args"); $CL2 = new PerlACE::Process ("client", "$client_args"); @@ -43,74 +43,101 @@ local $elapsed = time() - $start_time; while($status == 0 && $elapsed < $max_running_time) { - # Start the server - $SV->Spawn (); - - if (PerlACE::waitforfile_timed ($iorfile, $server_startup_wait_time) == -1) + # Start the server + $server = $SV->Spawn (); + if (0 != $server) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; + print STDERR "ERROR: server returned $server\n"; + exit 1; + } + if (PerlACE::waitforfile_timed ($iorfile, $server_startup_wait_time) == -1) + { + print STDERR "ERROR: cannot find file <$iorfile>\n"; + $SV->Kill (); + exit 1; } - # Start all clients in parallel - $CL1->Spawn (); - $CL2->Spawn (); - $CL3->Spawn (); - - # Let our clients to execute few requests - sleep (3); - - # Now kill the server and start it again. - $SV->Kill (); - $SV->TimedWait (5); - - unlink $iorfile; - - $SV->Spawn (); - - if (PerlACE::waitforfile_timed ($iorfile, $server_startup_wait_time) == -1) + # Start all clients in parallel + $client1 = $CL1->Spawn (); + if (0 != $client1) + { + print STDERR "ERROR: client #1 returned $client1\n"; + $SV->Kill (); + exit 1; + } + $client2 = $CL2->Spawn (); + if (0 != $client2) + { + print STDERR "ERROR: client #2 returned $client2\n"; + $CL1->Kill (); + $SV->Kill (); + exit 1; + } + $client3 = $CL3->Spawn (); + if (0 != $client3) { - print STDERR "ERROR: cannot find file <$iorfile>\n"; - $SV->Kill (); $SV->TimedWait (1); - exit 1; + print STDERR "ERROR: client #3 returned $client3\n"; + $CL2->Kill (); + $CL1->Kill (); + $SV->Kill (); + exit 1; } - # Wait for the server and clients to finish + # Let our clients to execute few requests + sleep (3); - # Waiting for the first client longer because it waits for others and shutdowns the server. - $client1 = $CL1->WaitKill ($client_wait_time * 2); - $client2 = $CL2->WaitKill ($client_wait_time * 2); - $client3 = $CL3->WaitKill ($client_wait_time * 2); - $server = $SV->WaitKill (5); # should be down already + # Now kill the server and start it again. + $SV->Kill (); + sleep (5); + unlink $iorfile; + $server = $SV->Spawn (); + if (0 != $server) + { + print STDERR "ERROR: Restarting server returned $server\n"; + $CL3->Kill (); + $CL2->Kill (); + $CL1->Kill (); + exit 1; + } + if (PerlACE::waitforfile_timed ($iorfile, $server_startup_wait_time) == -1) + { + print STDERR "ERROR: Restarting cannot find file <$iorfile>\n"; + $CL3->Kill (); + $CL2->Kill (); + $CL1->Kill (); + $SV->Kill (); + exit 1; + } - unlink $iorfile; + # Wait for the server and clients to finish - if ($client1) + # Waiting for the first client longer because it waits for others and shutdowns the server. + $client1 = $CL1->WaitKill ($client_wait_time * 3); + if (0 != $client1) { - print STDERR "ERROR: client #1 returned $client1\n"; - $status = 1; + print STDERR "ERROR: Stopping client #1 returned $client1\n"; + $status = 1; } - - if ($client2) + $client2 = $CL2->WaitKill ($client_wait_time * 2); + if (0 != $client2) { - print STDERR "ERROR: client #2 returned $client2\n"; - $status = 1; + print STDERR "ERROR: Stopping client #2 returned $client2\n"; + $status = 1; } - - if ($client3) + $client3 = $CL3->WaitKill ($client_wait_time * 2); + if (0 != $client3) { - print STDERR "ERROR: client #3 returned $client3\n"; - $status = 1; + print STDERR "ERROR: Stopping client #3 returned $client3\n"; + $status = 1; } - - if ($server) + $server = $SV->WaitKill (5); # should be down already + if (0 != $server) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; + print STDERR "ERROR: Stopping server returned $server\n"; + $status = 1; } - - $elapsed = time() - $start_time; + unlink $iorfile; + $elapsed = time() - $start_time; } exit $status; |