From 59663aac370bf531a8e06d7fd93f696f95eae2bb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 12 Jan 2013 19:02:33 -0500 Subject: [PATCH] Make it safe for multiple users. --- NEWS | 4 ++++ coverity-submit | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index fdddf96..ad5dfe5 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ NEWS file for coverty-submit +1.4 @ + Make it safe for multiple users on the same machine. + Implement a verbosityu option. + 1.3 @ 2012-11-22 Minor documentation updates. diff --git a/coverity-submit b/coverity-submit index bdb3e9f..4ab821a 100755 --- a/coverity-submit +++ b/coverity-submit @@ -4,7 +4,7 @@ # # By Eric S. Raymond, May 2012. BSD terms apply. # -import os, sys, ConfigParser, getopt +import os, sys, ConfigParser, getopt, tempfile version = "1.3" @@ -106,20 +106,25 @@ if __name__ == '__main__': """ % globals() if verbose: sys.stdout.write(readme) + tmpdir = tempfile.mkdtemp() if not noexec: - with open("/tmp/README", "w") as wfp: + with open(os.path.join(tmpdir, "README"), "w") as wfp: wfp.write(readme) tarball = "%s-scan.tgz" % project - do_or_die("mv cov-int /tmp; (cd /tmp; tar -czf %s README cov-int; rm -fr cov-int)" % tarball) + do_or_die("mv cov-int %s; (cd %s; tar -czf %s README cov-int; rm -fr README cov-int)" % (tmpdir, tmpdir, tarball)) print("Posting the analysis request...") do_or_die('''curl \ --form file=@/tmp/%(tarball)s \ --form project=%(project)s \ --form password=%(password)s \ --form email=%(email)s \ - http://scan5.coverity.com/cgi-bin/upload.py - ''' % globals()) - + http://scan5.coverity.com/cgi-bin/upload.py \ + ''' % globals()) + try: + os.remove(os.path.join(tmpdir, tarball)) + os.rmdir(tmpdir) + except OSError: + pass print("Done. You'll get mail at %s." % email) # The following sets edit modes for GNU EMACS -- 2.43.0