[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#680676: unblock: busybox/1:1.20.0-5



Package: release.debian.org
User: release.debian.org@packages.debian.org
Usertags: unblock
Severity: normal

Please unblock package busybox

There are two goals here.  First, this release updates busybox to be
the same as the current upstream _bugfix_ release, adding another
bugfix (more about it below), renaming a patch accepted upstream,
and bumping minor version number.  And second, there are 2 serious
bugfixes, one of which was quite difficult to debug and affects
external users.  While at it, I'm also fixing a small bug in the
d-i environment.  This is a summary, detailed below.

The bugs in question are:


#679377 - http://bugs.debian.org/679377
busybox awk segfaults when called from ash and no PATH set
(eg initramfs /init)

This one was difficult to debug, it is about busybox awk segfaulting
in "unusual" environment.  Currently it affects various live
distributions and may affect some packages which adds initramfs hooks
(so the bug may made the system unbootable).  The cause of this bug,
and the fix, are both rather obscure, but it is the best I can do
now.  Full details are in the patch description
(shell-ash-export-HOME.patch), together with the details about
original issue, reasons why it is fixed this way and comments about
the future.


#680342 - http://bugs.debian.org/679377
xargs applet does not implement basic POSIX-specified features

This bug is filed by me when I discovered that random scripts
provided by Debian fails randomly when busybox ash is used to
run them (and ash executes busybox applets directly instead of
searching utils in $PATH, so most commands are from busybox).
For example, invoke-rc.d fails because it uses xargs to strip 
ouble quotes from lists of filenames, this is one of basic
POSIX requiriments, but I forgot to enable this option in
busybox.  The same is true for a very commonly used xargs -0,
which I also forgot to enable when enabled the obvious cousin
of it, find -print0.

Now, the nature of busybox is such that it is easy to en/disable
options like this - it affects only the applet in question and
no other applet is affected.  The resulting xargs applet passes
all tests in busybox itself and a few external testsuites, except
of a few other, more obscure, options also specified by POSIX.


#406114 - http://bugs.debian.org/406114
d-i: having a tool like ping

This is a wishlist bug.  The change merely enables ping applet
(adding 613 bytes to the executable) for Debian Installer
environment.  Since network install is very important, and
since nowadays people often have some obscure environments
to install (eg, installing over a wireless connection, or
using a network card which needs a firmware, etc), at least
some minimal/basic network debugging tool is desirable.  This
is exactly what this change does.  This bugreport is here since
Jan-2008, ie, for 4.5 years already.

Again, it is easy in busybox to enable/disable applets without
affecting other functionality.  Ping applet itself is enabled
in regular busybox build since forever.



Now, while I was at vacation, upstream released another bugfix
or stable version of busybox, numbered 1.20.2.  It is the same
as was in debian package 1.20.0-4, except of 3 differences:


1.  Upstream applied a patch I sent them, and added it to be
 applied to 1.20.1 version, but the filename of the patch is
 different.  In 1.20.0-4 Debian package, it was named
 ps-get-uptime.patch, upstream name is busybox-1.20.1-ps.patch,
 as shown at http://busybox.net/downloads/fixes-1.20.1/ .  The
 content of the two patches is the same, with the minor difference
 in line offsets.

2.  Upstream added another patch, fixing mke2fs utility.  The
 upstream commit is here:
   http://git.busybox.net/busybox/commit/?id=c9a13116a4497f4597ad5db6eb3cac9680fd6fc4
 and http://busybox.net/downloads/fixes-1.20.1/busybox-1.20.1-mke2fs.patch
 (the same patch, for stable series).
 There's a bug in busybox mke2fs utility, so that current ext4 driver
 in kernel does not accept filesystems created by busybox.

 mke2fs applet is only enabled in busybox static build, so the
 whole issue is not that important, but it'd be a shame to ship
 a known-buggy version.  Also, since this applet is only shipped
 in busybox static build, this is a low-risk change.

 There's no bug for this filed against Debian, but I can do that
 since the bug is real and the fix actually fixes it.

3.  With the two changes above, plus a few other bugfixes from
 upstream 1.20.1 stable series
 (http://busybox.net/downloads/fixes-1.20.1/ ), the resulting Debian
 busybox package is the same as upstream 1.20.2 stable/bugfix release,
 with all patches for it taken directly from upstream, with only one
 trivial change left: the minor version number.

This set of changes - to include all changes in upstream stable/bugfix
1.20.2 release - is more cosmetic (except of the mkfs patch which fixes
actual bug), but is very small and does not affect anything.



The whole debdiff between current version in wheezy - 1.20.0-4 - and
the proposed 1.20.0-5 - is below.

P.S.  This is my first unblock request, so I'm not yet sure how to do
it all properly.

Thank you for your time!


unblock busybox/1:1.20.0-5

------- debdiff -------
diff -Nru busybox-1.20.0/debian/changelog busybox-1.20.0/debian/changelog
--- busybox-1.20.0/debian/changelog	2012-06-12 22:06:01.000000000 +0400
+++ busybox-1.20.0/debian/changelog	2012-07-08 01:37:33.000000000 +0400
@@ -1,3 +1,25 @@
+busybox (1:1.20.0-5) unstable; urgency=low
+
+  * enable various xargs features for all flavours, to make it work
+    as POSIX requires (notable quotes and backslash processing).
+    Also enable -0 option, apparently forgotten at the time (it
+    complements find -print0 which is enabled).  (Closes: #680342)
+  * replace my ps-get-uptime.patch with busybox-1.20.1-ps.patch
+    (it is the same patch, just file formatting changed and it
+    is now obvios the patch is applied upstream)
+  * added another upstream bugfix patch, busybox-1.20.1-mke2fs.patch,
+    to fix mkfs.ext2 breakage.  It is only used in static flavour in
+    debian, but producing broken filesystem isn't an option there too.
+  * busybox-1.20.1-1.20.2.patch -- change version to 1.20.2.  This is
+    the only remaining change to upstream 1.20.2 stable release.
+  * enable ping applet for udeb build, +613 bytes on i386.  (Closes: #406114)
+  * update shell-ash-export-HOME.patch - DEP-3 headers and a long
+    description.  This patch now removes "const" modifier from the
+    default PATH variable definition, making it writable.  Full
+    description is within the patch comments. (Closes: #679377)
+
+ -- Michael Tokarev <mjt@tls.msk.ru>  Sun, 08 Jul 2012 01:37:18 +0400
+
 busybox (1:1.20.0-4) unstable; urgency=low
 
   * ps-get-uptime.patch: make procps/ps.c compilable on non-linux again
diff -Nru busybox-1.20.0/debian/config/pkg/deb busybox-1.20.0/debian/config/pkg/deb
--- busybox-1.20.0/debian/config/pkg/deb	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/config/pkg/deb	2012-07-06 11:54:06.000000000 +0400
@@ -417,10 +417,10 @@
 CONFIG_FEATURE_GREP_FGREP_ALIAS=y
 CONFIG_FEATURE_GREP_CONTEXT=y
 CONFIG_XARGS=y
-# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
 
 #
 # Init Utilities
diff -Nru busybox-1.20.0/debian/config/pkg/static busybox-1.20.0/debian/config/pkg/static
--- busybox-1.20.0/debian/config/pkg/static	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/config/pkg/static	2012-07-06 11:54:06.000000000 +0400
@@ -417,10 +417,10 @@
 CONFIG_FEATURE_GREP_FGREP_ALIAS=y
 CONFIG_FEATURE_GREP_CONTEXT=y
 CONFIG_XARGS=y
-# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
 
 #
 # Init Utilities
diff -Nru busybox-1.20.0/debian/config/pkg/udeb busybox-1.20.0/debian/config/pkg/udeb
--- busybox-1.20.0/debian/config/pkg/udeb	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/config/pkg/udeb	2012-07-06 19:21:26.000000000 +0400
@@ -413,10 +413,10 @@
 # CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
 # CONFIG_FEATURE_GREP_CONTEXT is not set
 # CONFIG_XARGS is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
-# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not=y
+CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not=y
+CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
 
 #
 # Init Utilities
@@ -725,7 +725,7 @@
 CONFIG_NC_SERVER=y
 CONFIG_NC_EXTRA=y
 # CONFIG_NC_110_COMPAT is not set
-# CONFIG_PING is not set
+CONFIG_PING=y
 # CONFIG_PING6 is not set
 # CONFIG_FEATURE_FANCY_PING is not set
 # CONFIG_WHOIS is not set
diff -Nru busybox-1.20.0/debian/patches/busybox-1.20.1-1.20.2.patch busybox-1.20.0/debian/patches/busybox-1.20.1-1.20.2.patch
--- busybox-1.20.0/debian/patches/busybox-1.20.1-1.20.2.patch	1970-01-01 03:00:00.000000000 +0300
+++ busybox-1.20.0/debian/patches/busybox-1.20.1-1.20.2.patch	2012-07-06 19:21:19.000000000 +0400
@@ -0,0 +1,14 @@
+Subject: the only remaining difference between upstream 1.20.2 and 1.20.1
+
+This is upstream "stable series" change.
+
+--- busybox-1.20.1/Makefile
++++ busybox-1.20.2/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 1
+ PATCHLEVEL = 20
+-SUBLEVEL = 1
++SUBLEVEL = 2
+ EXTRAVERSION =
+ NAME = Unnamed
+ 
diff -Nru busybox-1.20.0/debian/patches/busybox-1.20.1-mke2fs.patch busybox-1.20.0/debian/patches/busybox-1.20.1-mke2fs.patch
--- busybox-1.20.0/debian/patches/busybox-1.20.1-mke2fs.patch	1970-01-01 03:00:00.000000000 +0300
+++ busybox-1.20.0/debian/patches/busybox-1.20.1-mke2fs.patch	2012-07-06 19:21:12.000000000 +0400
@@ -0,0 +1,58 @@
+--- busybox-1.20.1/include/bb_e2fs_defs.h
++++ busybox-1.20.1-mke2fs/include/bb_e2fs_defs.h
+@@ -422,9 +422,27 @@ struct ext2_super_block {
+ 	uint16_t	s_reserved_word_pad;
+ 	uint32_t	s_default_mount_opts;
+ 	uint32_t	s_first_meta_bg;	/* First metablock group */
++	/* ext3 additions */
+ 	uint32_t	s_mkfs_time;		/* When the filesystem was created */
+ 	uint32_t	s_jnl_blocks[17];	/* Backup of the journal inode */
+-	uint32_t	s_reserved[172];	/* Padding to the end of the block */
++	/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
++/*150*/	uint32_t	s_blocks_count_hi;	/* Blocks count */
++	uint32_t	s_r_blocks_count_hi;	/* Reserved blocks count */
++	uint32_t	s_free_blocks_count_hi;	/* Free blocks count */
++	uint16_t	s_min_extra_isize;	/* All inodes have at least # bytes */
++	uint16_t	s_want_extra_isize; 	/* New inodes should reserve # bytes */
++	uint32_t	s_flags;		/* Miscellaneous flags */
++	uint16_t	s_raid_stride;		/* RAID stride */
++	uint16_t	s_mmp_interval;		/* # seconds to wait in MMP checking */
++	uint64_t	s_mmp_block;		/* Block for multi-mount protection */
++	uint32_t	s_raid_stripe_width;	/* blocks on all data disks (N*stride)*/
++	uint8_t		s_log_groups_per_flex;	/* FLEX_BG group size */
++	uint8_t		s_reserved_char_pad2;
++	uint16_t	s_reserved_pad;
++	uint32_t	s_reserved[162];	/* Padding to the end of the block */
++};
++struct BUG_ext2_super_block {
++        char bug[sizeof(struct ext2_super_block) == 1024 ? 1 : -1];
+ };
+ 
+ /*
+--- busybox-1.20.1/util-linux/mkfs_ext2.c
++++ busybox-1.20.1-mke2fs/util-linux/mkfs_ext2.c
+@@ -53,11 +53,6 @@
+ #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0
+ #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX    1
+ 
+-// from e2fsprogs
+-#define s_reserved_gdt_blocks s_padding1
+-#define s_mkfs_time           s_reserved[0]
+-#define s_flags               s_reserved[22]
+-
+ #define EXT2_HASH_HALF_MD4       1
+ #define EXT2_FLAGS_SIGNED_HASH   0x0001
+ #define EXT2_FLAGS_UNSIGNED_HASH 0x0002
+@@ -482,8 +477,10 @@ int mkfs_ext2_main(int argc UNUSED_PARAM
+ 	STORE_LE(sb->s_magic, EXT2_SUPER_MAGIC);
+ 	STORE_LE(sb->s_inode_size, inodesize);
+ 	// set "Required extra isize" and "Desired extra isize" fields to 28
+-	if (inodesize != sizeof(*inode))
+-		STORE_LE(sb->s_reserved[21], 0x001C001C);
++	if (inodesize != sizeof(*inode)) {
++		STORE_LE(sb->s_min_extra_isize, 0x001c);
++		STORE_LE(sb->s_want_extra_isize, 0x001c);
++	}
+ 	STORE_LE(sb->s_first_ino, EXT2_GOOD_OLD_FIRST_INO);
+ 	STORE_LE(sb->s_log_block_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
+ 	STORE_LE(sb->s_log_frag_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
diff -Nru busybox-1.20.0/debian/patches/busybox-1.20.1-ps.patch busybox-1.20.0/debian/patches/busybox-1.20.1-ps.patch
--- busybox-1.20.0/debian/patches/busybox-1.20.1-ps.patch	1970-01-01 03:00:00.000000000 +0300
+++ busybox-1.20.0/debian/patches/busybox-1.20.1-ps.patch	2012-07-06 19:21:04.000000000 +0400
@@ -0,0 +1,84 @@
+--- busybox-1.20.1/procps/ps.c
++++ busybox-1.20.1-ps/procps/ps.c
+@@ -69,6 +69,31 @@
+ /* Absolute maximum on output line length */
+ enum { MAX_WIDTH = 2*1024 };
+ 
++#if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG
++static long get_uptime(void)
++{
++#ifdef __linux__
++	struct sysinfo info;
++	if (sysinfo(&info) < 0)
++		return 0;
++	return info.uptime;
++#elif 1
++	char buf[64];
++	long uptime;
++	if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0)
++		bb_perror_msg_and_die("can't read %s", "/proc/uptime");
++	buf[sizeof(buf)-1] = '\0';
++	sscanf(buf, "%l", &uptime);
++	return uptime;
++#else
++	struct timespec ts;
++	if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
++		return 0;
++	return ts.tv_sec;
++#endif
++}
++#endif
++
+ #if ENABLE_DESKTOP
+ 
+ #include <sys/times.h> /* for times() */
+@@ -197,8 +222,6 @@ static inline unsigned get_HZ_by_waiting
+ 
+ static unsigned get_kernel_HZ(void)
+ {
+-	//char buf[64];
+-	struct sysinfo info;
+ 
+ 	if (kernel_HZ)
+ 		return kernel_HZ;
+@@ -208,12 +231,7 @@ static unsigned get_kernel_HZ(void)
+ 	if (kernel_HZ == (unsigned)-1)
+ 		kernel_HZ = get_HZ_by_waiting();
+ 
+-	//if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0)
+-	//	bb_perror_msg_and_die("can't read %s", "/proc/uptime");
+-	//buf[sizeof(buf)-1] = '\0';
+-	///sscanf(buf, "%llu", &seconds_since_boot);
+-	sysinfo(&info);
+-	seconds_since_boot = info.uptime;
++	seconds_since_boot = get_uptime();
+ 
+ 	return kernel_HZ;
+ }
+@@ -635,7 +653,7 @@ int ps_main(int argc UNUSED_PARAM, char 
+ 	};
+ #if ENABLE_FEATURE_PS_LONG
+ 	time_t now = now;
+-	struct sysinfo info;
++	long uptime;
+ #endif
+ 	int opts = 0;
+ 	/* If we support any options, parse argv */
+@@ -695,7 +713,7 @@ int ps_main(int argc UNUSED_PARAM, char 
+ 		puts("S   UID   PID  PPID   VSZ   RSS TTY   STIME TIME     CMD");
+ #if ENABLE_FEATURE_PS_LONG
+ 		now = time(NULL);
+-		sysinfo(&info);
++		uptime = get_uptime();
+ #endif
+ 	}
+ 	else {
+@@ -727,7 +745,7 @@ int ps_main(int argc UNUSED_PARAM, char 
+ 				char tty[2 * sizeof(int)*3 + 2];
+ 				char *endp;
+ 				unsigned sut = (p->stime + p->utime) / 100;
+-				unsigned elapsed = info.uptime - (p->start_time / 100);
++				unsigned elapsed = uptime - (p->start_time / 100);
+ 				time_t start = now - elapsed;
+ 				struct tm *tm = localtime(&start);
+ 
diff -Nru busybox-1.20.0/debian/patches/ps-get-uptime.patch busybox-1.20.0/debian/patches/ps-get-uptime.patch
--- busybox-1.20.0/debian/patches/ps-get-uptime.patch	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/patches/ps-get-uptime.patch	1970-01-01 03:00:00.000000000 +0300
@@ -1,94 +0,0 @@
-Subject: use separate get_uptime() and make it work on non-linux too
-From: Michael Tokarev <mjt@tls.msk.ru>
-Forwarded: yes, https://bugs.busybox.net/show_bug.cgi?id=5300
-
-Create get_uptime() function in procps/ps.c, and use it rather than
-relying on linux-specific sysinfo() inline.
-
-Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
-
-index 4727b21..3a5af7c 100644
---- a/procps/ps.c
-+++ b/procps/ps.c
-@@ -69,6 +69,31 @@
- /* Absolute maximum on output line length */
- enum { MAX_WIDTH = 2*1024 };
- 
-+#if ENABLE_FEATURE_PS_TIME || ENABLE_FEATURE_PS_LONG
-+static long get_uptime(void)
-+{
-+#ifdef __linux__
-+	struct sysinfo info;
-+	if (sysinfo(&info) < 0)
-+		return 0;
-+	return info.uptime;
-+#elif 1
-+	char buf[64];
-+	long uptime;
-+	if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0)
-+		bb_perror_msg_and_die("can't read %s", "/proc/uptime");
-+	buf[sizeof(buf)-1] = '\0';
-+	sscanf(buf, "%l", &uptime);
-+	return uptime;
-+#else
-+	struct timespec ts;
-+	if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
-+		return 0;
-+	return ts.tv_sec;
-+#endif
-+}
-+#endif
-+
- #if ENABLE_DESKTOP
- 
- #include <sys/times.h> /* for times() */
-@@ -197,8 +222,6 @@ static inline unsigned get_HZ_by_waiting(void)
- 
- static unsigned get_kernel_HZ(void)
- {
--	//char buf[64];
--	struct sysinfo info;
- 
- 	if (kernel_HZ)
- 		return kernel_HZ;
-@@ -208,12 +231,7 @@ static unsigned get_kernel_HZ(void)
- 	if (kernel_HZ == (unsigned)-1)
- 		kernel_HZ = get_HZ_by_waiting();
- 
--	//if (open_read_close("/proc/uptime", buf, sizeof(buf)) <= 0)
--	//	bb_perror_msg_and_die("can't read %s", "/proc/uptime");
--	//buf[sizeof(buf)-1] = '\0';
--	///sscanf(buf, "%llu", &seconds_since_boot);
--	sysinfo(&info);
--	seconds_since_boot = info.uptime;
-+	seconds_since_boot = get_uptime();
- 
- 	return kernel_HZ;
- }
-@@ -635,7 +653,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
- 	};
- #if ENABLE_FEATURE_PS_LONG
- 	time_t now = now;
--	struct sysinfo info;
-+	long uptime;
- #endif
- 	int opts = 0;
- 	/* If we support any options, parse argv */
-@@ -695,7 +713,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
- 		puts("S   UID   PID  PPID   VSZ   RSS TTY   STIME TIME     CMD");
- #if ENABLE_FEATURE_PS_LONG
- 		now = time(NULL);
--		sysinfo(&info);
-+		uptime = get_uptime();
- #endif
- 	}
- 	else {
-@@ -727,7 +745,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
- 				char tty[2 * sizeof(int)*3 + 2];
- 				char *endp;
- 				unsigned sut = (p->stime + p->utime) / 100;
--				unsigned elapsed = info.uptime - (p->start_time / 100);
-+				unsigned elapsed = uptime - (p->start_time / 100);
- 				time_t start = now - elapsed;
- 				struct tm *tm = localtime(&start);
- 
diff -Nru busybox-1.20.0/debian/patches/series busybox-1.20.0/debian/patches/series
--- busybox-1.20.0/debian/patches/series	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/patches/series	2012-07-06 19:21:19.000000000 +0400
@@ -10,11 +10,11 @@
 u-mount-FreeBSD-support.patch
 swaponoff-FreeBSD-support.patch
 
-# FTBFS on non-linux
-ps-get-uptime.patch
-
 # upstream stable patches
 busybox-1.20.1-ash.patch
 busybox-1.20.1-ifupdown.patch
 busybox-1.20.1-man.patch
 busybox-1.20.1-tar.patch
+busybox-1.20.1-ps.patch
+busybox-1.20.1-mke2fs.patch
+busybox-1.20.1-1.20.2.patch
diff -Nru busybox-1.20.0/debian/patches/shell-ash-export-HOME.patch busybox-1.20.0/debian/patches/shell-ash-export-HOME.patch
--- busybox-1.20.0/debian/patches/shell-ash-export-HOME.patch	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/patches/shell-ash-export-HOME.patch	2012-07-08 01:31:08.000000000 +0400
@@ -1,6 +1,60 @@
+From: Joey Hess <joeyh@debian.org>
+Subject: busybox sh sets but does not export PATH
+Bug: http://bugs.debian.org/329406
+Bug: http://bugs.debian.org/679377
+Forwarded: no
+Date: Sun, 07 May 2006 14:47:16 -0700
+
+This patch exports $PATH variable from busybox ash by default,
+even if no "export PATH" statement has been processed.  No
+other shell (dash, bash, ...) does this:
+
+  $ env - /bin/bash -c /usr/bin/env
+  PWD=/tmp
+  SHLVL=1
+  _=/usr/bin/env
+
+But after #329406, busybox ash started exporting this variable
+by default.  This change hasn't been sent upstream.
+
+However, this turned out to be problematic, after many upstream
+changes, busybox started segfaulting in interesting and difficult
+to debug environments - like, when running as pid=1 in initramfs.
+This is recorded in #679377.
+
+The problem was that PATH was the only variable marked to be
+exported by default, and this is done by this very patch.  Other
+exported variables were always malloc'ed, but this one was not.
+But when ash executes applets marked as NOEXEC, it does not
+really execute anything, it forks and runs the applet's main()
+function, clearing and setting up the environment as it'd do
+for any other command.  There, it is assumed that all exported
+variables were malloc'ed, and the function (tryexec() in ash.c)
+writes to the place in exported variable where the equal sign
+is.  So, if ash inherited no PATH variable and the default is
+used, the code will try to write \0 into a constant location,
+and we'll get a segfault.
+
+The whole patch is probably not needed (because other shells
+don't export PATH by default), but at this stage (during wheezy
+freeze) we can't just drop it, since it may lead to some random
+breakage in some other random place (and that'll be another
+very difficult to debug issue).  So instead of dropping the
+patch, we modify the PATH variable to be stored in non-const
+location, ie, to be writable.  It is safe, since the only
+place which actually modifies this variable (after the first
+half of this patch) is the awk main function, during setup,
+it restores the overridden byte after touching it, and it
+is a "terminal" applet, ie, it exits after doing its work.
+
+For wheezy+1, we should drop this patch completely.  For
+now, we will live with this simple and ugly forkaround.
+
+/mjt
+
 --- a/shell/ash.c
 +++ b/shell/ash.c
-@@ -1897,7 +1897,7 @@ static const struct {
+@@ -1904,7 +1904,7 @@ static const struct {
  	{ VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL"      , changemail      },
  	{ VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH"  , changemail      },
  #endif
@@ -9,3 +63,25 @@
  	{ VSTRFIXED|VTEXTFIXED       , "PS1=$ "    , NULL            },
  	{ VSTRFIXED|VTEXTFIXED       , "PS2=> "    , NULL            },
  	{ VSTRFIXED|VTEXTFIXED       , "PS4=+ "    , NULL            },
+--- a/include/libbb.h
++++ b/include/libbb.h
+@@ -1727,7 +1727,7 @@ extern const char bb_path_wtmp_file[];
+ extern const char bb_busybox_exec_path[];
+ /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
+  * but I want to save a few bytes here */
+-extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
++extern char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
+ #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
+ #define bb_default_path      (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
+ 
+--- a/libbb/messages.c
++++ b/libbb/messages.c
+@@ -39,7 +39,7 @@ const char bb_busybox_exec_path[] ALIGN1
+ const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL;
+ /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
+  * but I want to save a few bytes here. Check libbb.h before changing! */
+-const char bb_PATH_root_path[] ALIGN1 =
++char bb_PATH_root_path[] ALIGN1 =
+ 	"PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH;
+ 
+ 
diff -Nru busybox-1.20.0/debian/udeb-sizes busybox-1.20.0/debian/udeb-sizes
--- busybox-1.20.0/debian/udeb-sizes	2012-06-12 22:04:46.000000000 +0400
+++ busybox-1.20.0/debian/udeb-sizes	2012-07-06 19:21:26.000000000 +0400
@@ -86,3 +86,11 @@
  310013	   1606	   8720	 320339	  4e353	busybox+nfs
 Very small NFS mount client, supporting NFSv2 and v3 only (no v4).
 Can be used for nfsroot, or accessing installation media over nfs.
+
+20120706 mjt i386 ping
+   text	   data	    bss	    dec	    hex	filename
+ 312015	   1638	   8712	 322365	  4eb3d	busybox
+ 312628	   1638	   8712	 322978	  4eda2	busybox+ping
+ping applet, useful for basic network debugging/testing, +613 bytes.
+Enable it.
+



Reply to: