This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_commands.py failing on OS X 10.5.7 due to '@' in ls output
Type: behavior Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: ixokai, jgsack, meador.inge, ned.deily, python-dev, ronaldoussoren
Priority: normal Keywords: patch

Created on 2009-10-11 23:33 by meador.inge, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_commands.patch meador.inge, 2009-10-11 23:33 Patch review
Messages (5)
msg93881 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2009-10-11 23:33
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
msg96503 - (view) Author: James G. sack (jim) (jgsack) Date: 2009-12-17 02:26
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
msg127953 - (view) Author: Stephen Hansen (ixokai) (Python triager) Date: 2011-02-04 23:46
I can confirm that this test has been failing on my slave, and that the patch fixes it. Recommend commit. Red is bad.
msg133099 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-04-06 00:20
New changeset 5616cbce0bee by Ned Deily in branch '2.7':
Issue #7108: Fix test_commands to not fail when special attributes ('@'
http://hg.python.org/cpython/rev/5616cbce0bee
msg133100 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-04-06 00:23
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.)
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51357
2011-04-29 01:32:38r.david.murraylinkissue11946 superseder
2011-04-06 00:23:22ned.deilysetstatus: open -> closed
messages: + msg133100

assignee: ned.deily
components: - macOS
resolution: fixed
stage: resolved
2011-04-06 00:20:06python-devsetnosy: + python-dev
messages: + msg133099
2011-02-05 21:10:40pitrousetassignee: ronaldoussoren -> (no value)
nosy: ixokai, jgsack, ronaldoussoren, ned.deily, meador.inge
2011-02-05 01:30:45pitrousetnosy: + ned.deily
2011-02-04 23:46:18ixokaisetnosy: + ronaldoussoren, ixokai
messages: + msg127953

assignee: ronaldoussoren
components: + macOS
2009-12-17 02:26:35jgsacksetnosy: + jgsack
messages: + msg96503
2009-10-11 23:33:34meador.ingecreate