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

 
 

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

Submitter:  None
Submitted:  Mon 04 Mar 2013 07:45:45 PM UTC
   
 
Category:  xfer plugin Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  flashcode Originator Email:  -email is unavailable-
Open/Closed:  Closed IRC nick:  talisein
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group administrator
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>
Group 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>
Group 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 Files:
   
   
Comment:
   

Attached Files
file #27569:  0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch added by talisein (21KiB - 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
  • -email is unavailable- added by flashcode (Posted a comment)
  • -email is unavailable- added by talisein (Posted a comment)
  • -email is unavailable- added by pbos (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-02-09 flashcode Open/ClosedOpen Closed
    2014-01-06 flashcode StatusNone Done
        Assigned toNone flashcode
    2013-03-05 talisein Attached File- Added 0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch, #27569
    2013-03-04 None Attached File- Added 0001-xfer-add-new-config-option-file.xfer.auto_crc32.patch, #27566

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code