[Patches] [ python-Patches-524008 ] pysvr portability bug on new POSIX hosts

noreply@sourceforge.net noreply@sourceforge.net
Fri, 01 Mar 2002 05:18:23 -0800


Patches item #524008, was opened at 2002-02-28 20:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=524008&group_id=5470

Category: Demos and tools
Group: Python 2.2.x
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Paul Eggert (eggert)
Assigned to: Nobody/Anonymous (nobody)
Summary: pysvr portability bug on new POSIX hosts

Initial Comment:
The new POSIX standard is now official (IEEE
Std 1003.1-2001), and it has removed support
for the obsolescent syntax "tail +2l".
You are now supposed to use "tail -n +2"
instead.  As a result of this change,
the pysvr demo fails on my Solaris 8 host if I am
using GNU textutils 2.0.21 and have defined
_POSIX2_VERSION=200112 and
POSIXLY_CORRECT=true in my environment.

Here is a patch, relative to Python 2.2.

2002-02-28  Paul Eggert  <eggert@twinsun.com>

	* Demo/pysvr/pysvr.c (ps):
	Don't use "tail +2l", as POSIX 1003.1-2001
	no longer allows this.
	Use "sed 1d" instead, as it's more portable.

===================================================================
RCS file: Demo/pysvr/pysvr.c,v
retrieving revision 2.2
retrieving revision 2.2.0.1
diff -pu -r2.2 -r2.2.0.1
--- Demo/pysvr/pysvr.c	2001/11/28 20:27:42	2.2
+++ Demo/pysvr/pysvr.c	2002/02/28 19:02:54	2.2.0.1
@@ -365,6 +365,6 @@ ps(void)
 {
 	char buffer[100];
 	PyOS_snprintf(buffer, sizeof(buffer),
-		      "ps -l -p %d </dev/null | tail +2l\n",
getpid());
+		      "ps -l -p %d </dev/null | sed 1d\n",
getpid());
 	system(buffer);
 }


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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-03-01 14:18

Message:
Logged In: YES 
user_id=21627

Thanks for the patch. Fixed in pysvr.c 1.11.

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

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