rpms/coreutils/devel coreutils-sort-compatibility.patch,NONE,1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jun 29 10:17:48 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/coreutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20121

Added Files:
	coreutils-sort-compatibility.patch 
Log Message:
Add the patch.

coreutils-sort-compatibility.patch:
 NEWS       |    4 ++++
 src/sort.c |   53 +++++++++++++++++++++++++++++------------------------
 2 files changed, 33 insertions(+), 24 deletions(-)

--- NEW FILE coreutils-sort-compatibility.patch ---
--- coreutils-5.96/src/sort.c.sort-compatibility	2006-06-23 09:33:59.000000000 +0100
+++ coreutils-5.96/src/sort.c	2006-06-29 09:51:27.000000000 +0100
@@ -2784,37 +2784,42 @@
 	{
 	case 1:
 	  key = NULL;
-	  if (obsolete_usage && optarg[0] == '+')
+	  if (optarg[0] == '+')
 	    {
-	      /* Treat +POS1 [-POS2] as a key if possible; but silently
-		 treat an operand as a file if it is not a valid +POS1.  */
-	      key = new_key ();
-	      s = parse_field_count (optarg + 1, &key->sword, NULL);
-	      if (s && *s == '.')
-		s = parse_field_count (s + 1, &key->schar, NULL);
-	      if (! (key->sword | key->schar))
-		key->sword = SIZE_MAX;
-	      if (! s || *set_ordering (s, key, bl_start))
+	      bool minus_pos_usage = (optind != argc && argv[optind][0] == '-'
+				      && ISDIGIT (argv[optind][1]));
+	      obsolete_usage |= minus_pos_usage & ~posixly_correct;
+	      if (obsolete_usage)
 		{
-		  free (key);
-		  key = NULL;
-		}
-	      else
-		{
-		  if (optind != argc && argv[optind][0] == '-'
-		      && ISDIGIT (argv[optind][1]))
+		  /* Treat +POS1 [-POS2] as a key if possible; but silently
+		     treat an operand as a file if it is not a valid +POS1.  */
+		  key = new_key ();
+		  s = parse_field_count (optarg + 1, &key->sword, NULL);
+		  if (s && *s == '.')
+		    s = parse_field_count (s + 1, &key->schar, NULL);
+		  if (! (key->sword | key->schar))
+		    key->sword = SIZE_MAX;
+		  if (! s || *set_ordering (s, key, bl_start))
+		    {
+		      free (key);
+		      key = NULL;
+		    }
+		  else
 		    {
-		      char const *optarg1 = argv[optind++];
-		      s = parse_field_count (optarg1 + 1, &key->eword,
+		      if (minus_pos_usage)
+			{
+			  char const *optarg1 = argv[optind++];
+			  s = parse_field_count (optarg1 + 1, &key->eword,
 					     N_("invalid number after `-'"));
-		      if (*s == '.')
-			s = parse_field_count (s + 1, &key->echar,
+			  if (*s == '.')
+			    s = parse_field_count (s + 1, &key->echar,
 					       N_("invalid number after `.'"));
-		      if (*set_ordering (s, key, bl_end))
-			badfieldspec (optarg1,
+			  if (*set_ordering (s, key, bl_end))
+			    badfieldspec (optarg1,
 				      N_("stray character in field spec"));
+			}
+		      insertkey (key);
 		    }
-		  insertkey (key);
 		}
 	    }
 	  if (! key)
--- coreutils-5.96/NEWS.sort-compatibility	2006-06-23 09:33:59.000000000 +0100
+++ coreutils-5.96/NEWS	2006-06-29 09:51:27.000000000 +0100
@@ -46,6 +46,10 @@
   systems (which can be caused by shadowed mount points or by chrooted
   bind mounts) are now dummies, too.
 
+  sort now supports obsolete usages like "sort +1 -2" when conforming
+  to POSIX 1003.1-2001, since this is a pure extension to POSIX.
+  However, "sort +1" still sorts the file named "+1".
+
   stat's --format=FMT option now works the way it did before 5.3.0:
   FMT is automatically newline terminated.  The first stable release
   containing this change was 5.92.




More information about the fedora-cvs-commits mailing list