You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Craig Russell <ap...@gmail.com> on 2017/05/10 23:42:42 UTC

Bug in Secmail

This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.

	• $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas

Checked out revision 76572.


$ svn status /tmp/d20170510-4903-qckx05/iclas

A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF


$ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'

svn: E200009: Commit failed (details follow):
svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control


Craig L Russell
Secretary, Apache Software Foundation
clr@apache.org http://db.apache.org/jdo


Re: Bug in Secmail

Posted by Sam Ruby <ru...@intertwingly.net>.
Hint: both Message and Attachement classes have a method by that name.  :-)

- Sam Ruby

On Wed, May 10, 2017 at 8:51 PM, Craig Russell <ap...@gmail.com> wrote:
> Part of my confusion is this:
>
> in iclas.json.rb:
>
> # create/add file(s)
> if @signature.to_s.empty? or not @selected.end_with? '.pdf'
>       message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
> else
>       message.write_svn("#{dir}/iclas", @filename,
> @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
> end
>
> So it looks like the write_svn takes four arguments.
>
> But the function in attachment.rb looks like it expects three arguments:
>
>
>   def write_svn(repos, file, path=nil)
>     filename = File.join(repos, file)
>     filename = File.join(filename, path || safe_name) if Dir.exist? filename
>
>     raise Errno::EEXIST.new(file) if File.exist? filename
>     File.write filename, body, encoding: Encoding::BINARY
>
>     system 'svn', 'add', filename
>     system 'svn', 'propset', 'svn:mime-type', content_type.untaint, filename
>
>     filename
>   end
> end
>
> I'm sure I'm missing some trick about multiple final arguments. But I don't see how write_svn works. :(
>
> Craig
>
>> On May 10, 2017, at 5:06 PM, Craig Russell <ap...@gmail.com> wrote:
>>
>> I suspect that the bug is somewhere in icla.json.rb where the selected file name ends with PDF not pdf.
>>
>>    # create/add file(s)
>>    if @signature.to_s.empty? or not @selected.end_with? '.pdf'
>>      message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
>>    else
>>      message.write_svn("#{dir}/iclas", @filename,
>>        @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
>>    end
>>
>> Is there supposed to be a .downcase somewhere around @selected.end_with?
>>
>> I don't understand the coding of this if/else block.
>>
>> If there is a signature file, create a directory and add two files named icla.pdf and icla.pdf.asc
>> If not, create a file called user-name.pdf
>>
>> I know what the intent is, I just cannot read the code.
>>
>> Craig
>>
>>> On May 10, 2017, at 4:42 PM, Craig Russell <ap...@gmail.com> wrote:
>>>
>>> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
>>>
>>>      • $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
>>>
>>> Checked out revision 76572.
>>>
>>>
>>> $ svn status /tmp/d20170510-4903-qckx05/iclas
>>>
>>> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>>>
>>>
>>> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
>>>
>>> svn: E200009: Commit failed (details follow):
>>> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
>>>
>>>
>>> Craig L Russell
>>> Secretary, Apache Software Foundation
>>> clr@apache.org http://db.apache.org/jdo
>>>
>>
>> Craig L Russell
>> Secretary, Apache Software Foundation
>> clr@apache.org http://db.apache.org/jdo
>>
>
> Craig L Russell
> Secretary, Apache Software Foundation
> clr@apache.org http://db.apache.org/jdo
>

Re: Bug in Secmail

Posted by Craig Russell <ap...@gmail.com>.
Part of my confusion is this:

in iclas.json.rb:

# create/add file(s)
if @signature.to_s.empty? or not @selected.end_with? '.pdf'
      message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
else
      message.write_svn("#{dir}/iclas", @filename, 
@selected => 'icla.pdf', @signature => 'icla.pdf.asc')
end

So it looks like the write_svn takes four arguments.

But the function in attachment.rb looks like it expects three arguments:


  def write_svn(repos, file, path=nil)
    filename = File.join(repos, file)
    filename = File.join(filename, path || safe_name) if Dir.exist? filename

    raise Errno::EEXIST.new(file) if File.exist? filename
    File.write filename, body, encoding: Encoding::BINARY

    system 'svn', 'add', filename
    system 'svn', 'propset', 'svn:mime-type', content_type.untaint, filename

    filename
  end
end

I'm sure I'm missing some trick about multiple final arguments. But I don't see how write_svn works. :(

Craig

> On May 10, 2017, at 5:06 PM, Craig Russell <ap...@gmail.com> wrote:
> 
> I suspect that the bug is somewhere in icla.json.rb where the selected file name ends with PDF not pdf.
> 
>    # create/add file(s)
>    if @signature.to_s.empty? or not @selected.end_with? '.pdf'
>      message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
>    else
>      message.write_svn("#{dir}/iclas", @filename, 
>        @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
>    end
> 
> Is there supposed to be a .downcase somewhere around @selected.end_with?
> 
> I don't understand the coding of this if/else block.
> 
> If there is a signature file, create a directory and add two files named icla.pdf and icla.pdf.asc
> If not, create a file called user-name.pdf
> 
> I know what the intent is, I just cannot read the code.
> 
> Craig
> 
>> On May 10, 2017, at 4:42 PM, Craig Russell <ap...@gmail.com> wrote:
>> 
>> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
>> 
>> 	• $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
>> 
>> Checked out revision 76572.
>> 
>> 
>> $ svn status /tmp/d20170510-4903-qckx05/iclas
>> 
>> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>> 
>> 
>> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
>> 
>> svn: E200009: Commit failed (details follow):
>> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
>> 
>> 
>> Craig L Russell
>> Secretary, Apache Software Foundation
>> clr@apache.org http://db.apache.org/jdo
>> 
> 
> Craig L Russell
> Secretary, Apache Software Foundation
> clr@apache.org http://db.apache.org/jdo
> 

Craig L Russell
Secretary, Apache Software Foundation
clr@apache.org http://db.apache.org/jdo


Re: Bug in Secmail

Posted by Craig Russell <ap...@gmail.com>.
I suspect that the bug is somewhere in icla.json.rb where the selected file name ends with PDF not pdf.

    # create/add file(s)
    if @signature.to_s.empty? or not @selected.end_with? '.pdf'
      message.write_svn("#{dir}/iclas", @filename, @selected, @signature)
    else
      message.write_svn("#{dir}/iclas", @filename, 
        @selected => 'icla.pdf', @signature => 'icla.pdf.asc')
    end

Is there supposed to be a .downcase somewhere around @selected.end_with?

I don't understand the coding of this if/else block.

If there is a signature file, create a directory and add two files named icla.pdf and icla.pdf.asc
If not, create a file called user-name.pdf

 I know what the intent is, I just cannot read the code.

Craig

> On May 10, 2017, at 4:42 PM, Craig Russell <ap...@gmail.com> wrote:
> 
> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
> 
> 	• $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
> 
> Checked out revision 76572.
> 
> 
> $ svn status /tmp/d20170510-4903-qckx05/iclas
> 
> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
> 
> 
> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
> 
> svn: E200009: Commit failed (details follow):
> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
> 
> 
> Craig L Russell
> Secretary, Apache Software Foundation
> clr@apache.org http://db.apache.org/jdo
> 

Craig L Russell
Secretary, Apache Software Foundation
clr@apache.org http://db.apache.org/jdo


Re: Bug in Secmail

Posted by Sam Ruby <ru...@intertwingly.net>.
OK, I believe that there were two bugs here:

https://github.com/apache/whimsy/commit/786413d74a2515f91916225d929705b7b5c08811

Should deploy automatically within 30 minutes.

- Sam Ruby


On Wed, May 10, 2017 at 8:35 PM, Craig Russell <cr...@oracle.com> wrote:
> The expected behavior:
>
> If the attached file ends in .PDF treat it as pdf. The code that displays the file in the view panel does this correctly.
>
> If the attached file ends in .PDF, write out the file as user-name.pdf not user-name.PDF.
>
> The content type analysis should also treat PDF as pdf.
>
> So attachment.rb should write a file with the pdf suffix not PDF.
>
> Craig
>
>> On May 10, 2017, at 4:51 PM, Sam Ruby <ru...@intertwingly.net> wrote:
>>
>> What's the desired behavior?
>>
>> The code that extracts the attachment uses the file name as is:
>>
>> https://github.com/apache/whimsy/blob/master/www/secretary/workbench/models/attachment.rb#L69
>>
>> The code that issues the commands does downcase the extension:
>>
>> https://github.com/apache/whimsy/blob/master/www/secretary/workbench/views/actions/icla.json.rb#L14
>>
>> Which one is right?
>>
>> - Sam Ruby
>>
>> On Wed, May 10, 2017 at 7:42 PM, Craig Russell <ap...@gmail.com> wrote:
>>> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
>>>
>>>        • $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
>>>
>>> Checked out revision 76572.
>>>
>>>
>>> $ svn status /tmp/d20170510-4903-qckx05/iclas
>>>
>>> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>>>
>>>
>>> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
>>>
>>> svn: E200009: Commit failed (details follow):
>>> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
>>>
>>>
>>> Craig L Russell
>>> Secretary, Apache Software Foundation
>>> clr@apache.org http://db.apache.org/jdo
>>>
>
> Craig L Russell
> Architect
> craig.russell@oracle.com
> P.S. A good JDO? O, Gasp!
>
>
>
>
>

Re: Bug in Secmail

Posted by Craig Russell <cr...@oracle.com>.
The expected behavior:

If the attached file ends in .PDF treat it as pdf. The code that displays the file in the view panel does this correctly.

If the attached file ends in .PDF, write out the file as user-name.pdf not user-name.PDF.

The content type analysis should also treat PDF as pdf.

So attachment.rb should write a file with the pdf suffix not PDF.

Craig

> On May 10, 2017, at 4:51 PM, Sam Ruby <ru...@intertwingly.net> wrote:
> 
> What's the desired behavior?
> 
> The code that extracts the attachment uses the file name as is:
> 
> https://github.com/apache/whimsy/blob/master/www/secretary/workbench/models/attachment.rb#L69
> 
> The code that issues the commands does downcase the extension:
> 
> https://github.com/apache/whimsy/blob/master/www/secretary/workbench/views/actions/icla.json.rb#L14
> 
> Which one is right?
> 
> - Sam Ruby
> 
> On Wed, May 10, 2017 at 7:42 PM, Craig Russell <ap...@gmail.com> wrote:
>> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
>> 
>>        • $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
>> 
>> Checked out revision 76572.
>> 
>> 
>> $ svn status /tmp/d20170510-4903-qckx05/iclas
>> 
>> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>> 
>> 
>> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
>> 
>> svn: E200009: Commit failed (details follow):
>> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
>> 
>> 
>> Craig L Russell
>> Secretary, Apache Software Foundation
>> clr@apache.org http://db.apache.org/jdo
>> 

Craig L Russell
Architect
craig.russell@oracle.com
P.S. A good JDO? O, Gasp!






Re: Bug in Secmail

Posted by Sam Ruby <ru...@intertwingly.net>.
What's the desired behavior?

The code that extracts the attachment uses the file name as is:

https://github.com/apache/whimsy/blob/master/www/secretary/workbench/models/attachment.rb#L69

The code that issues the commands does downcase the extension:

https://github.com/apache/whimsy/blob/master/www/secretary/workbench/views/actions/icla.json.rb#L14

Which one is right?

- Sam Ruby

On Wed, May 10, 2017 at 7:42 PM, Craig Russell <ap...@gmail.com> wrote:
> This happens when submitter capitalizes PDF. The file that is created incorrectly ends in .PDF but the svn command ends in pdf.
>
>         • $ svn checkout --depth empty https://svn.apache.org/repos/private/documents/iclas /tmp/d20170510-4903-qckx05/iclas
>
> Checked out revision 76572.
>
>
> $ svn status /tmp/d20170510-4903-qckx05/iclas
>
> A       /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.PDF
>
>
> $ svn commit /tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf -m 'ICLA from Dmitry Pavlov'
>
> svn: E200009: Commit failed (details follow):
> svn: E200009: '/tmp/d20170510-4903-qckx05/iclas/dmitry-pavlov.pdf' is not under version control
>
>
> Craig L Russell
> Secretary, Apache Software Foundation
> clr@apache.org http://db.apache.org/jdo
>