patchWeeChat - Patches: patch #7963, Automatically hash files if CRC32...

 
 

patch #7963: Automatically hash files if CRC32 tag is in filename

Submitted by:  None
Submitted on:  Mon 04 Mar 2013 07:45:45 PM UTC  
 
Category: xfer pluginPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Sebastien Helleu <flashcode>Originator Email: -unavailable-
Open/Closed: ClosedIRC nick: talisein

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 06 Jan 2014 10:30:39 AM UTC, comment #4:

Committed.

I removed the regex and implemented that as a (short) C function.

Sebastien Helleu <flashcode>
Project AdministratorIn charge of this item.
Tue 05 Mar 2013 09:20:44 AM UTC, comment #3:

Ah, I didn't know _ wasn't considered word boundary. You don't need the {1} though:

([^0-9A-Z]|^)([0-9A-F]{8})([^0-9A-Z]|$)

"foobar_0BADF00D_".match(/([^0-9A-Z]|^)([0-9A-F]{8})([^0-9A-Z]|$)/)[2] => "0BADF00D"

Though I'm not sure if we need to special-case ^ and $, but it should be cheap either way. If someone sends a file which is named their CRC32 only, it would still work. So there may be a single user who has that.

Peter Boström <pbos>
Project Member
Mon 04 Mar 2013 10:59:08 PM UTC, comment #2:

\b won't work if the checksum is surrounded with _, which I have a distant memory of seeing before. How about [^0-9A-Z]{1}[0-9A-F]{8}([^0-9A-Z]{1}|$) ?

Except for the kerberos CRC32 variant, CRC32 is the only 32-bit checksum in libgcrypt, if that counts for popularity. Maybe I should change the string to "CRC32 OK" and "CRC32 Mismatch"? Then when a mismatch against the wrong checksum happens the user can make a more informed decision about what to do. Since this patch just reports the mismatch and doesn't delete anything, it wouldn't hurt to wait for a feature request before worrying about other checksums.

Andrew Potter <talisein>
Mon 04 Mar 2013 09:46:18 PM UTC, comment #1:

I think the regex should be \b[0-9A-F]{8}\b

Also, a sanity check: Are there any other 32-bit checksums commonly used/placed in filenames? Are we fairly certain these are always CRC32s?

Peter Boström <pbos>
Project Member
Mon 04 Mar 2013 07:45:45 PM UTC, original submission:

xfer: add new config option file.xfer.auto_crc32

If a filename has a CRC32 tag in it, the file is checksumed while
being downloaded. The result of the checksum match is displayed in
the xfer buffer.

Also adds a little paranoia around the write() to disk in xfer-dcc.c

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #27569:  0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch added by talisein (21kB - text/x-patch - Refines regex, reports 'CRC32 OK/mismatch' instead 'hash ok', and NULLs xfer_crc32_preg on regcomp failure.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by flashcode (Posted a comment)
  • -unavailable- added by talisein (Posted a comment)
  • -unavailable- added by pbos (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 09 Feb 2014 09:54:03 AM UTCflashcodeOpen/ClosedOpen=>Closed
    Mon 06 Jan 2014 10:30:39 AM UTCflashcodeStatusNone=>Done
      Assigned toNone=>flashcode
    Tue 05 Mar 2013 04:38:09 PM UTCtaliseinAttached File-=>Added 0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch, #27569
    Mon 04 Mar 2013 07:45:45 PM UTCNoneAttached File-=>Added 0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch, #27566

    Back to the top


    Powered by Savane 3.1-cleanup