Floris Bos | 19 Apr 00:28 2015

[PATCH] mdev: do not remove device nodes from devtmpfs

Upon receiving notice of the removal of a device check if /dev is
using devtmpfs. If so, do not remove the device node file, but
let devtmpfs take care of that.

Solves the following problem:

The kernel sometimes sends a REMOVE and ADD event after each other,
for example after a partition is added to storage, and the partition
table is re-read.
When letting mdev delete device node files, there is a high
probability that it processes the two events out-of-order
resulting in the unjust removal of device node files.
Devtmpfs is not affected by that, and if deletion is really
justified will do so anyway, so is the better choice for
this particular task.

Signed-off-by: Floris Bos <bos <at> je-eigen-domein.nl>
 util-linux/mdev.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index ccc00d3..f58e76f 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
 <at>  <at>  -98,6 +98,7  <at>  <at> 

 #include "libbb.h"
 #include "xregex.h"
+#include <mntent.h>
(Continue reading)

Floris Bos | 18 Apr 17:05 2015

Letting mdev + devtmpfs play together?


I was wondering if it is possible to configure mdev NOT to add and 
remove device nodes, and let devtmpfs handle that part instead?

The problem I am having is that after adding a new partition to storage, 
the kernel sends both hotplug events REMOVING and ADDING the partition node.
However often they are processed out of order, and "remove" is processed 
after "add" making the new partition node disappear:

mdev[598]: 9.191594 ACTION:add SUBSYSTEM:block DEVNAME:mmcblk0p6 
mdev[598]: dev 179,6
mdev[593]: 9.192168 ACTION:remove SUBSYSTEM:block DEVNAME:mmcblk0p6 
mdev[593]: rule matched, line -1
mdev[593]: unlink: mmcblk0p6

I tried enabling waiting for sequence numbers by echoing a newline to 
/dev/mdev.seq, however I noticed there are situations where that does 
not work properly either.

mdev[527]: first seq written
mdev[527]: 2.902914 ACTION:add SUBSYSTEM:usb DEVNAME:(null) 
mdev[526]: 2.902980 waiting for '527'
(Continue reading)

Felix Fietkau | 17 Apr 01:58 2015

[PATCH] ash: fix a regression in handling local variables

commit 109ee5d33694a03cda3424b4846584250832ba8e
"ash: make "locak VAR" unset VAR (bash does that)"

This commit introduced a regression where calling local on an already
local variable unsets it. This does not match bash behavior.

Update test case to check for this behavior

Signed-off-by: Felix Fietkau <nbd <at> openwrt.org>
 shell/ash.c                          | 17 ++++++++++++++++-
 shell/ash_test/ash-misc/local1.right |  5 +++--
 shell/ash_test/ash-misc/local1.tests |  7 +++++--
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index b568013..c95bd67 100644
--- a/shell/ash.c
+++ b/shell/ash.c
 <at>  <at>  -8958,6 +8958,21  <at>  <at>  parse_command_args(char **argv, const char **path)

