[Python-bugs-list] [ python-Bugs-456386 ] test_commands regression failure

noreply@sourceforge.net noreply@sourceforge.net
Tue, 28 Aug 2001 21:19:49 -0700


Bugs item #456386, was opened at 2001-08-28 21:19
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456386&group_id=5470

Category: None
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Dalke (dalke)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_commands regression failure

Initial Comment:
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.



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456386&group_id=5470