Ok, I got it. Linux really have a base-name limit for 256 bytes, see here for a full list of all limitations. A simple code can verify that:
# -*- encoding:utf8 -*-
import os
if __name__ == '__main__':
base = 'x'
basename = ''
while 1:
basename += base
try:
with open(basename, 'w') as fd:
os.remove(basename)
except Exception as ex:
print('length %d failed' % len(basename))
break
I encounter the problem when I copy GBK encoded file name into Tmpfs, and I transferred the GBK filenames into UTF8, then the length changed:
>>> s = u'中'
>>> len(s.encode('gbk'))
>>> 2
>>> len(s.encode('utf8'))
>>> 3
so, the utf8-filenames may exceed 255 bytes.