Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_commands.py failing on OS X 10.5.7 due to '@' in ls output #51357

Closed
meadori opened this issue Oct 11, 2009 · 5 comments
Closed

test_commands.py failing on OS X 10.5.7 due to '@' in ls output #51357

meadori opened this issue Oct 11, 2009 · 5 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@meadori
Copy link
Member

meadori commented Oct 11, 2009

BPO 7108
Nosy @ronaldoussoren, @ned-deily, @meadori
Files
  • test_commands.patch: Patch
  • 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/ned-deily'
    closed_at = <Date 2011-04-06.00:23:22.532>
    created_at = <Date 2009-10-11.23:33:34.135>
    labels = ['type-bug', 'tests']
    title = "test_commands.py failing on OS X 10.5.7 due to '@' in ls output"
    updated_at = <Date 2011-04-06.00:23:22.531>
    user = 'https://github.com/meadori'

    bugs.python.org fields:

    activity = <Date 2011-04-06.00:23:22.531>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2011-04-06.00:23:22.532>
    closer = 'ned.deily'
    components = ['Tests']
    creation = <Date 2009-10-11.23:33:34.135>
    creator = 'meador.inge'
    dependencies = []
    files = ['15106']
    hgrepos = []
    issue_num = 7108
    keywords = ['patch']
    message_count = 5.0
    messages = ['93881', '96503', '127953', '133099', '133100']
    nosy_count = 6.0
    nosy_names = ['ixokai', 'jgsack', 'ronaldoussoren', 'ned.deily', 'meador.inge', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7108'
    versions = ['Python 2.7']

    @meadori
    Copy link
    Member Author

    meadori commented Oct 11, 2009

    I am testing this out of the trunk on OS X 10.5.7:

    uclid:trunk minge$ uname -a
    Darwin euclid.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31
    22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386
    euclid:trunk minge$ ./python.exe Lib/test/test_commands.py
    test_getoutput (main.CommandTests) ... ok
    test_getstatus (main.CommandTests) ... FAIL

    ======================================================================
    FAIL: test_getstatus (main.CommandTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "Lib/test/test_commands.py", line 60, in test_getstatus
        self.assertTrue(re.match(pat, getstatus("/."), re.VERBOSE))
    AssertionError: None is not True

    Ran 2 tests in 0.047s

    FAILED (failures=1)
    Traceback (most recent call last):
      File "Lib/test/test_commands.py", line 69, in <module>
        test_main()
      File "Lib/test/test_commands.py", line 64, in test_main
        run_unittest(CommandTests)
      File
    "/Users/minge/Research/Languages/python/trunk/Lib/test/test_support.py",
    line 884, in run_unittest
        _run_suite(suite)
      File
    "/Users/minge/Research/Languages/python/trunk/Lib/test/test_support.py",
    line 867, in _run_suite
        raise TestFailed(err)
    test.test_support.TestFailed: Traceback (most recent call last):
      File "Lib/test/test_commands.py", line 60, in test_getstatus
        self.assertTrue(re.match(pat, getstatus("/."), re.VERBOSE))
    AssertionError: None is not True

    [30608 refs]
    euclid:trunk minge$ patch -p0 < test_commands.patch
    patching file Lib/test/test_commands.py
    euclid:trunk minge$ ./python.exe Lib/test/test_commands.py
    test_getoutput (main.CommandTests) ... ok
    test_getstatus (main.CommandTests) ... ok

    ----------------------------------------------------------------------
    Ran 2 tests in 0.040s

    OK
    [30459 refs]

    According to the OS X documentation for ls(1) [1] the output of ls can
    include the '@' character to denote that file has "extended attributes".
    The attached patch adjust the regex which is applied to the output of
    ls to account for this fact (a more rigorous approach would have
    conditioned the '@' check on OS X, but I wasn't sure if it was worth the
    added complexity).

    [1]
    http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/ls.1.html

    @meadori meadori added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 11, 2009
    @jgsack
    Copy link
    Mannequin

    jgsack mannequin commented Dec 17, 2009

    test_commands test_getstatus also fails on linux with SELinux enabled

    On gnu/linux, info ls reports:
    """
    Following the file mode bits is a single character that specifies
    whether an alternate access method such as an access control list
    applies to the file. When the character following the file mode
    bits is a space, there is no alternate access method. When it is
    a printing character, then there is such a method.

     GNU `ls' uses a `.' character to indicate a file with an SELinux
     security context, but no other alternate access method.
    
     A file with any other combination of alternate access methods is
     marked with a \`+' character.
    

    """

    So it sounds like the previous patch could be further generalized to (say)
    """

    •              \\+?          # It may have ACLs.
      

    + [.+@]? # It may have alt access (SELinux, ACLs
    or metadata ('@' OS X).
    """

    ~jim

    @ixokai
    Copy link
    Mannequin

    ixokai mannequin commented Feb 4, 2011

    I can confirm that this test has been failing on my slave, and that the patch fixes it. Recommend commit. Red is bad.

    @ixokai ixokai mannequin added the OS-mac label Feb 4, 2011
    @ixokai ixokai mannequin assigned ronaldoussoren Feb 4, 2011
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 6, 2011

    New changeset 5616cbce0bee by Ned Deily in branch '2.7':
    Issue bpo-7108: Fix test_commands to not fail when special attributes ('@'
    http://hg.python.org/cpython/rev/5616cbce0bee

    @ned-deily
    Copy link
    Member

    Thanks for the suggested patch and extension to the SELinux case. (Note that getstatus is deprecated and removed in Python 3 so this patch only applies to 2.7.)

    @ned-deily ned-deily removed the OS-mac label Apr 6, 2011
    @ned-deily ned-deily self-assigned this Apr 6, 2011
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants