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 regression failure
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: dalke, gvanrossum
Priority: normal Keywords:

Created on 2001-08-29 04:19 by dalke, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (2)
msg6216 - (view) Author: Andrew Dalke (dalke) * (Python committer) Date: 2001-08-29 04:19
test_commands does not work on IRIX

It assumes the output of "ls /bin/ls" is a line
that starts with a '-'.  On IRIX that file is
a symbolic link, so the first character is an l.
This causes test_getstatus to fail.

>>> import commands
>>> commands.getstatus("/bin/ls")
'lrwxr-xr-x    1 root     sys           13 Feb 23  
1997 /bin/ls -> ../../sbin/ls'
>>> pat = r'''-..x..x..x   # It is executable.
...                   \s+\d+       # It has some 
number of links.
...                   \s+\w+\s+\w+ # It has a user and 
group, which may
...                                #     be named 
anything.
...                   [^/]*        # Skip the date.
...                   /bin/ls      # and end with the 
name of the file.
...                '''
>>> import re
>>> re.match(pat, commands.getstatus("/bin/ls"), 
re.VERBOSE)
>>>

Here's a context diff for a patch.  (I hate how narrow
this entry textbox is.)  Feel free to adjust the '#'s
so they all line up.

*** Lib/test/test_commands.py   2001/07/23 
04:08:01     1.1
--- Lib/test/test_commands.py   2001/08/29 04:18:36
***************
*** 32,38 ****
      def test_getstatus(self):
          # This pattern should match 'ls -ld /bin/ls' 
on any posix
          # system, however perversely configured.
!         pat = r'''-..x..x..x   # It is executable.
                    \s+\d+       # It has some number 
of links.
                    \s+\w+\s+\w+ # It has a user and 
group, which may
                                 #     be named 
anything.
--- 32,38 ----
      def test_getstatus(self):
          # This pattern should match 'ls -ld /bin/ls' 
on any posix
          # system, however perversely configured.
!         pat = r'''[l-]..x..x..x   # It is 
executable. (May be a symlink.)
                    \s+\d+       # It has some number 
of links.
                    \s+\w+\s+\w+ # It has a user and 
group, which may
                                 #     be named 
anything.

msg6217 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-10-30 03:18
Logged In: YES 
user_id=6380

Thanks. Fixed in CVS, test_commands.py 1.3, exactly as you
suggest.
History
Date User Action Args
2022-04-10 16:04:23adminsetgithub: 35066
2001-08-29 04:19:49dalkecreate