William Larson | 23 Apr 23:43 2014
Picon

cp command issue

Hello I am using a very old embedded system with linux 2.4 compiled with gcc 2.95.3

I compiled busybox version 1.19 (2011 release) and I am noticing a strange phenomenon when using the cp command

I have a yaffs partition with a file i created via touch

touch SY
../busybox1.19 cp SY /mnt (mnt is a vfat formatted usb flash drive)

when i do this the case isn't preserved. i get a file lowercase 'sy' on the vfat drive

if i run the cp command with a leading lower-case letter such as aSY it works or if the file name is longer than 5 characters ie SYDATss it works.

But if it is shorter than 4 characters and starts with a capital the case isn't preserved

Any ideas?



--
-William Larson

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Julien Laffaye | 23 Apr 20:54 2014
Picon

ifconfig -a fails on my system...

... and this[1] patch I submitted a while ago seems to fix it.
So this email is just a HEADS UP, hoping to get comments about the patch 
and whether or not it could be included in future releases.

Regards,
Julien

[1]: https://bugs.busybox.net/show_bug.cgi?id=6932
Igor Živković | 23 Apr 20:10 2014
Picon

[PATCH] Add verbose switch to cp, mv and rm commands

Hi,

I have added functional verbose switch to a few Coreutils commands. As 
the bug #7046 submitter, I find it useful for logging and scripting 
purposes. If you are interested, I can do the rest of commands since the 
ignored switch is already in the code for compatibility reasons.

Signed-off-by: Igor Živković <contact <at> igor-zivkovic.from.hr>
diff --git a/coreutils/cp.c b/coreutils/cp.c
index de2e512..d4ec626 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
 <at>  <at>  -31,6 +31,7  <at>  <at> 
 //usage:     "\n	-f	Overwrite"
 //usage:     "\n	-i	Prompt before overwrite"
 //usage:     "\n	-l,-s	Create (sym)links"
+//usage:     "\n	-v	Verbose"

 #include "libbb.h"
 #include "libcoreutils/coreutils.h"
 <at>  <at>  -79,7 +80,6  <at>  <at> 
 		"parents\0"        No_argument "\xff"
 		;
 #endif
-	// -v (--verbose) is ignored
 	flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPv");
 	/* Options of cp from GNU coreutils 6.10:
 	 * -a, --archive
 <at>  <at>  -194,6 +194,10  <at>  <at> 
  DO_COPY:
 		if (copy_file(*argv, dest, flags) < 0) {
 			status = EXIT_FAILURE;
+		} else {
+			if (flags & OPT_v) {
+				printf("'%s' -> '%s'\n", *argv, dest);
+			}
 		}
 		if (*++argv == last) {
 			/* possibly leaking dest... */
diff --git a/coreutils/mv.c b/coreutils/mv.c
index f127dfa..444b84c 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
 <at>  <at>  -17,13 +17,14  <at>  <at> 
 #include "libcoreutils/coreutils.h"

 //usage:#define mv_trivial_usage
-//usage:       "[-fin] SOURCE DEST\n"
-//usage:       "or: mv [-fin] SOURCE... DIRECTORY"
+//usage:       "[-finv] SOURCE DEST\n"
+//usage:       "or: mv [-finv] SOURCE... DIRECTORY"
 //usage:#define mv_full_usage "\n\n"
 //usage:       "Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY\n"
 //usage:     "\n	-f	Don't prompt before overwriting"
 //usage:     "\n	-i	Interactive, prompt before overwrite"
 //usage:     "\n	-n	Don't overwrite an existing file"
+//usage:     "\n	-v	Verbose"
 //usage:
 //usage:#define mv_example_usage
 //usage:       "$ mv /tmp/foo /bin/bar\n"
 <at>  <at>  -40,6 +41,7  <at>  <at> 
 #define OPT_FORCE       (1 << 0)
 #define OPT_INTERACTIVE (1 << 1)
 #define OPT_NOCLOBBER   (1 << 2)
