OpenSolaris

Printable Version Enter a New Search
Bug ID 6518626
Synopsis create_ramdisk fails to create new boot archives in "de" locale
State 10-Fix Delivered (Fix available in build)
Category:Subcategory kernel:boot-x86
Keywords opensolaris | request-sponsor
Responsible Engineer Jan Setje-eilers
Reported Against snv_57 , snv_58
Duplicate Of
Introduced In solaris_nevada
Commit to Fix snv_59
Fixed In snv_59
Release Fixed solaris_nevada(snv_59)
Related Bugs
Submit Date 29-January-2007
Last Update Date 2-March-2007
Description
Category
   kernel
Sub-Category
   boot-x86
Description
   In the "de" locale, /boot/solaris/bin/create_ramdisk fails to create
new boot archives:
# locale
LANG=de_DE.ISO8859-1
LC_CTYPE=de_DE.ISO8859-1
LC_NUMERIC=de_DE.ISO8859-1
LC_TIME=de_DE.ISO8859-1
LC_COLLATE=de_DE.ISO8859-1
LC_MONETARY=de_DE.ISO8859-1
LC_MESSAGES=de_DE.ISO8859-1
LC_ALL=
# /boot/solaris/bin/create_ramdisk
updating /platform/i86pc/amd64/boot_archive...this may take a minute
updating /platform/i86pc/boot_archive...this may take a minute
update of /platform/i86pc/boot_archive failed
update of /platform/i86pc/amd64/boot_archive failed
# update of /platform/i86pc/boot_archive failed
The new boot archive is too small:
# ls -l /platform/i86pc/
Gesamt 38334
drwxr-xr-x   2 root     sys          512 Jan 27 18:17 amd64
-rwxr-xr-x   1 root     sys         2560 Jan 12 19:51 biosint
drwxr-xr-x   2 root     other        512 Jan 27 12:17 boot
-rw-r--r--   1 root     root     18771968 Jan 27 18:15 boot_archive
-rw-r--r--   1 root     root      780288 Jan 27 18:17 boot_archive-new
drwxr-xr-x  11 root     sys          512 Jan 27 01:49 kernel
-rwxr-xr-x   1 root     sys        24904 Jan 27 01:49 multiboot
Root cause:  create_ramdisk parses "file" output, but the output of
"file" changes, depending on the locale.  create_ramdisk expects to
find the string "ELF 32-bit" or "ELF 64-bit" in file output, but in
the "de" locale, file output is a bit different (Note: 32-bit <> 32-Bit):
# env LC_ALL=C file /platform/i86pc/kernel/drv/pci-ide
/platform/i86pc/kernel/drv/pci-ide:     ELF 32-bit LSB relocatable 80386 Version 1
# env LC_ALL=de file /platform/i86pc/kernel/drv/pci-ide
/platform/i86pc/kernel/drv/pci-ide:     ELF 32-Bit LSB verschiebbar 80386 Version 1
Frequency
   Always
Regression
   Solaris 10
Steps to Reproduce
   Run /boot/solaris/bin/create_ramdisk in the "de" locate.
Expected Result
   New /platform/i86pc/boot_archive and /platform/i86pc/amd64/boot_archive
is created.
Actual Result
   Boot archives are not updated.
Error Message(s)
   updating /platform/i86pc/amd64/boot_archive...this may take a minute
updating /platform/i86pc/boot_archive...this may take a minute
update of /platform/i86pc/boot_archive failed
update of /platform/i86pc/amd64/boot_archive failed
Test Case
   
Workaround
   Run create_ramdisk in the "C" locale,
  env LC_ALL=C /boot/solaris/bin/create_ramdisk
Suggested fix:
==============
Make sure to force english output from the "file" utility, when we're
going to parse its output:
diff -r dedb78f8feae usr/src/cmd/boot/scripts/create_ramdisk.ksh
--- a/usr/src/cmd/boot/scripts/create_ramdisk.kshThu Jan 25 22:52:34 2007 -0800
+++ b/usr/src/cmd/boot/scripts/create_ramdisk.kshSat Jan 27 18:46:56 2007 +0100
@@ -164,7 +164,7 @@ function create_ufs
 if [ "$which" = "both" ]; then
 files="$files $path"
 else
-filetype=`file $path 2>/dev/null |\
+filetype=`LC_MESSAGES=C file $path 2>/dev/null |\
     awk '/ELF/ { print \$3 }'`
 if [ -z "$filetype" ] || [ "$filetype" = "$which" ]
 then
@@ -239,7 +239,7 @@ function create_isofs
 if [ "$which" = "both" ]; then
 files="$files $path"
 else
-filetype=`file $path 2>/dev/null |\
+filetype=`LC_MESSAGES=C file $path 2>/dev/null |\
     awk '/ELF/ { print \$3 }'`
 if [ -z "$filetype" ] || [ "$filetype" = "$which" ]
 then
@@ -316,7 +316,7 @@ function create_archive
 # the file type check also establishes that the
 # file exists at all
 #
-file "${archive}-new" | grep gzip > /dev/null
+LC_MESSAGES=C file "${archive}-new" | grep gzip > /dev/null
 fi
 
 if [ $? = 1 ] && [ -x /usr/bin/gzip ] || [ $ARCHIVE_SIZE -lt 5000 ]
Submitter wants to work on bug
   Yes
Additional configuration information
   snv_55b, bfu'ed to opensolaris 2007-01-26
This happens also with Swedish locale
Work Around
N/A
Comments
N/A