All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] initramfs: print error and shell out for unsupported content
@ 2014-03-20 21:35 Alexander Holler
  2014-03-20 21:43 ` Levente Kurusa
  0 siblings, 1 reply; 23+ messages in thread
From: Alexander Holler @ 2014-03-20 21:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Alexander Holler

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>
---
 scripts/gen_initramfs_list.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 17fa901..aacf366 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -171,6 +171,17 @@ 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.\nPlease use other ways " >&2
+		printf "generate a cpio-archive.\nUnsupported files and " >&2
+		printf "directories are:\n$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


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

end of thread, other threads:[~2014-10-19  7:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH v2] " Alexander Holler
2014-03-20 22:25     ` 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

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.