+#define OPT_VERBOSE     (1 << 3)

 int mv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int mv_main(int argc, char **argv)
 <at>  <at>  -58,7 +60,6  <at>  <at> 
 	/* Need at least two arguments.
 	 * If more than one of -f, -i, -n is specified , only the final one
 	 * takes effect (it unsets previous options).
-	 * -v is accepted but ignored.
 	 */
 	opt_complementary = "-2:f-in:i-fn:n-fi";
 	flags = getopt32(argv, "finv");
 <at>  <at>  -148,6 +149,9  <at>  <at> 
 			status = 1;
 		}
  RET_0:
+		if (flags & OPT_VERBOSE) {
+			printf("'%s' -> '%s'\n", *argv, dest);
+		}
 		if (dest != last) {
 			free((void *) dest);
 		}
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 042fba1..5cef5d9 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
 <at>  <at>  -22,6 +22,7  <at>  <at> 
 //usage:     "\n	-i	Always prompt before removing"
 //usage:     "\n	-f	Never prompt"
 //usage:     "\n	-R,-r	Recurse"
+//usage:     "\n	-v	Verbose"
 //usage:
 //usage:#define rm_example_usage
 //usage:       "$ rm -rf /tmp/foo\n"
 <at>  <at>  -38,7 +39,6  <at>  <at> 
 	unsigned opt;

 	opt_complementary = "f-i:i-f";
-	/* -v (verbose) is ignored */
 	opt = getopt32(argv, "fiRrv");
 	argv += optind;
 	if (opt & 1)
 <at>  <at>  -47,6 +47,8  <at>  <at> 
 		flags |= FILEUTILS_INTERACTIVE;
 	if (opt & (8|4))
 		flags |= FILEUTILS_RECUR;
