From: Alexander Holler <holler@ahsoftware.de>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Alexander Holler <holler@ahsoftware.de>
Subject: [PATCH v2] initramfs: print error and shell out for unsupported content
Date: Thu, 20 Mar 2014 23:00:45 +0100 [thread overview]
Message-ID: <1395352845-7435-1-git-send-email-holler@ahsoftware.de> (raw)
In-Reply-To: <CAAsK9AEeobOG1j6NHUoqkZaZ5h8GGK_fL+gyh9MhSvguQjyU_w@mail.gmail.com>
The initramfs generation is broken for file and directory names which contain
colons or spaces. Print an error and don't try to continue.
Tests:
cd linux
make defconfig
echo 'CONFIG_BLK_DEV_INITRD=y' >> .config
echo 'CONFIG_INITRAMFS_ROOT_UID=0' >>.config
echo 'CONFIG_INITRAMFS_ROOT_GID=0' >>.config
echo 'CONFIG_INITRAMFS_COMPRESSION_NONE=y' >>.config
echo 'CONFIG_INITRAMFS_SOURCE="/tmp/bugroot"' >>.config
Problem with colons:
mkdir -p /tmp/bugroot/a:b
make -j4 bzImage # no error
make bzImage # try again, oops
Problem with spaces:
mkdir -p /tmp/bugroot/a\ b
make -j4 bzImage # no error
zcat usr/initramfs_data.cpio.gz | cpio --extract --list # oops, no content
Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
Silly and trivial changes in v2: Fixed a typo and added 'colons and spaces'
scripts/gen_initramfs_list.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 17fa901..8f4c145 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -171,6 +171,18 @@ dir_filelist() {
${dep_list}header "$1"
srcdir=$(echo "$1" | sed -e 's://*:/:g')
+
+ # Files and directories with spaces and colons are unsupported.
+ local unsupported=$(find "${srcdir}" -regex '.*\(:\| \).*')
+ if [ ! -z "${unsupported}" ]; then
+ printf "ERROR: Unable to handle files/directories with " >&2
+ printf "unsupported characters (spaces and colons).\n" >&2
+ printf "Please use other ways to generate a cpio-archive. " >&2
+ printf "Unsupported files and directories are:\n" >&2
+ printf "$unsupported\n" >&2
+ exit 1
+ fi
+
dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n")
# If $dirlist is only one line, then the directory is empty
--
1.8.3.1
next prev parent reply other threads:[~2014-03-20 22:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 21:35 [PATCH] initramfs: print error and shell out for unsupported content Alexander Holler
2014-03-20 21:43 ` Levente Kurusa
2014-03-20 22:00 ` Alexander Holler [this message]
2014-03-20 22:25 ` [PATCH v2] " Alexander Holler
2014-03-21 21:03 ` Andrew Morton
2014-03-21 22:49 ` Alexander Holler
2014-03-21 22:55 ` Andrew Morton
2014-03-21 23:07 ` Alexander Holler
2014-03-22 9:53 ` Alexander Holler
2014-03-22 12:29 ` [PATCH 1/2] initramfs: don't include filenames from the initramfs for make goals (dist)clean Alexander Holler
2014-03-22 12:29 ` [PATCH 2/2 v3] initramfs: print error and shell out for unsupported content Alexander Holler
2014-03-22 18:22 ` Alexander Holler
2014-03-31 20:31 ` Michal Marek
2014-04-01 11:23 ` Alexander Holler
2014-04-01 12:23 ` Michal Marek
2014-04-01 17:52 ` Alexander Holler
2014-10-19 7:18 ` [PATCH 1/2 v4] initramfs: don't include filenames from the initramfs for make goals (dist)clean Alexander Holler
2014-10-19 7:18 ` [PATCH 2/2 v4] initramfs: print error and shell out for unsupported content Alexander Holler
2014-03-26 21:16 ` [PATCH v2] " Alexander Holler
2014-03-26 21:38 ` Levente Kurusa
2014-03-26 21:55 ` Alexander Holler
2014-03-26 22:37 ` Alexander Holler
2014-03-27 8:25 ` Alexander Holler
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=1395352845-7435-1-git-send-email-holler@ahsoftware.de \
--to=holler@ahsoftware.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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.