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 311524 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]
A new patch under rob's instruction
bug453613.patch (text/plain), 7.73 KB, created by
eric_liu
on 2008-07-10 23:34:47 UTC
(
hide
)
Description:
A new patch under rob's instruction
Filename:
MIME Type:
Creator:
eric_liu
Created:
2008-07-10 23:34:47 UTC
Size:
7.73 KB
patch
obsolete
>Index: hwcert/attachment.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/attachment.cgi,v >retrieving revision 1.13 >diff -u -r1.13 attachment.cgi >--- hwcert/attachment.cgi 19 Jun 2008 14:16:48 -0000 1.13 >+++ hwcert/attachment.cgi 10 Jul 2008 23:07:47 -0000 >@@ -147,7 +147,8 @@ > validateDescription(); > validateContentType() unless $::FORM{'ispatch'}; > validateObsolete() if $::FORM{'obsolete'}; >- insert($data); >+ my $override = validateMd5sumOverride() if $::FORM{'md5sumOverride'}; >+ insert($data, $override); > } > elsif ($action eq "edit") > { >@@ -390,6 +391,16 @@ > $::FORM{'isprivate'} = $::FORM{'isprivate'} ? 1 : 0; > } > >+sub validateMd5sumOverride >+{ >+ # Verify that the $md5sumOverride is legal either way and that the user >+ # 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. >+ UserInGroup('hwcert_edit') || >+ ThrowUserError("md5sum_override_permission_deny"); >+} >+ > sub validateData > { > my $maxsize = $::FORM{'ispatch'} ? Param('maxpatchsize') : Param('maxattachmentsize'); >@@ -916,15 +927,37 @@ > > sub insert > { >- my ($data) = @_; >- >- # Insert a new attachment into the database. >- >- # move duplicate checking here, it's already added to the db if we wait until processResultsRPM >- # this should be reworked and is perhaps the starting point for merging the post.cgi code >+ my ($data) = shift @_; >+ my $md5sumOverride = (shift @_) ? 1: 0; >+ my $isprivact = $::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)); >- FetchOneColumn2() && ThrowUserError("duplicate_attachment"); >+ >+ 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"); >+ } > > # Escape characters in strings that will be used in SQL statements. > my $sqlfilename = SqlQuote($filename); >@@ -954,7 +987,7 @@ > my $attachid = FetchOneColumn(); > > # Insert a comment about the new attachment into the database. >- my $comment = "Created an attachment (id=$attachid) $filename\n"; >+ my $comment = "\nCreated an attachment (id=$attachid) $filename\n"; > $comment .= ("\n" . $::FORM{'comment'} . "\n") if $::FORM{'comment'}; > > my $attachasresult= $::FORM{'attachasresult'}; >@@ -962,13 +995,14 @@ > # Support hwcert results package parsing when mimetype is right and checkbox "attachasresult" is checked. > if ( $contenttype =~ /redhat-package-manager|x-rpm|octet-stream|x-pn-realaudio/ && $attachasresult eq "true") > { >- $comment.= processResultsRpm($::FORM{'bugid'}, $filename, $attachid, $attachasresult, $data ); >+ $comment.= processResultsRpm($::FORM{'bugid'}, $filename, $md5sum, $attachid, $attachasresult, $data ); > } > > use Text::Wrap; > $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: hwcert/hwcert.pl >=================================================================== >RCS file: /cvs/qa/hwcert/hwcert.pl,v >retrieving revision 1.53 >diff -u -r1.53 hwcert.pl >--- hwcert/hwcert.pl 19 Jun 2008 14:18:57 -0000 1.53 >+++ hwcert/hwcert.pl 10 Jul 2008 23:07:47 -0000 >@@ -1005,13 +1005,11 @@ > { > my $bug_id = shift @_; > my $filename = shift @_; >+ my $md5sum = shift@_; > my $attachid = shift @_; > my $attachasresult =shift @_; > my ($data) = @_; > >- # Process a results rpm inserting test results into the cert database >- my $md5sum = GenMd5File($filename, $data); >- > # Create a local package > my $rpmlocation = CreateRpm($md5sum, $filename, $data); > # Judge the file which attached by IE if it's not a rpm. >@@ -1044,10 +1042,6 @@ > return; > } > >- # Verify we haven't already seen this package >- SendSQL2("SELECT filename FROM cert_rpms WHERE md5sum = " . SqlQuote($md5sum)); >- FetchOneColumn2() && ThrowUserError("duplicate_attachment"); >- > # Explode into scratch directory so we can get the system.conf and hardware.py information > my $scratchlocation = CreateScratch($md5sum, $rpmlocation); > >Index: hwcert/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.3 >diff -u -r1.3 upload_packages.html.tmpl >--- hwcert/template/en/default/bug/upload_packages.html.tmpl 19 Jun 2008 14:20:58 -0000 1.3 >+++ hwcert/template/en/default/bug/upload_packages.html.tmpl 10 Jul 2008 23:07:48 -0000 >@@ -27,6 +27,7 @@ > document.getElementById("attachasresult_prompt").style.display = "inline"; > } > </script> >+ > <hr/> > > <h3>Upload Results Package or Specification Document</h3> >@@ -50,20 +51,21 @@ > <em>Describe the attachment briefly.</em><br> > <input type="text" name="description" size="60" maxlength="200"> > </td> >- <tr> >+ </tr> > <tr> > <th>Comment:</th> > <td> > <em>(optional) Add a comment about this attachment to the [% terms.bug %].</em><br> > <textarea wrap="soft" name="comment" rows="6" cols="80"></textarea> > </td> >- </tr> >+ </tr> > <tr> > <th>Attach as result:</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 > </td> > </tr> > </table> >Index: hwcert/template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvs/qa/hwcert/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.14 >diff -u -r1.14 user-error.html.tmpl >--- hwcert/template/en/default/global/user-error.html.tmpl 19 Jun 2008 14:21:59 -0000 1.14 >+++ hwcert/template/en/default/global/user-error.html.tmpl 10 Jul 2008 23:07:48 -0000 >@@ -884,6 +884,10 @@ > [% title = "Illegal Make" %] > Make has been defined as UnknownMake; please configure field:Make before continuing. > >+ [% ELSIF error == "md5sum_override_permission_deny"%] >+ [% title = "Md5sum Override Permission Deny" %] >+ Md5sum Override Permission Deny; Only the hwcert_edit group members can override the package. >+ > [% ELSE %] > [% title = "Error string not found" %] > The user error string <code>[% error FILTER html %]</code> was not found.
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