+	if (opt & 16)
+		flags |= FILEUTILS_VERBOSE;

 	if (*argv != NULL) {
 		do {
 <at>  <at>  -55,6 +57,9  <at>  <at> 
 			if (DOT_OR_DOTDOT(base)) {
 				bb_error_msg("can't remove '.' or '..'");
 			} else if (remove_file(*argv, flags) >= 0) {
+				if (flags & FILEUTILS_VERBOSE) {
+					printf("removed '%s'\n", *argv);
+				}
 				continue;
 			}
 			status = 1;
diff --git a/include/libbb.h b/include/libbb.h
index 1cbe2c8..e90c126 100644
--- a/include/libbb.h
+++ b/include/libbb.h
 <at>  <at>  -334,6 +334,7  <at>  <at> 
 	FILEUTILS_SET_SECURITY_CONTEXT = 1 << 10,
 #endif
 	FILEUTILS_IGNORE_CHMOD_ERR = 1 << 11,
+	FILEUTILS_VERBOSE         = 1 << 12, /* -v */
 };
 #define FILEUTILS_CP_OPTSTR "pdRfilsLH" IF_SELINUX("c")
 extern int remove_file(const char *path, int flags) FAST_FUNC;
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Tito | 16 Apr 18:47 2014
Picon

[PATCH] memset 0 in obscure is optimized away by compiler

Hi,
while reading some interesting stuff about memset being optimized
away by compilers if the variable is not read after the memset call
I recalled there was something similar in libbb/obscure.c file:

static int string_checker(const char *p1, const char *p2)
{
	int size, i;
	/* check string */
	int ret = string_checker_helper(p1, p2);
	/* make our own copy */
	char *p = xstrdup(p1);

	/* reverse string */
	i = size = strlen(p1);
	while (--i >= 0) {
		*p++ = p1[i];
	}
	p -= size; /* restore pointer */

	/* check reversed string */
	ret |= string_checker_helper(p, p2);

	/* clean up */
	memset(p, 0, size);

	free(p);

	return ret;
}

I've tried to find out if memset is really optimized away in this case
with some test code that I've compiled with :

gcc -O0  -S  test.c

and then with  -O1 -O2 -O3 -Os.
At a first glance the memset call is there only with the -O0 flag.
I've then tried the libbb nuke_str call instead ans it seems to 
survive compiler optimization, therefore I propose the following
patch to obscure.c:

--- libbb/obscure.c.orig	2013-06-02 13:56:34.000000000 +0200
+++ libbb/obscure.c	2014-04-16 18:20:39.783664194 +0200
 <at>  <at>  -75,8 +75,9  <at>  <at> 
 	/* check reversed string */
 	ret |= string_checker_helper(p, p2);

-	/* clean up */
-	memset(p, 0, size);
+	/* clean up, don't use memset as it is optimized away by compiler */
+	/*memset(p, 0, size);*/
+	nuke_str(p);
 	free(p);

 	return ret;

As my understanding of the assembler code generated with gcc -S
is _VERY_ limited and due to the fact that it was tested on a different
handcrafted test file I'm not 100% sure the same happens in busybox
but I suspect it so more experienced programmers should take a look
at it.

Ciao,
Tito

Attachment (obscure.patch): text/x-patch, 491 bytes
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Danomi Manchego | 16 Apr 05:09 2014
Picon

[PATCH 1/1] install: add kconfig option to specify --noclobber

The install.sh has the useful capabilty to suppress clobbering
of files during installation.  Unfortunately, this feature is
hard to enable because (1) the Makefile.custom does not provide a
way to specify --noclobber and (2) the install.sh only looks at
the second positional argument.

This patch adds a kconfig switch to specify --noclobber when
configured to install with soft or hard links, and modifies the
install.sh to process all the input arguments.

Signed-off-by: Danomi Manchego <danomimanchego123 <at> gmail.com>
---
 Config.in          |    8 ++++++++
 Makefile.custom    |    3 +++
 applets/install.sh |   26 +++++++++++++++-----------
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/Config.in b/Config.in
index b6eaea5..5698ce1 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -787,6 +787,14  <at>  <at>  config INSTALL_SH_APPLET_SCRIPT_WRAPPER

 endchoice

+config INSTALL_SH_LINK_NOCLOBBER
+	bool "Do not clobber existing files"
+	default n
+	depends on INSTALL_APPLET_SYMLINKS || INSTALL_APPLET_HARDLINKS
+	help
+	  Selecting this will prevent clobbering of existing files during
+	  link installation.
+
 config PREFIX
 	string "BusyBox installation prefix"
 	default "./_install"
diff --git a/Makefile.custom b/Makefile.custom
index 8c95ef2..bb23fb3 100644
--- a/Makefile.custom
+++ b/Makefile.custom
 <at>  <at>  -28,6 +28,9  <at>  <at>  ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
 INSTALL_OPTS:= --scriptwrapper
 endif
 endif
+ifeq ($(CONFIG_INSTALL_SH_LINK_NOCLOBBER),y)
+INSTALL_OPTS+= --noclobber
+endif
 install: $(srctree)/applets/install.sh busybox busybox.links
 	$(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
 		$(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
diff --git a/applets/install.sh b/applets/install.sh
index 95b4719..ec01a9c 100755
--- a/applets/install.sh
+++ b/applets/install.sh
 <at>  <at>  -15,17 +15,21  <at>  <at>  linkopts=""
 scriptwrapper="n"
 cleanup="0"
 noclobber="0"
-case "$2" in
-	--hardlinks)     linkopts="-f";;
-	--symlinks)      linkopts="-fs";;
-	--scriptwrapper) scriptwrapper="y";swrapall="y";;
-	--sw-sh-hard)    scriptwrapper="y";linkopts="-f";;
-	--sw-sh-sym)     scriptwrapper="y";linkopts="-fs";;
-	--cleanup)       cleanup="1";;
-	--noclobber)     noclobber="1";;
-	"")              h="";;
-	*)               echo "Unknown install option: $2"; exit 1;;
-esac
+
+while [ -n "$2" ]; do
+	case "$2" in
+		--hardlinks)     linkopts="-f";;
+		--symlinks)      linkopts="-fs";;
+		--scriptwrapper) scriptwrapper="y";swrapall="y";;
+		--sw-sh-hard)    scriptwrapper="y";linkopts="-f";;
+		--sw-sh-sym)     scriptwrapper="y";linkopts="-fs";;
+		--cleanup)       cleanup="1";;
+		--noclobber)     noclobber="1";;
+		"")              h="";;
+		*)               echo "Unknown install option: $2"; exit 1;;
+	esac
+	shift
+done

 if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
 	# get the target dir for the libs
--