+static bool
+findlocal(struct var *vp)
+	struct localvar *lvp = localvars;
+	while (lvp) {
+		if (lvp->vp == vp)
(Continue reading)

Bartosz Golaszewski | 15 Apr 13:43 2015

[PATCH v2] build system: allow users to select the optimization mode

In some scenarios busybox performance may be prefered over its
small size.

Allow users to select the compiler optimization level by adding
appropriate config options.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
version 2:
- make the choice simplier for less advanced users by leaving only
  the choice between optimization for speed and optimization for
  size (default)

version 1:

 Config.in      | 25 +++++++++++++++++++++++++
 Makefile.flags | 10 +++++-----
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/Config.in b/Config.in
index 07b4bf3..227fc78 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -514,6 +514,31  <at>  <at>  config PIE

 	  Most people will leave this set to 'N'.

+	prompt "Compiler optimization"
(Continue reading)

Bartosz Golaszewski | 15 Apr 12:15 2015

[PATCH] build system: allow users to select the optimization level

In some scenarios busybox performance may be prefered over its
small size.

Allow users to select the compiler optimization level by adding
appropriate config options.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
 Config.in      | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 Makefile.flags | 16 ++++++++++------
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/Config.in b/Config.in
index 07b4bf3..9a237b9 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -514,6 +514,56  <at>  <at>  config PIE

 	  Most people will leave this set to 'N'.

+	prompt "Compiler optimization level"
+	default OPTIMIZE_S
+	help
+	  Set the optimization level for the compiler.
+config OPTIMIZE_S
+	bool "Optimize for size"
+	help
+	  Optimize for size. -Os enables all -O2 optimizations that do
(Continue reading)

Bernhard Reutner-Fischer | 15 Apr 01:35 2015

[PATCH 0/1] sed address ranges with /x/,+N

Hi there!

I've stumbled across a script from a user that uses the newish +N
address as address2 of a sed range.

First pass attempt +180b which sounds a bit too elaborate for this
Any takers?

Bernhard Reutner-Fischer (1):
  sed: /regex/,+N ranges

 editors/sed.c       | 36 +++++++++++++++++++++++++++++++-----
 testsuite/sed.tests | 12 ++++++++++++
 2 files changed, 43 insertions(+), 5 deletions(-)


Greg Whiteley | 14 Apr 09:47 2015

Handling of CONFIG_EXTRA_LDFLAGS in submakes

Hi All,

I've run into trouble setting CONFIG_EXTRA_LDFLAGS in my config.  It is not honoured in some of the sub-make files (first failure is in applets).  In my specific case I'm selecting architecture-specific options that need to be consistent across all build/link steps (in this case endian-selection).

The handling of CONFIG_EXTRA_LDFLAGS defined in a defconfig seems to be different from the handling of CONFIG_EXTRA_(LDLIBS|CFLAGS).  Whereas CONFIG_EXTRA_CFLAGS is loaded into CFLAGS by Makefile.flags CONFIG_EXTRA_LDFLAGS is loaded into EXTRA_LDFLAGS.

Adding EXTRA_LDFLAGS to the list of exports in Makefile works around the problem for me and ensures that the the flags are available to sub-makes.

I thought it worth noting to you, since as far as I can tell EXTRA_LDFLAGS provides a slightly different service to LDFLAGS, and I'm not sure that my workaround would be generally applicable. I think a longer term fix might involve having different CONFIG_ options to override EXTRA_LDFLAGS separately to LDFLAGS.



busybox mailing list
busybox <at> busybox.net
Isaac Dunham | 13 Apr 19:15 2015

[RFC] mdev: support reading events from stdin, add features to mdev -s

Here's a patch series to add mdev -i and make mdev -s a little more
featureful, so rules like this one:
$MODALIAS=.*    root:root 660  <at> modprobe "$MODALIAS"
will work even with coldplug.

mdev -i reads hotplug events from stdin, in a format proposed by Laurent Bercot
wherein each "line" is terminated with '\0' (rather than '\n') and each event
is terminated by an additional '\0'.
Internally, each event is loaded into the environment (without copying) at
the start of handle_event(), then the environment is cleared before
handle_event() returns.
This is done instead of using a new key lookup method because helper
scripts rely extensively on environment variables; if we did not load
the events into the environment at some point, autoloading modules and
other important features would no longer work. 

The new mdev -s (FEATURE_MDEV_NEWSCAN) uses the same codepath as mdev -i
instead of calling make_device() directly.

Both mdev -i and the new mdev -s are compile-time options, separately

Patch 1 just moves the hotplug code into a separate function.
Patch 2 is ncopa's preliminary version of mdev -i.
Patch 3 is my work on mdev -i, including a config option to disable it.

Comments welcome.

Isaac Dunham
Leonid Fedorenchik | 13 Apr 12:54 2015

[PATCH] libb/remove_file.c: Use correct algorithm to delete directory

Following algorithm to delete directory is wrong:

	while (readdir()) unlink();

This is because it is unspecified which entry readdir() will return if
files were added/removed since the last call to opendir() or rewinddir():
Also, readdir() may buffer several directory entries per actual read
Because of all this, readdir() function may skip some entries if files
were added/removed to/from the directory and the delete directory will

This can be very easily verified with the following test:
In one terminal run command below:

	while true; do echo "aaa bbb ccc" >rand/$RANDOM.txt; done

And in the other terminal try to delete directory:

	busybox rm -rf rand

This will fail with the error:

	rm: can't remove 'rand': Directory not empty

(Of course we are talking about deleting non-empty directories now.)

The following algorithm is (one of) correct one(s):

	do {
		unlinked_files = 0;
		while (readdir()) {
			unlinked_files = 1;
		if (unlinked_files)
	} while (unlinked_files);

This commit corrects the algorithm to delete the directory.

Signed-off-by: Leonid Fedorenchik <leonid.fedorenchik <at> paragon-software.com>
 libbb/remove_file.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/libbb/remove_file.c b/libbb/remove_file.c
index eaca293..b609be9 100644
--- a/libbb/remove_file.c
+++ b/libbb/remove_file.c
 <at>  <at>  -51,16 +51,24  <at>  <at>  int FAST_FUNC remove_file(const char *path, int flags)
 			return -1;

-		while ((d = readdir(dp)) != NULL) {
-			char *new_path;
-			new_path = concat_subpath_file(path, d->d_name);
-			if (new_path == NULL)
-				continue;
-			if (remove_file(new_path, flags) < 0)
-				status = -1;
-			free(new_path);
-		}
+		int unlinked_files;
+		do {
+			unlinked_files = 0;
+			while ((d = readdir(dp)) != NULL) {
+				char *new_path;
+				new_path = concat_subpath_file(path, d->d_name);
+				if (new_path == NULL)
+					continue;
+				if (remove_file(new_path, flags) < 0)
+					status = -1;
+				free(new_path);
+				unlinked_files = 1;
+			}
+			if (unlinked_files) {
+				rewinddir(dp);
+			}
+		} while (unlinked_files);

 		if (closedir(dp) < 0) {
 			bb_perror_msg("can't close '%s'", path);



Best regards,
Leonid Fedorenchik

Software Engineer
Paragon Software Group
Skype: leonid.fedorenchik
Felix Fietkau | 9 Apr 10:20 2015

[PATCH] find: fix regression in status processing for path arguments

Regression added in commit 14158b4127dba30466c50147b868a6a89702960b
"find: add optional support for '-exec ... {} +'"

This commit causes find to exit on the first path argument that was not
found, which breaks existing scripts and is incompatible to other

Instead of exiting on the first failure, return EXIT_FAILURE at the end
if any error occurred.

Signed-off-by: Felix Fietkau <nbd <at> openwrt.org>
 findutils/find.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/findutils/find.c b/findutils/find.c
index 83aa63f..ced8922 100644
--- a/findutils/find.c
+++ b/findutils/find.c
 <at>  <at>  -1460,12 +1460,10  <at>  <at>  int find_main(int argc UNUSED_PARAM, char **argv)
 				NULL,           /* user data */
 				0)              /* depth */
 		) {
-			status = EXIT_FAILURE;
-			goto out;
+			status |= EXIT_FAILURE;

-	IF_FEATURE_FIND_EXEC_PLUS(status = flush_exec_plus();)
+	IF_FEATURE_FIND_EXEC_PLUS(status |= flush_exec_plus();)
 	return status;

walter harms | 9 Apr 09:22 2015

Re: awk in busybox-1.22.1 will crash if compiled without -O2

Am 09.04.2015 05:57, schrieb mwjian:
> On  PowerPC P1010RDB board, If busybox compiled with default optimization option -Os, run " echo "Hello
world" | awk '{ printf $1 }' ", awk will crash. 
> busybox[1131]: unhandled signal 11 at 395fffb4 nip 1005b344 lr 1005b38c code 30001
> Segmentation fault
> But with optimization option -O2, awk works fine.

This points into the direction of the compiler.
Did you contact the maintainer ?

busybox mailing list
busybox <at> busybox.net