tests/readlink.py
author Blake Burkhart <bburky@bburky.com>
Wed, 06 Apr 2016 22:57:46 -0500
branchstable
changeset 29051 a56296f55a5e
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
convert: pass absolute paths to git (SEC) Fixes CVE-2016-3105 (1/1). Previously, it was possible for the repository path passed to git-ls-remote to be misinterpreted as a URL. Always passing an absolute path to git is a simple way to avoid this.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5683
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     1
#!/usr/bin/env python
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     2
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     3
import errno, os, sys
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     4
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     5
for f in sys.argv[1:]:
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     6
    try:
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
        print f, '->', os.readlink(f)
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 10282
diff changeset
     8
    except OSError as err:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 5683
diff changeset
     9
        if err.errno != errno.EINVAL:
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 5683
diff changeset
    10
            raise
5683
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    11
        print f, 'not a symlink'
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    12
396c7010b0cd Use common readlink.py instead of own implementations per test script.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    13
sys.exit(0)