Hi folks,

Upstream have addressed the problems with `uname -a', `uname -i' and `uname -p' outputting 'unknown' for the processor type and hardware platform under Linux. I'd therefore like to take their patch and use it in LFS, so we're consistent with upstream. Note the following behaviours:

==========================
[vanilla coreutils-5.2.1]:

bash-3.00# uname -i
unknown
bash-3.00# uname -p
unknown
bash-3.00# uname -a
Linux kyoto 2.6.10-5-386 #1 Thu Sep 8 06:18:41 UTC 2005 i686 unknown unknown GNU/Linux
==========================

==========================
[coreutils-5.2.1 + current LFS patch]:

bash-3.00# uname -i
i386
bash-3.00# uname -p
athlon-4
bash-3.00# uname -a
Linux kyoto 2.6.10-5-386 #1 Thu Sep 8 06:18:41 UTC 2005 i686 athlon-4 i386 GNU/Linux
==========================

==========================
[coreutils-5.2.1 + upstream patch]:

bash-3.00# uname -i
unknown
bash-3.00# uname -p
unknown
bash-3.00# uname -a
Linux kyoto 2.6.10-5-386 #1 Thu Sep 8 06:18:41 UTC 2005 i686 GNU/Linux
==========================

The thread leading up to this patch starts at http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00053.html and the upstream patch can be found at http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00053.html. I've attached the proposed LFS patch to this message.

Regards,

Matt.
Submitted By: Matthew Burgess <matthew at linuxfromscratch dot org>
Date: 2005-09-17
Initial Package Version: 5.2.1
Upstream Status: From Upstream
Origin: http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00053.html
Description: Document the fact that '-i' and '-p' may report "unknown".
             Omit the '-i' and '-p' output from '-a' if they are unknown.

diff -Naur coreutils-5.2.1.orig/doc/coreutils.texi coreutils-5.2.1/doc/coreutils.texi
--- coreutils-5.2.1.orig/doc/coreutils.texi	2004-03-10 17:50:52.000000000 +0000
+++ coreutils-5.2.1/doc/coreutils.texi	2005-09-17 13:02:16.461143384 +0000
@@ -11363,7 +11363,8 @@
 @itemx --all
 @opindex -a
 @opindex --all
-Print all of the below information.
+Print all of the below information, except omit the processor type
+and the hardware platform if they are unknown.
 
 @item -i
 @itemx --hardware-platform
diff -Naur coreutils-5.2.1.orig/src/uname.c coreutils-5.2.1/src/uname.c
--- coreutils-5.2.1.orig/src/uname.c	2004-01-21 22:27:02.000000000 +0000
+++ coreutils-5.2.1/src/uname.c	2005-09-17 13:01:28.880376760 +0000
@@ -110,7 +110,8 @@
       fputs (_("\
 Print certain system information.  With no OPTION, same as -s.\n\
 \n\
-  -a, --all                print all information, in the following order:\n\
+  -a, --all                print all information, in the following order,\n\
+                             except omit -p and -i if unknown:\n\
   -s, --kernel-name        print the kernel name\n\
   -n, --nodename           print the network node hostname\n\
   -r, --kernel-release     print the kernel release\n\
@@ -118,8 +119,8 @@
       fputs (_("\
   -v, --kernel-version     print the kernel version\n\
   -m, --machine            print the machine hardware name\n\
-  -p, --processor          print the processor type\n\
-  -i, --hardware-platform  print the hardware platform\n\
+  -p, --processor          print the processor type or \"unknown\"\n\
+  -i, --hardware-platform  print the hardware platform or \"unknown\"\n\
   -o, --operating-system   print the operating system\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
@@ -166,7 +167,7 @@
 	  break;
 
 	case 'a':
-	  toprint = -1;
+	  toprint = UINT_MAX;
 	  break;
 
 	case 's':
@@ -260,7 +261,8 @@
 	    element = processor;
 	}
 #endif
-      print_element (element);
+      if (! (toprint == UINT_MAX && element == unknown))
+        print_element (element);
     }
 
   if (toprint & PRINT_HARDWARE_PLATFORM)
@@ -284,7 +286,8 @@
 	    element = hardware_platform;
 	}
 #endif
-      print_element (element);
+      if (! (toprint == UINT_MAX && element == unknown))
+        print_element (element);
     }
 
   if (toprint & PRINT_OPERATING_SYSTEM)
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to