Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 312935 Details for
Bug 453613
FEAT: md5sum check should have an override for attaching packages
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
CVS to updated patch + additional UI and code cleanup
md5sum_override.patch (text/plain), 7.73 KB, created by
Rob Landry
on 2008-07-29 21:03:04 UTC
(
hide
)
Description:
CVS to updated patch + additional UI and code cleanup
Filename:
MIME Type:
Creator:
Rob Landry
Created:
2008-07-29 21:03:04 UTC
Size:
7.73 KB
patch
obsolete
>Index: attachment.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/attachment.cgi,v >retrieving revision 1.16 >diff -u -r1.16 attachment.cgi >--- attachment.cgi 21 Jul 2008 06:17:04 -0000 1.16 >+++ attachment.cgi 29 Jul 2008 21:01:16 -0000 >@@ -147,8 +147,8 @@ > validateDescription(); > validateContentType() unless $::FORM{'ispatch'}; > validateObsolete() if $::FORM{'obsolete'}; >- my $override = validateMd5sumOverride() if $::FORM{'md5sumOverride'}; >- insert($data, $override); >+ validateMd5sumOverride() if $::FORM{'md5sumOverride'}; >+ insert($data); > } > elsif ($action eq "edit") > { >@@ -397,6 +397,7 @@ > # has permissions to set it , since the UI uses > # an HTML checkbox to represent this flag, and unchecked HTML checkboxes > # do not get sent in HTML requests. >+ $::FORM{'md5sumoverride'} = $::FORM{'md5sumoverride'} ? 1 : 0; > UserInGroup('hwcert_edit') || > ThrowUserError("md5sum_override_permission_deny"); > } >@@ -951,36 +952,27 @@ > sub insert > { > my ($data) = shift @_; >- my $md5sumOverride = (shift @_) ? 1: 0; >- my $isprivact = $::FORM{'isprivate'} ? 1 : 0; >+ my $isprivate = $::FORM{'isprivate'} ? 1 : 0; > my $md5sum = GenMd5File($filename, $data); >- my @row; >- my $attach_id; >- my $bug_id; >- my $duplicate_package_comment; >- >- SendSQL2("SELECT filename FROM cert_rpms WHERE md5sum = " . SqlQuote($md5sum)); >- >- if($md5sumOverride){ >- my $attach_bugs_query = "SELECT attach_id, bug_id >- FROM cert_records JOIN cert_rpms >- ON cert_records.id = cert_rpms.cert_id >- WHERE md5sum = ". >- SqlQuote($md5sum); >- my $dbh_hwcert = Bugzilla->dbh2; >- my $sth_hwcert = $dbh_hwcert->prepare($attach_bugs_query); >- $duplicate_package_comment .= "DUPLICATE ATTACHMENTS Existing : \n\n"; >- $sth_hwcert->execute(); >- while ( @row = $sth_hwcert->fetchrow_array()){ # one row one time >- $attach_id = shift @row; >- $bug_id = shift @row; >- $duplicate_package_comment .= "attachment $attach_id in bug $bug_id \n"; >- } >- $duplicate_package_comment .= "\nmatch md5sum $md5sum \n"; >- FetchOneColumn2(); >- } elsif(!$md5sumOverride){ >- FetchOneColumn2() && ThrowUserError("duplicate_attachment"); >- } >+ my $md5sumoverride = $::FORM{'md5sumoverride'} ? 1 : 0; >+ my $duplicatepackagecomment = ""; >+ >+ SendSQL2("SELECT cert_rpms.attach_id, cert_records.bug_id FROM cert_records, cert_rpms " . >+ "WHERE cert_records.id = cert_rpms.cert_id AND cert_rpms.md5sum = ". SqlQuote($md5sum)); >+ >+ while (my @row = FetchSQLData2()){ >+ if($md5sumoverride){ >+ my $attach_id = shift @row; >+ my $bug_id = shift @row; >+ # Bail anyway if it's already attached to this certification >+ if($bug_id == $::FORM{'bugid'}){ >+ ThrowUserError("duplicate_attachment"); >+ } >+ $duplicatepackagecomment .= "\nAlready attached as attachment $attach_id in bug $bug_id"; >+ }else{ >+ ThrowUserError("duplicate_attachment"); >+ } >+ } > > # Escape characters in strings that will be used in SQL statements. > my $sqlfilename = SqlQuote($filename); >@@ -999,7 +991,7 @@ > > # Insert the attachment into the database. > my $query="INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id) >- VALUES ($::FORM{'bugid'}, now(), $sqlfilename, $description, $contenttype, $::FORM{'ispatch'}, $isprivate, $::userid)"; >+ VALUES ($::FORM{'bugid'}, now(), $sqlfilename, $description, $contenttype, $::FORM{'ispatch'}, $isprivate, $::userid)"; > > $logger->debug("sql query before execution: [ $query ]"); > SendSQL($query); >@@ -1017,6 +1009,7 @@ > > # Insert a comment about the new attachment into the database. > my $comment = "\nCreated an attachment (id=$attachid) $filename\n"; >+ $comment .= ("$duplicatepackagecomment\n"); > $comment .= ("\n" . $::FORM{'comment'} . "\n") if $::FORM{'comment'}; > > my $attachasresult= $::FORM{'attachasresult'}; >@@ -1031,7 +1024,6 @@ > $Text::Wrap::columns = 80; > $Text::Wrap::huge = 'overflow'; > $comment = Text::Wrap::wrap('', '', $comment); >- $comment .= "\n\n\n" . $duplicate_package_comment if ($md5sumOverride); > > AppendComment($::FORM{'bugid'}, > $::COOKIE{"Bugzilla_login"}, >Index: template/en/default/bug/upload_packages.html.tmpl >=================================================================== >RCS file: /cvs/qa/hwcert/template/en/default/bug/upload_packages.html.tmpl,v >retrieving revision 1.4 >diff -u -r1.4 upload_packages.html.tmpl >--- template/en/default/bug/upload_packages.html.tmpl 16 Jul 2008 10:21:52 -0000 1.4 >+++ template/en/default/bug/upload_packages.html.tmpl 29 Jul 2008 21:01:16 -0000 >@@ -3,13 +3,11 @@ > function verify_filename() { > var filename= document.getElementById("data").value; > var rpm_pattern = /.+\.rpm$/; >- var rhr2_pattern = /rhr2/; >+ var rhr2_pattern = /rhr/; > var hts_pattern = /hts/; > if (rpm_pattern.test(filename)) { > if (rhr2_pattern.test(filename)) { > document.getElementById("attachasresult").checked=false; >- document.getElementById("attachasresult_warning").innerHTML= >- "Filename matches /rhr/ : rhr2 has been deprecated."; > document.getElementById("attachasresult_warning").style.display = "block"; > } else if (hts_pattern.test(filename)) { > document.getElementById("attachasresult").checked=true; >@@ -22,9 +20,6 @@ > document.getElementById("attachasresult").checked=false; > document.getElementById("attachasresult_warning").style.display = "none"; > } >- document.getElementById("attachasresult_prompt").innerHTML= >- "<b><font color='gray'>System-set</b></font>"; >- document.getElementById("attachasresult_prompt").style.display = "inline"; > } > </script> > >@@ -42,7 +37,16 @@ > <input type="hidden" name="action" value="insert"> > <input type="hidden" name="contenttypemethod" value="autodetect"> > <em>Enter the path to the results package or spec file on your computer.</em><br/> >- <input type="file" name="data" id="data" size="50" onchange="verify_filename()" > >+ <input type="file" name="data" id="data" size="50" onchange="verify_filename();" > >+ <div id="attachasresult_warning" style="display:none;" class="clearBox"> >+ <p> >+ <div class="clearBoxInner"> >+ <div class="clearBoxBody"> >+ <b class="redNote">Warning : Filename matches /rhr/</b><br> >+ Red Hat Ready (rhr2) has been deprecated, "Attach as result" has been removed. >+ </div> >+ </div> >+ </div> > </td> > </tr> > <tr> >@@ -60,12 +64,13 @@ > </td> > </tr> > <tr> >- <th>Attach as result:</th> >+ <th>Options:</th> > <td> >- <input type="checkbox" name="attachasresult" id="attachasresult" value="true" checked onclick="document.getElementById('attachasresult_prompt').innerHTML='<b><font color=\'blue\'>User-set</b></font>';document.getElementById('attachasresult_prompt').style.display = 'inline';"> >- <div id = "attachasresult_prompt" style = "display:inline"><b><font color='gray'>System-set</b></font></div> >- <div id = "attachasresult_warning" style = "display:none"></div> >- <input type="checkbox" name="md5sumOverride" value="false"> Override md5sum check >+ <input type="checkbox" name="attachasresult" id="attachasresult" value="true" checked>Attach as result >+ [% IF UserInGroup('hwcert_edit') %] >+ <br> >+ <input type="checkbox" name="md5sumoverride" value="false">Override md5sum check >+ [% END %] > </td> > </tr> > </table>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 453613
:
311105
|
311359
|
311524
|
311916
|
312278
|
312754
| 312935