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

Vagrant Cascadian vagrant at debian.org
Mon May 15 17:18:22 UTC 2017


On 2017-05-15, Enrico Zini wrote:
> On Mon, May 15, 2017 at 09:46:08AM -0700, Vagrant Cascadian wrote:
>> > I noticed that verify_file in simple_cdd/utils.py already throws Fail if
>> > something is wrong. I would get rid of the try/except block altogether,
>> > and just call verify_file.
>> I think with these I was getting an ugly traceback when the file failed
>> to verify, so wanted to actually give the user something more freindly
>> than a traceback... will try your patch again, tweak the file between
>> download and verify, and see if it still spits out the tracebacks.
>
> If what is thrown is Fail, that shouldn't happen: build-simple-cdd has
> this that catches it and only logs the error message instead of the
> traceback:
>
>     except Fail as e:
>         #import traceback
>         #traceback.print_stack()
>         log.error(*e.args)
>         scdd.paranoid_checks()
>         result = 1
>         isoname = None
>
> If it spits out a traceback instead, send it to me and I'll see if
> there's somewhere where some other exception should be turned into Fail.


With your patch applied to git master, and the following patch to make
sure it fails:

diff --git a/simple_cdd/tools/mirror_wget.py b/simple_cdd/tools/mirror_wget.py
index dc914cf..73bece9 100644
--- a/simple_cdd/tools/mirror_wget.py
+++ b/simple_cdd/tools/mirror_wget.py
@@ -54,6 +54,8 @@ class ToolMirrorWget(Tool):
                 log.debug("downloading: %s", output)
                 request.urlretrieve(url, filename=output)
                 if checksums:
+                    with open(output, 'w') as x:
+                        x.write('dslkfgjsdlkfjsdf')
                     checksums.verify_file(output, relname)
 
             if env.get("mirror_files"):


I apparently get *two* tracebacks for the price of one:

  $ ./build-simple-cdd --verbose  --mirror-tools wget
  2017-05-15 10:08:58 INFO Reading configuration file /home/vagrant/simple-cdd/profiles/default.conf
  2017-05-15 10:08:58 INFO /home/vagrant/simple-cdd/profiles/default.conf: new var debian_mirror=http://cdn-fastly.deb.debian.org/debian/
  2017-05-15 10:08:58 INFO /home/vagrant/simple-cdd/profiles/default.conf: new var http_proxy=http://192.168.122.1:8000
  --- Logging error ---g: /home/vagrant/simple-cdd/tmp/mirror/dists/stretch/main/installer-amd64/current/images/cdrom/gtk
  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 155, in run
      _download(f["url"], f["absname"], checksums=file_sums, relname=f["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 "/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
  Call stack:
    File "./build-simple-cdd", line 674, in <module>
      log.error(*e.args)
    File "/usr/lib/python3.5/logging/__init__.py", line 1309, in error
      self._log(ERROR, msg, args, **kwargs)
    File "/usr/lib/python3.5/logging/__init__.py", line 1416, in _log
      self.handle(record)
    File "/usr/lib/python3.5/logging/__init__.py", line 1426, in handle
      self.callHandlers(record)
    File "/usr/lib/python3.5/logging/__init__.py", line 1488, in callHandlers
      hdlr.handle(record)
    File "/usr/lib/python3.5/logging/__init__.py", line 856, in handle
      self.emit(record)
    File "/home/vagrant/simple-cdd/simple_cdd/log.py", line 127, in emit
      self.handleError(record)
  Message: 'Invalid checksum for {}: expected {}, got {}'
  Arguments: ('/home/vagrant/simple-cdd/tmp/mirror/dists/stretch/main/installer-amd64/current/images/cdrom/gtk/initrd.gz', 'becc9447c6a59e4d1f870911999efae179612cd9eefc383cdc2c5762f6f35c39', '8b08096e9e4a33d13eb83261649bc5ec153ba24618ef4b578b5ad7f6aea0c7bf')


Thanks!


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/46b1bf58/attachment.sig>


More information about the Simple-cdd-devel mailing list