~ubuntu-core-dev/ubuntu/groovy/apport/ubuntu

« back to all changes in this revision

Viewing changes to data/whoopsie-upload-all

  • Committer: Brian Murray
  • Date: 2020-10-01 22:41:23 UTC
  • Revision ID: brian@canonical.com-20201001224123-one3kxjut8ym205s
data/whoopsie-upload-all: Handle the case where the .crash file is newer
than the .uploaded file by removing the .uploaded and .upload files
thereby causing the crash to get submitted. (LP: #1891657)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        uploaded_st = os.stat(uploaded_stamp)
48
48
        if uploaded_st.st_mtime > report_st.st_mtime:
49
49
            os.unlink(report)
50
 
        return None
51
 
 
52
 
    if os.path.exists(upload_stamp) and os.path.exists(uploaded_stamp):
53
 
        return None
 
50
            return None
 
51
        # if the crash file is new delete the uploaded file
 
52
        elif uploaded_st.st_mtime < report_st.st_mtime:
 
53
            os.unlink(uploaded_stamp)
 
54
            if os.path.exists(upload_stamp):
 
55
                upload_st = os.stat(upload_stamp)
 
56
                # also delete the upload file
 
57
                if upload_st.st_mtime < report_st.st_mtime:
 
58
                    os.unlink(upload_stamp)
54
59
 
55
60
    if os.path.exists(upload_stamp):
56
61
        print('%s already marked for upload, skipping' % report)