##// END OF EJS Templates
dispatch: protect against malicious 'hg serve --stdio' invocations (sec)...
dispatch: protect against malicious 'hg serve --stdio' invocations (sec) Some shared-ssh installations assume that 'hg serve --stdio' is a safe command to run for minimally trusted users. Unfortunately, the messy implementation of argument parsing here meant that trying to access a repo named '--debugger' would give the user a pdb prompt, thereby sidestepping any hoped-for sandboxing. Serving repositories over HTTP(S) is unaffected. We're not currently hardening any subcommands other than 'serve'. If your service exposes other commands to users with arbitrary repository names, it is imperative that you defend against repository names of '--debugger' and anything starting with '--config'. The read-only mode of hg-ssh stopped working because it provided its hook configuration to "hg serve --stdio" via --config parameter. This is banned for security reasons now. This patch switches it to directly call ui.setconfig(). If your custom hosting infrastructure relies on passing --config to "hg serve --stdio", you'll need to find a different way to get that configuration into Mercurial, either by using ui.setconfig() as hg-ssh does in this patch, or by placing an hgrc file someplace where Mercurial will read it. mitrandir@fb.com provided some extra fixes for the dispatch code and for hg-ssh in places that I overlooked.

File last commit:

r28750:2b0d7be9 default
r32050:77eaf953 4.1.3 stable
Show More
test-hybridencode.py
471 lines | 20.8 KiB | text/x-python | PythonLexer
/ tests / test-hybridencode.py
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 from __future__ import absolute_import, print_function
Robert Stanca
py3: use absolute_import in test-hybridencode.py
r28749 from mercurial import (
store,
)
Adrian Buehlmann
add new test-hybridencode.py
r7275
def show(s):
Adrian Buehlmann
test-hybridencode: use store._dothybridencode(s)...
r17622 # show test input
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("A = '%s'" % s.encode("string_escape"))
Adrian Buehlmann
test-hybridencode: use store._dothybridencode(s)...
r17622
# show the result of the C implementation, if available
Bryan O'Sullivan
store: switch to C-based hashed path encoding
r18435 h = store._pathencode(s)
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("B = '%s'" % h.encode("string_escape"))
Adrian Buehlmann
test-hybridencode: use store._dothybridencode(s)...
r17622
# compare it with reference implementation in Python
r = store._hybridencode(s, True)
if h != r:
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("R = '%s'" % r.encode("string_escape"))
print()
Adrian Buehlmann
add new test-hybridencode.py
r7275
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}")
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("uppercase char X is encoded as _x")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show("data/ABCDEFGHIJKLMNOPQRSTUVWXYZ")
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("underbar is doubled")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show("data/_")
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("tilde is character-encoded")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show("data/~")
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("characters in ASCII code range 1..31")
Adrian Buehlmann
test-hybridencode: remove x00 character case...
r17444 show('data/\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'
Adrian Buehlmann
test-hybridencode: more testcases
r17432 '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("characters in ASCII code range 126..255")
Adrian Buehlmann
test-hybridencode: test full range of ASCII codes from 126 to 255
r17445 show('data/\x7e\x7f'
'\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f'
'\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f')
show('data/\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf'
'\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf')
show('data/\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf'
'\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf')
show('data/\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef'
'\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')
Adrian Buehlmann
test-hybridencode: more testcases
r17432
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("Windows reserved characters")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/less <, greater >, colon :, double-quote ", backslash \\'
', pipe |, question-mark ?, asterisk *')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("encoding directories ending in .hg, .i or .d with '.hg' suffix")
Adrian Buehlmann
test-hybridencode: add a case for direncode
r17593 show('data/x.h.i/x.hg/x.i/x.d/foo')
Adrian Buehlmann
test-hybridencode: a few more cases
r17540 show('data/a.hg/a.i/a.d/foo')
show('data/au.hg/au.i/au.d/foo')
show('data/aux.hg/aux.i/aux.d/foo')
show('data/auxy.hg/auxy.i/auxy.d/foo')
Adrian Buehlmann
test-hybridencode: more testcases
r17432
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("but these are not encoded on *filenames*")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/foo/x.hg')
show('data/foo/x.i')
show('data/foo/x.d')
Adrian Buehlmann
test-hybridencode: a few more cases
r17540 show('data/foo/a.hg')
show('data/foo/a.i')
show('data/foo/a.d')
show('data/foo/au.hg')
show('data/foo/au.i')
show('data/foo/au.d')
show('data/foo/aux.hg')
show('data/foo/aux.i')
show('data/foo/aux.d')
show('data/foo/auxy.hg')
show('data/foo/auxy.i')
show('data/foo/auxy.d')
Adrian Buehlmann
test-hybridencode: more testcases
r17432
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("plain .hg, .i and .d directories have the leading dot encoded")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/.hg/.i/.d/foo')
Adrian Buehlmann
add new test-hybridencode.py
r7275 show('data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i')
Martin Geisler
test-hybridencode: break long string literals
r8659 show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/'
'TENTH/ELEVENTH/LOREMIPSUM.TXT.i')
show('data/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/'
'wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules'
'.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider.i')
show('data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-QUICK-'
'BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i')
show('data/Project Planning/Resources/AnotherLongDirectoryName/'
'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
show('data/Project.Planning/Resources/AnotherLongDirectoryName/'
'Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
Adrian Buehlmann
store: encode first period or space in filenames (issue1713)...
r12687 show('data/foo.../foo / /a./_. /__/.x../ bla/.FOO/something.i')
Adrian Buehlmann
test-hybridencode: more testcases
r17432
show('data/c/co/com/com0/com1/com2/com3/com4/com5/com6/com7/com8/com9')
show('data/C/CO/COM/COM0/COM1/COM2/COM3/COM4/COM5/COM6/COM7/COM8/COM9')
show('data/c.x/co.x/com.x/com0.x/com1.x/com2.x/com3.x/com4.x/com5.x'
'/com6.x/com7.x/com8.x/com9.x')
show('data/x.c/x.co/x.com0/x.com1/x.com2/x.com3/x.com4/x.com5'
'/x.com6/x.com7/x.com8/x.com9')
show('data/cx/cox/comx/com0x/com1x/com2x/com3x/com4x/com5x'
'/com6x/com7x/com8x/com9x')
show('data/xc/xco/xcom0/xcom1/xcom2/xcom3/xcom4/xcom5'
'/xcom6/xcom7/xcom8/xcom9')
show('data/l/lp/lpt/lpt0/lpt1/lpt2/lpt3/lpt4/lpt5/lpt6/lpt7/lpt8/lpt9')
show('data/L/LP/LPT/LPT0/LPT1/LPT2/LPT3/LPT4/LPT5/LPT6/LPT7/LPT8/LPT9')
show('data/l.x/lp.x/lpt.x/lpt0.x/lpt1.x/lpt2.x/lpt3.x/lpt4.x/lpt5.x'
'/lpt6.x/lpt7.x/lpt8.x/lpt9.x')
show('data/x.l/x.lp/x.lpt/x.lpt0/x.lpt1/x.lpt2/x.lpt3/x.lpt4/x.lpt5'
'/x.lpt6/x.lpt7/x.lpt8/x.lpt9')
show('data/lx/lpx/lptx/lpt0x/lpt1x/lpt2x/lpt3x/lpt4x/lpt5x'
'/lpt6x/lpt7x/lpt8x/lpt9x')
show('data/xl/xlp/xlpt/xlpt0/xlpt1/xlpt2/xlpt3/xlpt4/xlpt5'
'/xlpt6/xlpt7/xlpt8/xlpt9')
show('data/con/p/pr/prn/a/au/aux/n/nu/nul')
show('data/CON/P/PR/PRN/A/AU/AUX/N/NU/NUL')
show('data/con.x/p.x/pr.x/prn.x/a.x/au.x/aux.x/n.x/nu.x/nul.x')
show('data/x.con/x.p/x.pr/x.prn/x.a/x.au/x.aux/x.n/x.nu/x.nul')
show('data/conx/px/prx/prnx/ax/aux/auxx/nx/nux/nulx')
show('data/xcon/xp/xpr/xprn/xa/xau/xaux/xn/xnu/xnul')
Adrian Buehlmann
test-hybridencode: a few more cases
r17540 show('data/a./au./aux./auxy./aux.')
show('data/c./co./con./cony./con.')
show('data/p./pr./prn./prny./prn.')
show('data/n./nu./nul./nuly./nul.')
show('data/l./lp./lpt./lpt1./lpt1y./lpt1.')
show('data/lpt9./lpt9y./lpt9.')
show('data/com./com1./com1y./com1.')
show('data/com9./com9y./com9.')
show('data/a /au /aux /auxy /aux ')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("largest unhashed path")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/123456789-123456789-123456789-123456789-123456789-'
'unhashed--xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("shortest hashed path")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/123456789-123456789-123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("changing one char in part that's hashed away produces a different hash")
Adrian Buehlmann
test-hybridencode: more testcases
r17432 show('data/123456789-123456789-123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxy-'
'123456789-123456')
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("uppercase hitting length limit due to encoding")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/A23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/Z23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("compare with lowercase not hitting limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/a23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/z23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("not hitting limit with any of these")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;="
"[]^`{}xxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-"
"123456789-12345")
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("underbar hitting length limit due to encoding")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/_23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("tilde hitting length limit due to encoding")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/~23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("Windows reserved characters hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/<23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/>23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/:23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/"23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/\\23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/|23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/?23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/*23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("initial space hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/ 23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("initial dot hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/.23456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("trailing space in filename hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/123456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-1234 ')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("trailing dot in filename hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/123456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-1234.')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("initial space in directory hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/ x/456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("initial dot in directory hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/.x/456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("trailing space in directory hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/x /456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("trailing dot in directory hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/x./456789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("with directories that need direncoding, hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/x.i/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/x.d/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/x.hg/5789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("Windows reserved filenames, hitting length limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/con/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/prn/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/aux/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/nul/56789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/com1/6789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/com9/6789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/lpt1/6789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
show('data/lpt9/6789-123456789-123456789-123456789-123456789-'
'xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("non-reserved names, just not hitting limit")
Adrian Buehlmann
test-hybridencode: add more testcases for hashed paths
r17440 show('data/123456789-123456789-123456789-123456789-123456789-'
'/com/com0/lpt/lpt0/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12345')
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated 1st dir")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/-123456789-123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated 1st dir")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789-123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated two dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/9-123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated two dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated three dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/89-123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated three dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated four dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/789-123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated four dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789/123456789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated five dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/6789-'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated five dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789/123456789/'
'hashed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated six dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/ed----xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated six dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789/123456789/'
'123456789/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated seven dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/xxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated seven dirs")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789/123456789/'
'123456789/123456789/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest untruncated eight dirs")
print("(directory 8 is dropped because it hits _maxshortdirslen)")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345678/xxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with smallest truncated eight dirs")
print("(directory 8 is dropped because it hits _maxshortdirslen)")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/123456789/123456789/123456789/123456789/123456789/'
'123456789/123456789/123456789/xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with largest non-dropped directory 8")
print("(just not hitting the _maxshortdirslen boundary)")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("...adding one truncated char to dir 1..7 won't drop dir 8")
Adrian Buehlmann
test-hybridencode: adding one truncated char to dir 1..7 won't drop dir 8
r17453 show('data/12345678x/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678x/12345678/12345678/12345678/12345'
'678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678x/12345678/12345678/12345'
'678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678x/12345678/12345'
'678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678/12345678x/12345'
'678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678x/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678x/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path with shortest dropped directory 8")
print("(just hitting the _maxshortdirslen boundary)")
Adrian Buehlmann
test-hybridencode: testing dir levels and dir prefix lenghts of hashed paths
r17452 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/123456/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Adrian Buehlmann
test-hybridencode: dropping dir eight in hashed path due to dot or space at end
r17457
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("hashed path that drops dir 8 due to dot or space at end is")
print("encoded, and thus causing to hit _maxshortdirslen")
Adrian Buehlmann
test-hybridencode: dropping dir eight in hashed path due to dot or space at end
r17457 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/1234./-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/1234 /-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("... with dir 8 short enough for encoding")
Adrian Buehlmann
test-hybridencode: dropping dir eight in hashed path due to dot or space at end
r17457 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12./xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12 /xx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-123456')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print('''Extensions are replicated on hashed paths. Note that
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 we only get to encode files that end in .i or .d inside the
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 store. Encoded filenames are thus bound in length.''')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.345.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.345.d')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.34567.i')
show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12.345678.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-1.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-12.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-123.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-1234.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 '123456789-12.3456789-12345.i')
Adrian Buehlmann
test-hybridencode: extensions are replicated on hashed paths...
r17459 show('data/12345678/12345678/12345678/12345678/12345678/12345'
'678/12345678/12345/-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-'
'123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWX'
'YZ-abcdefghjiklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPRSTU'
'VWXYZ-1234567890-xxxxxxxxx-xxxxxxxxx-xxxxxxxx-xxxx'
'xxxxx-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwww'
Adrian Buehlmann
test-hybridencode: in practice, extensions aren't really unbound in length...
r17690 'wwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww.i')
Martin von Zweigbergk
pathencode: for long paths, strip first 5 chars, not first dir...
r25027
Robert Stanca
py3: use print_function in test-hybridencode.py
r28750 print("paths outside data/ can be encoded")
Martin von Zweigbergk
pathencode: for long paths, strip first 5 chars, not first dir...
r25027 show('metadata/dir/00manifest.i')
show('metadata/12345678/12345678/12345678/12345678/12345678/'
'12345678/12345678/12345678/12345678/12345678/12345678/'
'12345678/12345678/00manifest.i')