From: Harald Hoyer <harald.hoyer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Will Woods <wwoods-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] Fix "can't shift that many" crash with empty /proc/cmdline
Date: Tue, 17 May 2011 10:33:16 +0200 [thread overview]
Message-ID: <4DD232CC.80402@gmail.com> (raw)
In-Reply-To: <1305587877-14485-1-git-send-email-wwoods-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Am 17.05.2011 01:17, schrieb Will Woods:
> If /proc/cmdline is empty (like if root=... is set in /etc/cmdline),
> modules.d/99base/init will crash with a message saying "can't shift that
> many" right before switch_root. The problem is in the block of code that
> tries to look for init args. It does something like:
>
> read CMDLINE </proc/cpuinfo
> [...]
> set $CMDLINE
> shift
>
> If CMDLINE="" then "set $CMDLINE" will dump all the variables to stdout.
> (That should be "set -- $CMDLINE" instead.) Since there's no $1, the
> "shift" causes an error, and dracut crashes.
>
> The 'shift' was copy-and-pasted from the previous block. It doesn't
> belong here; remove it.
>
> Signed-off-by: Will Woods <wwoods-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> modules.d/99base/init | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/modules.d/99base/init b/modules.d/99base/init
> index e2c34c7..87778ac 100755
> --- a/modules.d/99base/init
> +++ b/modules.d/99base/init
> @@ -361,8 +361,8 @@ if getarg init= >/dev/null ; then
> ignoreargs="console BOOT_IMAGE"
> # only pass arguments after init= to the init
> CLINE=${CLINE#*init=}
> - set $CLINE
> - shift
> + set -- $CLINE
> + shift # clear out the rest of the "init=" arg
> for x in "$@"; do
> for s in $ignoreargs; do
> [ "${x%%=*}" = $s ] && continue 2
> @@ -372,8 +372,7 @@ if getarg init= >/dev/null ; then
> unset CLINE
> else
> set +x # Turn off debugging for this section
> - set $CLINE
> - shift
> + set -- $CLINE
> for x in "$@"; do
> case "$x" in
> [0-9]|s|S|single|emergency|auto ) \
Thanks! Pushed
prev parent reply other threads:[~2011-05-17 8:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-16 23:17 [PATCH] Fix "can't shift that many" crash with empty /proc/cmdline Will Woods
[not found] ` <1305587877-14485-1-git-send-email-wwoods-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-05-17 8:33 ` Harald Hoyer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DD232CC.80402@gmail.com \
--to=harald.hoyer-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wwoods-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.