[Simple-cdd-devel] Bug#861198: Shutting down public FTP services

Vagrant Cascadian vagrant at debian.org
Mon May 15 19:49:04 UTC 2017


On 2017-05-15, Enrico Zini wrote:
> On Mon, May 15, 2017 at 10:18:22AM -0700, Vagrant Cascadian wrote:
>
>>     File "/home/vagrant/simple-cdd/simple_cdd/utils.py", line 207, in verify_file
>>       raise Fail("Invalid checksum for {}: expected {}, got {}", absname, hashsum, hasher.hexdigest())
>>   simple_cdd.exceptions.Fail: <unprintable Fail object>
>>   
>>   During handling of the above exception, another exception occurred:
>>   
>>   Traceback (most recent call last):
>>     File "/home/vagrant/simple-cdd/simple_cdd/log.py", line 85, in emit
>>       record.message = record.getMessage()
>>     File "/usr/lib/python3.5/logging/__init__.py", line 331, in getMessage
>>       msg = msg % self.args
>>   TypeError: not all arguments converted during string formatting
>
> Fail used %-formatting internally, but it was sometimes called with
> printf-style format strings and sometimes with string.format style
> format strings. I'm attaching a patch that unifies everything to
> string.format-style strings.

With that patch applied, still getting similar tracebacks when the
checksum doesn't match:

  --- Logging error ---
  Traceback (most recent call last):
    File "./build-simple-cdd", line 658, in <module>
      scdd.build_mirror()
    File "./build-simple-cdd", line 270, in build_mirror
      self.run_tool("mirror", tool)
    File "./build-simple-cdd", line 367, in run_tool
      tool.run()
    File "/home/vagrant/simple-cdd/simple_cdd/tools/mirror_wget.py", line 95, in run
      _download(x["url"], x["absname"], checksums=extrafile_sums, relname=x["relname"])
    File "/home/vagrant/simple-cdd/simple_cdd/tools/mirror_wget.py", line 59, in _download
      checksums.verify_file(output, relname)
    File "/home/vagrant/simple-cdd/simple_cdd/utils.py", line 207, in verify_file
      raise Fail("Invalid checksum for {}: expected {}, got {}", absname, hashsum, hasher.hexdigest())
  simple_cdd.exceptions.Fail: <unprintable Fail object>
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/usr/lib/python3.5/logging/__init__.py", line 981, in emit
      msg = self.format(record)
    File "/usr/lib/python3.5/logging/__init__.py", line 831, in format
      return fmt.format(record)
    File "/usr/lib/python3.5/logging/__init__.py", line 568, in format
      record.message = record.getMessage()
    File "/usr/lib/python3.5/logging/__init__.py", line 331, in getMessage
      msg = msg % self.args
  TypeError: not all arguments converted during string formatting
  Call stack:
    File "./build-simple-cdd", line 674, in <module>
      log.error(*e.args)
  Message: 'Invalid checksum for {}: expected {}, got {}'
  Arguments: ('/home/vagrant/simple-cdd/tmp/mirror/doc/constitution.txt', '34b19d4f013dcc45630156a0bf794ed385a0ab995e5c99553cc94a6956be7804', '8b08096e9e4a33d13eb83261649bc5ec153ba24618ef4b578b5ad7f6aea0c7bf')


It seems the upstream python portion of the code works better with
%-formatting, as this seems to fix/workaround the issue:


diff --git a/simple_cdd/utils.py b/simple_cdd/utils.py
index 9cceba2..05104ac 100644
--- a/simple_cdd/utils.py
+++ b/simple_cdd/utils.py
@@ -204,7 +204,7 @@ class Checksums:
 
             # Verify
             if hasher.hexdigest() != hashsum:
-                raise Fail("Invalid checksum for {}: expected {}, got {}", absname, hashsum, hasher.hexdigest())
+                raise Fail("Invalid checksum for %s: expected %s, got %s", absname, hashsum, hasher.hexdigest())
 
     def parse_release_file(self, pathname):
         """


Does this suggest that the inverse of your patch, converting everything
to %-formatting consistantly should work?


live well,
  vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/simple-cdd-devel/attachments/20170515/45cb67eb/attachment.sig>


More information about the Simple-cdd-devel mailing list