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

Enrico Zini enrico at enricozini.org
Mon May 15 10:42:39 UTC 2017


On Sun, May 07, 2017 at 09:58:12PM -0700, Vagrant Cascadian wrote:

> Any chance you could review the urllib implementation that is in git
> soonish? :)

I've been adventurously busy, I hope it's not too late.

In bfc0329060e262bfd889b5e40c32ad9099197dcb I have mixed feelings about
this, as it uses string split on a path while python has os.path.split.
However, I couldn't at a glance follow the code to see what kind of
input it works on, and if it's something like
http://ftp.fr.debian.org/debian/dists/jessie/Release
then the lines are not really paths:

-                    prefix_len = 7 + len(env.get("DI_CODENAME")) # dists/{DI_CODENAME}/
-                    relname = file[prefix_len:]
+                    separator = os.path.join('dists/', env.get("DI_CODENAME"), '')
+                    separator, relname = file.split(separator)


About 6717a008549cd792a4c08d7c21d09cbd8b82a67a: COOL!

In b164d54b912a8d702576c191a821ec2f374642cf I agree that except without
an exception is too broad, like in here:

                    try:
                        checksums.verify_file(output, relname)
                    except:
                        raise Fail("Checksum invalid: %s", output)

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.

1faddb9cfe4992c36bca7e502f5190e96de74f77 looks good, I can't think of a
better way of doing it.

I'm attaching a proposed patch for the over-broad excepts.


Enrico

-- 
GPG key: 4096R/634F4BD1E7AD5568 2009-05-08 Enrico Zini <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Avoid-except-that-might-catch-too-much.patch
Type: text/x-diff
Size: 1569 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/simple-cdd-devel/attachments/20170515/28e5bd2e/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/simple-cdd-devel/attachments/20170515/28e5bd2e/attachment.sig>


More information about the Simple-cdd-devel mailing list