Edgewall Software
Modify

Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#5377 closed defect (invalid)

Add Attachment Error

Reported by: anonymous Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords: needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

An error occured while trying to add an attachment (filesize was about 8KB):

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/trac/attachment.py", line 361, in process_request
    self._do_save(req, attachment)
  File "/usr/lib/python2.4/site-packages/trac/attachment.py", line 496, in _do_save
    attachment.insert(filename, upload.file, size)
  File "/usr/lib/python2.4/site-packages/trac/attachment.py", line 183, in insert
    filename))
  File "/usr/lib/python2.4/site-packages/trac/util/__init__.py", line 112, in create_unique_file
    raise Exception('Failed to create unique name: ' + path)
Exception: Failed to create unique name: /srv/trac/lsoc/attachments/wiki/Video-Telefonie/class03.100.png

Attachments (0)

Change History (4)

comment:1 by Christian Boos, 18 years ago

Description: modified (diff)
Keywords: needinfo added

How many times did you try? What was the uploaded file name (on your client filesystem)?

comment:2 by Chris Hoover, 18 years ago

I get the same error (file is very large — about 3megs)

Most recent call last:

  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/web/main.py", line 432, in dispatch_request Code fragment:
    1. if not env and env_error:
    2. raise HTTPInternalError(env_error)
    3. try:
    4. try:
    5. dispatcher = RequestDispatcher(env)
    6. dispatcher.dispatch(req)
    7. except RequestDone:
    8. pass
    9. return req._response or []
    10. finally:
    11. if not run_once:
    Local variables: Name Value after [' except RequestDone:', ' pass', ' … before [' if not env and env_error:', ' raise … dispatcher <trac.web.main.RequestDispatcher object at 0xb792cecc> e <exceptions.Exception instance at 0xb0d066c> egg_cache '/var/www/html/.python-eggs' env <trac.env.Environment object at 0xb7ac578c> env_error None env_path '/var/www/html/prd' environ {'trac.base_url': u'http://product.narus.com/prd', 'wsgi.multiprocess': … exc_info (<class exceptions.Exception at 0xa20326c>, <exceptions.Exception instance … filename '/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/web/mai … frames [{'function': 'dispatch_request', 'lines_before': [' if not env and … has_admin True line ' dispatcher.dispatch(req)' lineno 431 message u'Exception: Failed to create unique name: … options {'TracUriRoot': '/prd', 'TracEnv': '/var/www/html/prd'} req <Request "POST u'/attachment/ticket/148'"> request_uri '/prd/attachment/ticket/148' root_uri '/prd' run_once False script_url None start_response <bound method ModPythonGateway._start_response of … tb <traceback object at 0xb0aed74> tb_hide None traceback 'Traceback (most recent call last):\n File …
  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/web/main.py", line 217, in dispatch Code fragment:
    1. 'Do you have cookies enabled?')
    2. # Process the request and render the template
    3. try:
    4. try:
    5. resp = chosen_handler.process_request(req)
    6. if resp:
    7. if len(resp) == 2: # Clearsilver
    8. chrome.populate_hdf(req)
    9. template, content_type = \
    10. self._post_process_request(req, *resp)
    Local variables: Name Value chosen_handler <trac.attachment.AttachmentModule object at 0xb792c3ec> chrome <trac.web.chrome.Chrome object at 0xb792c50c> ctype 'multipart/form-data' err (<class exceptions.Exception at 0xa20326c>, <exceptions.Exception instance … handler <trac.attachment.AttachmentModule object at 0xb792c3ec> options {'boundary': '—————————————-22168770913606'} req <Request "POST u'/attachment/ticket/148'"> self <trac.web.main.RequestDispatcher object at 0xb792cecc>
  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 407, in process_request Code fragment:
    1. ('attachment', attachment.filename, resource=attachment)
    2. add_link(req, 'up', ctx.parent.resource_href(), ctx.parent.name()) 404.
    3. if req.method == 'POST':
    4. if action == 'new':
    5. self._do_save(ctx)
    6. elif action == 'delete':
    7. self._do_delete(ctx)
    8. elif action == 'delete':
    9. data = self._render_confirm_delete(ctx)
    10. elif action == 'new':
    Local variables: Name Value action u'new' attachment <trac.attachment.Attachment object at 0xb0bb56c> context <Context '[root]' <Request "POST u'/attachment/ticket/148'">> ctx <Context u'[root], ticket:148, attachment:Ticket#148_NSS_Portal062007.doc' … parent_realm u'ticket' path u'148' req <Request "POST u'/attachment/ticket/148'"> self <trac.attachment.AttachmentModule object at 0xb792c3ec>
  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 545, in _do_save Code fragment:
    1. req.perm.require('ATTACHMENT_DELETE', context)
    2. old_attachment.delete()
    3. except TracError:
    4. pass # don't worry if there's nothing to replace
    5. attachment.filename = None
    6. attachment.insert(filename, upload.file, size)
    7. # Redirect the user to list of attachments (must add a trailing '/')
    8. req.redirect(context.resource_href('..') + '/')
    9. def _do_delete(self, context):
    Local variables: Name Value attachment <trac.attachment.Attachment object at 0xb0bb56c> context <Context u'[root], ticket:148, attachment:Ticket#148_NSS_Portal062007.doc' … filename u'Ticket#148_NSS_Portal062007.doc' max_size 262144000 req <Request "POST u'/attachment/ticket/148'"> self <trac.attachment.AttachmentModule object at 0xb792c3ec> size 3008000L upload FieldStorage('attachment', 'Ticket#148_NSS_Portal062007.doc', …
  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 244, in insert Code fragment:
    1. if not os.access(self.path, os.F_OK):
    2. os.makedirs(self.path)
    3. filename = unicode_quote(filename)
    4. path, targetfile = create_unique_file(os.path.join(self.path,
    5. filename))
    6. try:
    7. # Note: path is an unicode string because self.path was one.
    8. # As it contains only quoted chars and numbers, we can use ascii
    9. basename = os.path.basename(path).encode('ascii')
    10. filename = unicode_unquote(basename)
    Local variables: Name Value attachments_dir '/var/www/html/prd/attachments' commonprefix '/var/www/html/prd/attachments' db <trac.db.pool.PooledConnection object at 0xb0d06ac> filename 'Ticket%23148_NSS_Portal062007.doc' fileobj <open file '<fdopen>', mode 'w+b' at 0xb76e6728> handle_ta True self <trac.attachment.Attachment object at 0xb0bb56c> size 3008000L t None timestamp 1182400981
  • File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/util/init.py", line 85, in create_unique_file Code fragment:
    1. return path, os.fdopen(os.open(path, flags), 'w')
    2. except OSError:
    3. idx += 1
    4. # A sanity check
    5. if idx > 100:
    6. raise Exception('Failed to create unique name: ' + path)
    7. path = '%s.%d%s' % (parts[0], idx, parts[1])
    8. class NaivePopen:
    9. """This is a deadlock-safe version of popen that returns an object with
    Local variables: Name Value flags 193 idx 101 parts (u'/var/www/html/prd/attachments/ticket/148/Ticket%23148_NSS_Portal062007', … path u'/var/www/html/prd/attachments/ticket/148/Ticket%23148_NSS_Portal062007.10 …

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/web/main.py", line 432, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/web/main.py", line 217, in dispatch

resp = chosen_handler.process_request(req)

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 407, in process_request

self._do_save(ctx)

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 545, in _do_save

attachment.insert(filename, upload.file, size)

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/attachment.py", line 244, in insert

filename))

File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r5683-py2.4.egg/trac/util/init.py", line 85, in create_unique_file

raise Exception('Failed to create unique name: ' + path)

System Information:

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 Trac: 0.11dev-r5683 Python: 2.4.3 (#1, Oct 23 2006, 14:19:47) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] setuptools: 0.6c3 SQLite: 3.3.3 pysqlite: 1.1.7 Genshi: 0.4.1 jQuery: 1.1.2

comment:3 by anonymous, 17 years ago

Resolution: invalid
Status: newclosed

Closing this bug (I was the one that opened it). Was a configuration error on my part.

comment:4 by batfung@…, 17 years ago

I am having the same problem. What's your configuration error? and how did you fix it?

Thanks./

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.