All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] prepare-kernel.sh --default fails silently if no default patch can be found
@ 2010-10-12 12:10 Thomas De Schampheleire
  2010-10-14 22:27 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas De Schampheleire @ 2010-10-12 12:10 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

Hi,

If the prepare-kernel.sh script is executed with the --default option,
but no default patch can be found for the selected linux kernel
version, the script incorrectly tries to continue (and hangs executing
a malformed grep command)

If no default patch can be found, the $adeos_default_patch variable is
set /dev/null. This filename in this variable is later checked for
readability with 'test -r', which succeeds for /dev/null. This causes
the script to continue with an invalid patch, and subsequently hangs
on the following command:

adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' $asm_ipipe_h
2>/dev/null|head -n1|sed -e 's,.*"\(.*\)"$,\1,'`

where
asm_ipipe_h=`ls
$linux_tree/include/asm-{$linux_arch,$xenomai_arch}/ipipe.h
2>/dev/null|head -n1

But since the patch failed, $asm_ipipe_h is also empty, the grep
command translates to:
grep  ^#define.*IPIPE_ARCH_STRING.*"
so grep waits for input since no files are given, and the
prepare-kernel.sh script is effectively blocked (without useful
output).

Please find in attachment a patch that adds a check for /dev/null
instead of simply 'test -r', and adds some output in case no default
patch could be found.

Best regards,
Thomas

[-- Attachment #2: xenomai-05-improve-output-of-prepare-kernel-script.patch --]
[-- Type: application/octet-stream, Size: 931 bytes --]

--- xenomai-2.5.4.orig/scripts/prepare-kernel.sh	2010-05-18 20:31:17.000000000 +0200
+++ xenomai-2.5.4/scripts/prepare-kernel.sh	2010-10-12 13:22:45.250141715 +0200
@@ -373,6 +373,9 @@
       default_adeos_patch="`( ls $xenomai_root/ksrc/arch/$xenomai_arch/patches/adeos-ipipe-$linux_version*-{$linux_arch,$xenomai_arch}-*|sort -r ) 2>/dev/null | head -n1`"
    fi
    if test x$default_adeos_patch = x; then
+      if test x$verbose = x1; then
+         echo "$me: no default Adeos patch found." >&2
+      fi
       default_adeos_patch=/dev/null
    fi
    while test x$adeos_patch = x; do
@@ -383,7 +386,7 @@
       if test x$adeos_patch = x; then
          adeos_patch=$default_adeos_patch
       fi
-      if test \! -r "$adeos_patch"; then
+      if test \! -r "$adeos_patch" -o x$adeos_patch = x/dev/null; then
          echo "$me: cannot read Adeos patch from $adeos_patch" >&2
          usedefault=
          adeos_patch=

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai-core] prepare-kernel.sh --default fails silently if no default patch can be found
  2010-10-12 12:10 [Xenomai-core] prepare-kernel.sh --default fails silently if no default patch can be found Thomas De Schampheleire
@ 2010-10-14 22:27 ` Gilles Chanteperdrix
  0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2010-10-14 22:27 UTC (permalink / raw)
  To: Thomas De Schampheleire; +Cc: xenomai

Thomas De Schampheleire wrote:
> Please find in attachment a patch that adds a check for /dev/null
> instead of simply 'test -r', and adds some output in case no default
> patch could be found.

Applied, thanks.

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-14 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-12 12:10 [Xenomai-core] prepare-kernel.sh --default fails silently if no default patch can be found Thomas De Schampheleire
2010-10-14 22:27 ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.