-- 
1.7.9.5
Bartosz Golaszewski | 16 Apr 01:06 2014
Picon

[PATCH 0/6] Add a unit-testing framework to Busybox

This set of patches proposes to add a simple unit-testing framework to Busybox.

First four patches implement the actual framework and document it, while
last two add some example test cases.

Bartosz Golaszewski (6):
  unit-tests: add some helper macros for unit-test framework implementation
  unit-tests: implement the unit-testing framework
  unit-tests: add basic documentation on writing the unit test cases
  unit-tests: modify the Makefile 'test' target to run unit-tests too
  unit-tests: add two example test cases
  unit-tests: modify the existing strrstr test code to use the unit-test framework

 Config.in           |   8 +++
 Makefile.custom     |   4 ++
 docs/unit-tests.txt |  52 ++++++++++++++++++
 include/bbunit.h    | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/platform.h  |   3 +
 libbb/bbunit.c      | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 libbb/obscure.c     |  40 ++++++++++++++
 libbb/strrstr.c     |  21 +++----
 8 files changed, 423 insertions(+), 12 deletions(-)
 create mode 100644 docs/unit-tests.txt
 create mode 100644 include/bbunit.h
 create mode 100644 libbb/bbunit.c

--

-- 
1.8.4.5
Brad Walker | 15 Apr 00:58 2014

question about config of Ash shell..


I am working on an embedded system that does not have a MMU. It's a Kinetis K61 based system running ucLinux. The system works quite well..

I noticed the following in ash.c

#if !BB_MMU # error "Do not even bother, ash will not run on NOMMU machine" #endif
and

//config: depends on !NOMMU

I have compiled the Ash shell and executed on the system. It runs really well.

So my question is why does BusyBox continue to have these set? I would be happy to make the changes, test them out, and then submit a pull request if that is helpful.

Thanks.

-brad w.







_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Mai Daftedar | 14 Apr 08:45 2014
Picon

Building Busybox for arm: Errors why using the command make install

Dear All,
  It's required to crosscompile busybox for ARM...I get errors with the make install command.

These are the steps I followed:
export ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make
make install

and these are the errors I get
ln: creating symbolic link './install//bin/ash': Read only file system
make: *** [install] Error 1

Please Advice
Many Thanks
Mai
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Matthias Klein | 11 Apr 19:40 2014
Picon

Default password encryption method

Hello,
 
is it possible to use sha512 instead of des or md5 as default when the option USE_BB_CRYPT_SHA is selected ?
 
 
I think of a patch like:
 
diff --git a/loginutils/Config.src b/loginutils/Config.src
index fa2b4f8..b398972 100644
--- a/loginutils/Config.src
+++ b/loginutils/Config.src
<at> <at> -285,7 +285,8 <at> <at> config CHPASSWD
 
 config FEATURE_DEFAULT_PASSWD_ALGO
        string "Default password encryption method (passwd -a, cryptpw -m parameter)"
- default "des"
+ default "md5"
+ default "sha512" if USE_BB_CRYPT_SHA
        depends on PASSWD || CRYPTPW
        help
          Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512".
 
(But the above mentioned "if" does not work)
 
 
Best regards,
 
Matthias
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Bernhard Reutner-Fischer | 8 Apr 15:04 2014
Picon

[PATCH 0/2] cater for removed mktemp() and usleep()

Adjustments for building without mktemp() and usleep(), both of which
were removed from POSIX.1-2008

Ok to install?

thanks,

Bernhard Reutner-Fischer (2):
  mktemp: avoid removed mktemp()
  libbb: provide usleep() fallback implementation

 debianutils/mktemp.c | 10 +++++-----
 include/platform.h   |  7 +++++++
 libbb/platform.c     | 10 ++++++++++
 3 files changed, 22 insertions(+), 5 deletions(-)

--

-- 
1.9.1
Zbigniew Konojacki | 8 Apr 13:35 2014
Picon

Devel Live CD (4MLinux fork) using Git to compile BusyBox

Hello,

There are not too many BusyBox related videos o YouTube, so maybe 
anybody will find it interesting:
https://www.youtube.com/watch?v=MXPJa11i4rM

zk1234

Gmane