diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | main.cxx | 25 | ||||
-rw-r--r-- | testsuite/ChangeLog | 4 | ||||
-rwxr-xr-x | testsuite/parseko/twentythree.stp | 3 |
4 files changed, 35 insertions, 4 deletions
@@ -1,4 +1,9 @@ -2006-11-17 Frank Ch. Eigler <fche@redhat.com> +2006-11-19 Frank Ch. Eigler <fche@elastic.org> + + * main.cxx (main): Signal parse error if a tapset script + is given as the user script. + +2006-11-15 Frank Ch. Eigler <fche@redhat.com> * tapsets.cxx (d_v_e_c_v::visit_target_symbol): Restore lost exception-saving functionality that improves error messages @@ -31,6 +31,7 @@ extern "C" { #include <sys/utsname.h> #include <sys/times.h> #include <sys/time.h> +#include <sys/stat.h> #include <time.h> #include <elfutils/libdwfl.h> } @@ -439,12 +440,17 @@ main (int argc, char * const argv []) gettimeofday (&tv_before, NULL); // PASS 1a: PARSING USER SCRIPT - // XXX: pass args vector, so parser (or lexer?) can substitute - // $1..$NN with actual arguments + + struct stat user_file_stat; + int user_file_stat_rc = -1; + if (script_file == "-") s.user_file = parser::parse (s, cin, s.guru_mode); else if (script_file != "") - s.user_file = parser::parse (s, script_file, s.guru_mode); + { + s.user_file = parser::parse (s, script_file, s.guru_mode); + user_file_stat_rc = stat (script_file.c_str(), & user_file_stat); + } else { istringstream ii (cmdline_script); @@ -501,11 +507,24 @@ main (int argc, char * const argv []) for (unsigned j=0; j<globbuf.gl_pathc; j++) { // privilege only for /usr/share/systemtap? + stapfile* f = parser::parse (s, globbuf.gl_pathv[j], true); if (f == 0) rc ++; else s.library_files.push_back (f); + + struct stat tapset_file_stat; + int stat_rc = stat (globbuf.gl_pathv[j], & tapset_file_stat); + if (stat_rc == 0 && user_file_stat_rc == 0 && + user_file_stat.st_dev == tapset_file_stat.st_dev && + user_file_stat.st_ino == tapset_file_stat.st_ino) + { + clog << "parse error: tapset file '" << globbuf.gl_pathv[j] + << "' is already processed as the user script." << endl; + rc ++; + } + } globfree (& globbuf); diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 550297e8..ea0d9ba7 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-11-19 Frank Ch. Eigler <fche@elastic.org> + + * parseko/twentythree.stp: New test for running tapset file. + 2006-11-17 Frank Ch. Eigler <fche@redhat.com> * semko/thirtysix.stp, transko/three.stp: New tests. diff --git a/testsuite/parseko/twentythree.stp b/testsuite/parseko/twentythree.stp new file mode 100755 index 00000000..ee941d61 --- /dev/null +++ b/testsuite/parseko/twentythree.stp @@ -0,0 +1,3 @@ +#! /bin/sh + +./stap -p1 $SYSTEMTAP_TAPSET/indent.stp |