Description
Trying to access a page with too long name fail with a traceback, instead of nice error message.
Steps to reproduce
Try to access this page (70 Hebrew characters): אאאאאאאאאאבבבבבבבבבבגגגגגגגגגגדדדדדדדדדדההההההההההווווווווווזזזזזזזזזז
Also works for long western pagenames:
You will receive an python error:
--> --> Traceback (most recent call last): File "/srv/moin/code/1.8/MoinMoin/request/__init__.py", line 1310, in run handler(self.page.page_name, self) File "/srv/moin/code/1.8/MoinMoin/action/__init__.py", line 253, in do_show content_only=content_only, File "/srv/moin/code/1.8/MoinMoin/Page.py", line 1021, in send_page body = self.data File "/srv/moin/code/1.8/MoinMoin/Page.py", line 246, in get_data self.__meta, self.__data = wikiutil.get_processing_instructions(self.body) File "/srv/moin/code/1.8/MoinMoin/Page.py", line 212, in get_body f = codecs.open(self._text_filename(), 'rb', config.charset) File "codecs.py", line 666, in open file = __builtin__.open(filename, mode, buffering) IOError: [Errno 36] File name too long: '/srv/in.moinmo/data/pages/Gemlde(20)ADfljerlkjl(c3b6)asd(20)dflk(20)ere(20)ADfljl(c3b6)jklj(20)dae(20)der(20)Dadfljker(20)ljk(20)ERJAsdlfj(c3b6)s(20)Dfereree(20)ljl(c3b6)kj(c3b6)d(20)dfd(20)dfasdlf(20)lkj(20)lkl(20)lk(20)llkl(20)lle(20)lasdfl(c3b6)jksdf(20)df(20)ERadsflj(20)daf(20)df(20)aDerdf/revisions/99999999' Additionally cgitb raised this exception: Traceback (most recent call last): File "/srv/moin/code/1.8/MoinMoin/failure.py", line 176, in handle handler.handle(savedError) File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 576, in handle doc = view.format(formatter, self.context) File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 354, in format return formatter.section(self.formatContent(), {'class': 'cgitb'}) File "/srv/moin/code/1.8/MoinMoin/failure.py", line 38, in formatContent content = ( File "/srv/moin/code/1.8/MoinMoin/failure.py", line 99, in formatDebugInfo info = [self.debugInfoHideScript(), File "/srv/moin/code/1.8/MoinMoin/failure.py", line 113, in formatTraceback return self.formatAllTracebacks(self.formatOneTraceback) File "/srv/moin/code/1.8/MoinMoin/failure.py", line 125, in formatAllTracebacks tracebacks.append(formatFuction((ttype, tvalue, tb))) File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 432, in formatOneTraceback output = [self.formatter.subTitle('Traceback'), File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 445, in tracebackFrames frames.append(frame.format(self.formatter)) File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 201, in format vars, highlight = self.scan() File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 290, in scan vars = self.scanVariables(reader) File "/srv/moin/code/1.8/MoinMoin/support/cgitb.py", line 305, in scanVariables value = getattr(parent, token, __UNDEF__) File "/srv/moin/code/1.8/MoinMoin/Page.py", line 246, in get_data self.__meta, self.__data = wikiutil.get_processing_instructions(self.body) File "/srv/moin/code/1.8/MoinMoin/Page.py", line 212, in get_body f = codecs.open(self._text_filename(), 'rb', config.charset) File "codecs.py", line 666, in open file = __builtin__.open(filename, mode, buffering) IOError: [Errno 36] File name too long: '/srv/in.moinmo/data/pages/Gemlde(20)ADfljerlkjl(c3b6)asd(20)dflk(20)ere(20)ADfljl(c3b6)jklj(20)dae(20)der(20)Dadfljker(20)ljk(20)ERJAsdlfj(c3b6)s(20)Dfereree(20)ljl(c3b6)kj(c3b6)d(20)dfd(20)dfasdlf(20)lkj(20)lkl(20)lk(20)llkl(20)lle(20)lasdfl(c3b6)jksdf(20)df(20)ERadsflj(20)daf(20)df(20)aDerdf/revisions/99999999'
Component selection
- Page.py
Details
MoinMoin Version |
1.8 |
Workaround
Use a shorter page name.
For hebrew name, the maximum page name is 63 Hebrew characters on posix file system. On windows it may be less depending on the location of the wiki (total path length is limited).
Asian languages have much shorter maximum page names.
Discussion
Check for errno.ENAMETOOLONG in get_raw_body and return empty string.
- the system should prevent / catch this error (and the user should be informed that it's not possible to create this page, because of...)
- yes. a good time to fix that is when we merge the new storage code.
- the count for the pagename should also contain the already used chars for the full path (if it plays a role)
path: /srv/in.moinmo/data/pages/
pagename dir: Gemlde ADfljerlkjlöasd dflk ere ADfljlöjklj dae der Dadfljker ljk ERJAsdlfjös Dfereree ljlökjöd dfd dfasdlf lkj lkl lk llkl lle lasdflöjksdf df ERadsflj daf df aDerdf
- it is depending on the filesystem (e.g. ext3, ntfs, xfs, ..)
On my MoinMoin 1.7 with Debian Linux (Python 2.4 / ext3) I could create this long pagename without any problems.
- Maybe because your path to data_dir was a bit shorter or you used another filesystem or ... - moin 1.7 for sure did not include any magic making this work for arbitrary page name lengths.
Plan
- Priority: medium - related mainly to non english wikis.
- Assigned to:
Status: please review patch for 1.8 Page.patch