Skip to content

cgitb.scanvars fails #40348

Closed
Closed

Description

@rgbecker
mannequin
BPO 966992
Nosy @akuchling
Files
  • cgitb_scanvars_bug.py: demonstrate cgitb scanvars bug
  • python-2.4a0-966992.patch: patch against Pytho-2.4a0 to fix 966992
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/akuchling'
    closed_at = <Date 2004-06-05.19:16:44.000>
    created_at = <Date 2004-06-05.08:59:28.000>
    labels = ['library']
    title = 'cgitb.scanvars fails'
    updated_at = <Date 2004-06-05.19:16:44.000>
    user = 'https://bugs.python.org/rgbecker'

    bugs.python.org fields:

    activity = <Date 2004-06-05.19:16:44.000>
    actor = 'akuchling'
    assignee = 'akuchling'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2004-06-05.08:59:28.000>
    creator = 'rgbecker'
    dependencies = []
    files = ['1296', '1297']
    hgrepos = []
    issue_num = 966992
    keywords = []
    message_count = 3.0
    messages = ['21037', '21038', '21039']
    nosy_count = 2.0
    nosy_names = ['akuchling', 'rgbecker']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue966992'
    versions = ['Python 2.4']

    Activity

    1. rgbecker commented on Jun 5, 2004

      rgbeckermannequin
      MannequinAuthor

      Under certain circumstances cgitb.scanvars fails with
      because of an unititialized value variable. This bug is
      present in 2.3.3 and 2.4a0.

      The following script demonstrates
      #####start
      import cgitb;cgitb.enable()

      def err(L):
          if 'never' in L:
              return
          if 1: print \
          '\n'.join(L)
          v=2
      
      err(['',None])
      #####finish

      when run this results in mangled output because scanvars
      attempts to evaluate '\n'.join(L) where L=['',None]. A
      fix is to set value=UNDEF at the start of scanvars.

      Index: cgitb.py
      ===================================================================
      RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v
      retrieving revision 1.11
      diff -r1.11 cgitb.py
      63c63
      < vars, lasttoken, parent, prefix = [], None, None, ''
      ---

      vars, lasttoken, parent, prefix, value = [],
      

      None, None, '', __UNDEF__

    2. added
      stdlib
      on Jun 5, 2004
    3. added
      stdlib
      on Jun 5, 2004
    4. rgbecker commented on Jun 5, 2004

      rgbeckermannequin
      MannequinAuthor

      Logged In: YES
      user_id=6946

      The script cgitb_scanvars_bug.py produces mangled output
      under 2.3.3 and 2.4a0. The error is caused by an error
      during evaluation in cgitb.scanvars. I believe a fix is to
      intialize value to __UNDEF__.

      Patch python-2.4a0-966992.patch appears to fix in 2.3.3 and
      2.4a0. There may be other ways in which scanvars can error,
      but I haven't found them yet :(

    5. akuchling commented on Jun 5, 2004

      @akuchling
      Contributor

      Logged In: YES
      user_id=11375

      Applied; thanks!

    6. transferred this issue fromon Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions