[Darshan-commits] [Git][darshan/darshan][master] 2 commits: validate input file format in dxt_analyzer

Philip Carns xgitlab at cels.anl.gov
Thu Mar 11 16:51:14 CST 2021



Philip Carns pushed to branch master at darshan / darshan


Commits:
e4d608dd by Phil Carns at 2021-03-11T17:46:48-05:00
validate input file format in dxt_analyzer

- - - - -
286dda22 by Philip Carns at 2021-03-11T16:51:12-06:00
Merge branch 'carns/issue-286-dxt-analyzer-error' into 'master'

validate input file format in dxt_analyzer

Closes #286

See merge request darshan/darshan!84
- - - - -


1 changed file:

- darshan-util/dxt_analyzer.py


Changes:

=====================================
darshan-util/dxt_analyzer.py
=====================================
@@ -80,6 +80,7 @@ import matplotlib
 import matplotlib.pyplot as plt
 import re
 import argparse
+import sys
 
 #------------------------------------------------------------------------------
 # Regular expression and helper funtion definitions
@@ -258,6 +259,14 @@ if (args.singlefile_mode):
     
 
 with open(dxt_logname) as infile:
+    try:
+        line = infile.readline()
+        if "# darshan" not in line:
+            raise Exception('Invalid file format')
+    except:
+        print("Error: unable to parse " + dxt_logname + ".", file=sys.stderr)
+        print("   Please make sure that it was generated by the darshan-dxt-parser utility.", file=sys.stderr)
+        sys.exit(1)
     finfo_dict = {}
     curr_fname = ''
     logdata = []



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/4f87238eb0e3899a203b5390784376819a05d47f...286dda223cf9a90ad127fa2141e3d2f0c087faf1

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/4f87238eb0e3899a203b5390784376819a05d47f...286dda223cf9a90ad127fa2141e3d2f0c087faf1
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20210311/d80fba12/attachment-0001.html>


More information about the Darshan-commits mailing list