Bartosz Golaszewski | 24 Oct 16:55 2014
Picon

[PATCH] gitignore: add testsuite/echo-ne

It shows up in git status as untracked.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 8d6d176..73e88fb 100644
--- a/.gitignore
+++ b/.gitignore
 <at>  <at>  -41,3 +41,4  <at>  <at>  core
 #
 /busybox.links
 /runtest-tempdir-links
+/testsuite/echo-ne
--

-- 
2.1.1
Matteo Croce | 24 Oct 16:54 2014

[PATCH] ash: perform autocompletion on builtin commands

Refactor read_line_input to accept a list of strings which are
added byt the autocompletion suggestions.
Let ash pass the builtin command list to read_line_input to enable
completion of builtin commands as echo, printf, history, exec, etc.
---
 editors/ed.c       |  6 +++---
 include/libbb.h    |  2 +-
 libbb/lineedit.c   | 17 ++++++++++++-----
 shell/ash.c        |  8 +++++++-
 shell/hush.c       |  2 +-
 util-linux/fdisk.c |  2 +-
 6 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/editors/ed.c b/editors/ed.c
index 3087fb0..812580f 100644
--- a/editors/ed.c
+++ b/editors/ed.c
 <at>  <at>  -144,7 +144,7  <at>  <at>  static void doCommands(void)
 		 * 0  on ctrl-C,
 		 * >0 length of input string, including terminating '\n'
 		 */
-		len = read_line_input(NULL, ": ", buf, sizeof(buf), /*timeout*/ -1);
+		len = read_line_input(NULL, ": ", buf, sizeof(buf), /*timeout*/ -1, NULL);
 		if (len <= 0)
 			return;
 		endbuf = &buf[len - 1];
 <at>  <at>  -242,7 +242,7  <at>  <at>  static void doCommands(void)
 			}
 			if (!dirty)
 				return;
(Continue reading)

stroblsw | 24 Oct 12:51 2014
Picon

nslookup's Server: 0.0.0.0 but resolves correctly

Hi everybody,
as per the FAQ I am posting this here before submitting a formal bug report.

On Cyanogenmod android 4.4, busybox' nslookup resolution seemingly
works correctly but always displays Server: 0.0.0.0, same for Address
1: 0.0.0.0
This issue also exists on earlier android versions, definitely 4.3.
It's quite a nuissance if you want to know which server has been used
for address resolution.

My best guess without setting up all paths in a working development environment:
one of the helper functions called in the server_print(void) function
in networking/nslookup.c are grabbing into the void instead of
catching an actual 4-octet tuple. Any ideas anybody? Maybe a mod
misconfiguration mishap in the busybox build?

following: busybox version and an strace of an nslookup invocation
from the android terminal app.

busybox version:
u0_a59 <at> espressowifi:/ $ busybox
BusyBox v1.22.1 bionic (2014-07-26 08:40 -0700) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices. Merged for bionic by tpruvot <at> github

u0_a59 <at> espressowifi:/sdcard $ strace -tt -s99 -ostrace.txt nslookup google.de
Server:    0.0.0.0
Address 1: 0.0.0.0

(Continue reading)

Baruch Siach | 24 Oct 08:29 2014
Picon

Re: stime in date.c

Hi Hardik,

Please keep the list on Cc.

On Fri, Oct 24, 2014 at 02:20:40PM +0800, hardik gohil wrote:
> I searched for time.h
> output of file
> 
> #define USE_TIME(...)  __VA_ARGS__
> 
> no function prototype of stime

The definition of stime(2) depends on your C library. My host glibc has this 
in /usr/include/time.h:

extern int stime (const time_t *__when) __THROW;

baruch

> On Fri, Oct 24, 2014 at 12:49 PM, Baruch Siach <baruch <at> tkos.co.il> wrote:
> > Hi Hardik,
> >
> > On Fri, Oct 24, 2014 at 12:42:39PM +0800, hardik gohil wrote:
> > > I am trying to understand busybox/coreutils/date.c file.
> > >
> > > what I understood is whenever i set time from user space using date
> > > command,internally stime() gets called defined in date.c
> > >
> > > Can any one help me where definition of stime() is defined.
> >
(Continue reading)

hardik gohil | 24 Oct 06:42 2014
Picon

stime in date.c

Hello,

I am trying to understand busybox/coreutils/date.c file.

what I understood is whenever i set time from user space using date command,internally stime() gets called defined in date.c

Can any one help me where definition of stime() is defined.
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Martin Kaiser | 21 Oct 21:40 2014

small documentation update for telnetd

Hi,

the attached trivial patch corrects the list of linux kernel options
that are required for busybox telnetd. DEVPTS_FS has been obsolete for
some time.

Best regards,
Martin
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Cristian Ionescu-Idbohrn | 20 Oct 20:54 2014
Picon

1.22.1: been hit by the zcat bug

That deserves a patch in http://busybox.net/downloads/fixes-1.22.1/,
IMO.  At least, commits:

	7c47b560a8fc97956dd8132bd7f1863d83c19866
	b664f740d90880560ce46b11f766625341342e80
	640ce3de07807133796bccd0bdfa146bbfc788c7

may be relevantat.

Cheers,

--

-- 
Cristian
Bartosz Golaszewski | 20 Oct 14:56 2014
Picon

[PATCHv2] Use sendfile to copy data between file descriptors

Busybox already uses sendfile in httpd. This patch proposes to use it
globally to copy data between file descriptors.

It speeds up the copying on slow systems a lot - below are the times needed
to copy a 450Mb file with and without this option enabled on a BeagleBone
Black:

sendfile:
user	0m0.000s
sys	0m8.170s

read/write:
user	0m0.470s
sys	0m16.300s

It doesn't add a lot of bloat either:

function                                             old     new   delta
bb_full_fd_action                                    233     311     +78
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 78/0)               Total: 78 bytes
   text	   data	    bss	    dec	    hex	filename
 812839	   4123	   9552	 826514	  c9c92	busybox_old
 812917	   4123	   9552	 826592	  c9ce0	busybox_unstripped

This patch also moves USE_SENDFILE feature from httpd subconfiguration
to global settings.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
---
 Config.in             |  7 ++++++
 libbb/copyfd.c        | 59 ++++++++++++++++++++++++++++++++++++++++-----------
 networking/Config.src |  8 -------
 networking/httpd.c    |  6 +++---
 4 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/Config.in b/Config.in
index b83beb5..3edaf8f 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -264,6 +264,13  <at>  <at>  config PAM
 	  Use PAM in some busybox applets (currently login and httpd) instead
 	  of direct access to password database.

+config FEATURE_USE_SENDFILE
+        bool "Use sendfile system call"
+        default y
+        help
+          When enabled, busybox will use the kernel sendfile() function
+          instead of read/write loops where applicable.
+
 config LONG_OPTS
 	bool "Support for --long-options"
 	default y
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index eda2747..e10fe82 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
 <at>  <at>  -9,6 +9,28  <at>  <at> 

 #include "libbb.h"

+#if ENABLE_FEATURE_USE_SENDFILE
+#include <sys/sendfile.h>
+#endif
+
+/*
+ * Returns 1 if all bytes have been copied, 0 otherwise.
+ */
+static int check_status(int *status, off_t *size, off_t *total, ssize_t rd)
+{
+	*total += rd;
+	if (*status < 0) { /* if we aren't copying till EOF... */
+		*size -= rd;
+		if (!(*size)) {
+			/* 'size' bytes copied - all done */
+			*status = 0;
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 /* Used by NOFORK applets (e.g. cat) - must not use xmalloc.
  * size < 0 means "ignore write errors", used by tar --to-command
  * size = 0 means "copy till EOF"
 <at>  <at>  -18,6 +40,7  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 	int status = -1;
 	off_t total = 0;
 	bool continue_on_write_error = 0;
+	ssize_t rd;
 #if CONFIG_FEATURE_COPYBUF_KB <= 4
 	char buffer[CONFIG_FEATURE_COPYBUF_KB * 1024];
 	enum { buffer_size = sizeof(buffer) };
 <at>  <at>  -56,10 +79,29  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 		status = 1; /* copy until eof */
 	}

-	while (1) {
-		ssize_t rd;
+#if ENABLE_FEATURE_USE_SENDFILE
+	{
+		ssize_t sz = size && (size < buffer_size)
+				? size : MAXINT(ssize_t) - 0xffff;

-		rd = safe_read(src_fd, buffer, size > buffer_size ? buffer_size : size);
+		while (1) {
+			rd = sendfile(dst_fd, src_fd, NULL, sz);
+			if (rd <= 0) {
+				/* Might be EOF, might be an error,
+				 * to make sure fall back to the read-write
+				 * loop.
+				 */
+				break;
+			} else if (check_status(&status, &size, &total, rd)) {
+				break;
+			}
+		}
+	}
+#endif
+
+	while (1) {
+		rd = safe_read(src_fd, buffer,
+				size > buffer_size ? buffer_size : size);

 		if (!rd) { /* eof - all done */
 			status = 0;
 <at>  <at>  -80,15 +122,8  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 				dst_fd = -1;
 			}
 		}
-		total += rd;
-		if (status < 0) { /* if we aren't copying till EOF... */
-			size -= rd;
-			if (!size) {
-				/* 'size' bytes copied - all done */
-				status = 0;
-				break;
-			}
-		}
+		if (check_status(&status, &size, &total, rd))
+			break;
 	}
  out:

diff --git a/networking/Config.src b/networking/Config.src
index e566469..15a6968 100644
--- a/networking/Config.src
+++ b/networking/Config.src
 <at>  <at>  -181,14 +181,6  <at>  <at>  config FEATURE_HTTPD_RANGES
 	  "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted
 	  downloads, seeking in multimedia players etc.

-config FEATURE_HTTPD_USE_SENDFILE
-	bool "Use sendfile system call"
-	default y
-	depends on HTTPD
-	help
-	  When enabled, httpd will use the kernel sendfile() function
-	  instead of read/write loop.
-
 config FEATURE_HTTPD_SETUID
 	bool "Enable -u <user> option"
 	default y
diff --git a/networking/httpd.c b/networking/httpd.c
index 621d9cd..9cf0804 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
 <at>  <at>  -133,7 +133,7  <at>  <at> 
 # include <security/pam_appl.h>
 # include <security/pam_misc.h>
 #endif
-#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
+#if ENABLE_FEATURE_USE_SENDFILE
 # include <sys/sendfile.h>
 #endif
 /* amount of buffering in a pipe */
 <at>  <at>  -1624,7 +1624,7  <at>  <at>  static NOINLINE void send_file_and_exit(const char *url, int what)
 #endif
 	if (what & SEND_HEADERS)
 		send_headers(HTTP_OK);
-#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
+#if ENABLE_FEATURE_USE_SENDFILE
 	{
 		off_t offset = range_start;
 		while (1) {
 <at>  <at>  -1654,7 +1654,7  <at>  <at>  static NOINLINE void send_file_and_exit(const char *url, int what)
 			break;
 	}
 	if (count < 0) {
- IF_FEATURE_HTTPD_USE_SENDFILE(fin:)
+ IF_FEATURE_USE_SENDFILE(fin:)
 		if (verbose > 1)
 			bb_perror_msg("error");
 	}
--

-- 
2.1.1
Bartosz Golaszewski | 20 Oct 13:36 2014
Picon

[PATCH] Use sendfile to copy data between file descriptors

Busybox already uses sendfile in httpd. This patch proposes to use it
globally to copy data between file descriptors.

It speeds up the copying on slow systems a lot - below are the times needed
to copy a 450Mb file with and without this option enabled on a BeagleBone
Black:

sendfile:
user	0m0.000s
sys	0m8.170s

read/write:
user	0m0.470s
sys	0m16.300s

It doesn't add a lot of bloat either:

function                                             old     new   delta
bb_full_fd_action                                    233     311     +78
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 78/0)               Total: 78 bytes
   text	   data	    bss	    dec	    hex	filename
 812839	   4123	   9552	 826514	  c9c92	busybox_old
 812917	   4123	   9552	 826592	  c9ce0	busybox_unstripped

This patch also moves USE_SENDFILE feature from httpd subconfiguration
to global settings.

Signed-off-by: Bartosz Golaszewski <bartekgola <at> gmail.com>
---
 Config.in             |  8 +++++++
 libbb/copyfd.c        | 59 ++++++++++++++++++++++++++++++++++++++++-----------
 networking/Config.src |  8 -------
 networking/httpd.c    |  6 +++---
 4 files changed, 58 insertions(+), 23 deletions(-)

diff --git a/Config.in b/Config.in
index b83beb5..4b5ea69 100644
--- a/Config.in
+++ b/Config.in
 <at>  <at>  -264,6 +264,14  <at>  <at>  config PAM
 	  Use PAM in some busybox applets (currently login and httpd) instead
 	  of direct access to password database.

+config FEATURE_USE_SENDFILE
+        bool "Use sendfile system call"
+        default y
+        depends on HTTPD
+        help
+          When enabled, busybox will use the kernel sendfile() function
+          instead of read/write loops where applicable.
+
 config LONG_OPTS
 	bool "Support for --long-options"
 	default y
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index eda2747..e10fe82 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
 <at>  <at>  -9,6 +9,28  <at>  <at> 

 #include "libbb.h"

+#if ENABLE_FEATURE_USE_SENDFILE
+#include <sys/sendfile.h>
+#endif
+
+/*
+ * Returns 1 if all bytes have been copied, 0 otherwise.
+ */
+static int check_status(int *status, off_t *size, off_t *total, ssize_t rd)
+{
+	*total += rd;
+	if (*status < 0) { /* if we aren't copying till EOF... */
+		*size -= rd;
+		if (!(*size)) {
+			/* 'size' bytes copied - all done */
+			*status = 0;
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
 /* Used by NOFORK applets (e.g. cat) - must not use xmalloc.
  * size < 0 means "ignore write errors", used by tar --to-command
  * size = 0 means "copy till EOF"
 <at>  <at>  -18,6 +40,7  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 	int status = -1;
 	off_t total = 0;
 	bool continue_on_write_error = 0;
+	ssize_t rd;
 #if CONFIG_FEATURE_COPYBUF_KB <= 4
 	char buffer[CONFIG_FEATURE_COPYBUF_KB * 1024];
 	enum { buffer_size = sizeof(buffer) };
 <at>  <at>  -56,10 +79,29  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 		status = 1; /* copy until eof */
 	}

-	while (1) {
-		ssize_t rd;
+#if ENABLE_FEATURE_USE_SENDFILE
+	{
+		ssize_t sz = size && (size < buffer_size)
+				? size : MAXINT(ssize_t) - 0xffff;

-		rd = safe_read(src_fd, buffer, size > buffer_size ? buffer_size : size);
+		while (1) {
+			rd = sendfile(dst_fd, src_fd, NULL, sz);
+			if (rd <= 0) {
+				/* Might be EOF, might be an error,
+				 * to make sure fall back to the read-write
+				 * loop.
+				 */
+				break;
+			} else if (check_status(&status, &size, &total, rd)) {
+				break;
+			}
+		}
+	}
+#endif
+
+	while (1) {
+		rd = safe_read(src_fd, buffer,
+				size > buffer_size ? buffer_size : size);

 		if (!rd) { /* eof - all done */
 			status = 0;
 <at>  <at>  -80,15 +122,8  <at>  <at>  static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
 				dst_fd = -1;
 			}
 		}
-		total += rd;
-		if (status < 0) { /* if we aren't copying till EOF... */
-			size -= rd;
-			if (!size) {
-				/* 'size' bytes copied - all done */
-				status = 0;
-				break;
-			}
-		}
+		if (check_status(&status, &size, &total, rd))
+			break;
 	}
  out:

diff --git a/networking/Config.src b/networking/Config.src
index e566469..15a6968 100644
--- a/networking/Config.src
+++ b/networking/Config.src
 <at>  <at>  -181,14 +181,6  <at>  <at>  config FEATURE_HTTPD_RANGES
 	  "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted
 	  downloads, seeking in multimedia players etc.

-config FEATURE_HTTPD_USE_SENDFILE
-	bool "Use sendfile system call"
-	default y
-	depends on HTTPD
-	help
-	  When enabled, httpd will use the kernel sendfile() function
-	  instead of read/write loop.
-
 config FEATURE_HTTPD_SETUID
 	bool "Enable -u <user> option"
 	default y
diff --git a/networking/httpd.c b/networking/httpd.c
index 621d9cd..9cf0804 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
 <at>  <at>  -133,7 +133,7  <at>  <at> 
 # include <security/pam_appl.h>
 # include <security/pam_misc.h>
 #endif
-#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
+#if ENABLE_FEATURE_USE_SENDFILE
 # include <sys/sendfile.h>
 #endif
 /* amount of buffering in a pipe */
 <at>  <at>  -1624,7 +1624,7  <at>  <at>  static NOINLINE void send_file_and_exit(const char *url, int what)
 #endif
 	if (what & SEND_HEADERS)
 		send_headers(HTTP_OK);
-#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
+#if ENABLE_FEATURE_USE_SENDFILE
 	{
 		off_t offset = range_start;
 		while (1) {
 <at>  <at>  -1654,7 +1654,7  <at>  <at>  static NOINLINE void send_file_and_exit(const char *url, int what)
 			break;
 	}
 	if (count < 0) {
- IF_FEATURE_HTTPD_USE_SENDFILE(fin:)
+ IF_FEATURE_USE_SENDFILE(fin:)
 		if (verbose > 1)
 			bb_perror_msg("error");
 	}
--

-- 
2.1.1
Michael D. Setzer II | 19 Oct 12:59 2014
Picon

new lzop patch doesn't have correct format?

Saw new patch

http://busybox.net/downloads/fixes-1.22.1/busybox-1.22.1-lzop.patch

But unlike the other patches the patch -p0 <file doesn't work.

From a9dc7c2f59dc5e92870d2d46316ea5c1f14740e3 Mon Sep 17 00:00:00 
2001
From: Denys Vlasenko <vda.linux <at> googlemail.com>
Date: Mon, 30 Jun 2014 10:14:34 +0200
Subject: [PATCH] lzop: add overflow check

See CVE-2014-4607
http://www.openwall.com/lists/oss-security/2014/06/26/20

function                                             old     new   delta
lzo1x_decompress_safe                               1010    1031     +21

Signed-off-by: Denys Vlasenko <vda.linux <at> googlemail.com>
---
 archival/libarchive/liblzo.h  | 2 ++
 archival/libarchive/lzo1x_d.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/archival/libarchive/liblzo.h b/archival/libarchive/liblzo.h
index 843997c..4596620 100644
--- a/archival/libarchive/liblzo.h
+++ b/archival/libarchive/liblzo.h
 <at>  <at>  -76,11 +76,13  <at>  <at> 
 #    define TEST_IP             (ip < ip_end)
 #    define NEED_IP(x) \
             if ((unsigned)(ip_end - ip) < (unsigned)(x))  goto input_overrun
+#    define TEST_IV(x)          if ((x) > (unsigned)0 - (511)) goto input_overrun

 #    undef TEST_OP              /* don't need both of the tests here */
 #    define TEST_OP             1
 #    define NEED_OP(x) \
             if ((unsigned)(op_end - op) < (unsigned)(x))  goto output_overrun
+#    define TEST_OV(x)          if ((x) > (unsigned)0 - (511)) goto 
output_overrun

 #define HAVE_ANY_OP 1

diff --git a/archival/libarchive/lzo1x_d.c b/archival/libarchive/lzo1x_d.c
index 9bc1270..40b167e 100644
--- a/archival/libarchive/lzo1x_d.c
+++ b/archival/libarchive/lzo1x_d.c
 <at>  <at>  -92,6 +92,7  <at>  <at>  int lzo1x_decompress_safe(const uint8_t* in, unsigned 
in_len,
 				ip++;
 				NEED_IP(1);
 			}
+			TEST_IV(t);
 			t += 15 + *ip++;
 		}
 		/* copy literals */
 <at>  <at>  -224,6 +225,7  <at>  <at>  int lzo1x_decompress_safe(const uint8_t* in, 
unsigned in_len,
 						ip++;
 						NEED_IP(1);
 					}
+					TEST_IV(t);
 					t += 31 + *ip++;
 				}
 #if defined(COPY_DICT)
 <at>  <at>  -265,6 +267,7  <at>  <at>  int lzo1x_decompress_safe(const uint8_t* in, 
unsigned in_len,
 						ip++;
 						NEED_IP(1);
 					}
+					TEST_IV(t);
 					t += 7 + *ip++;
 				}
 #if defined(COPY_DICT)
-- 
2.1.2

+----------------------------------------------------------+
  Michael D. Setzer II -  Computer Science Instructor      
  Guam Community College  Computer Center                  
  mailto:mikes <at> kuentos.guam.net                            
  mailto:msetzerii <at> gmail.com
  http://www.guam.net/home/mikes
  Guam - Where America's Day Begins                        
  G4L Disk Imaging Project maintainer 
  http://sourceforge.net/projects/g4l/
+----------------------------------------------------------+

http://setiathome.berkeley.edu (Original)
Number of Seti Units Returned:  19,471
Processing time:  32 years, 290 days, 12 hours, 58 minutes
(Total Hours: 287,489)

BOINC <at> HOME CREDITS
ROSETTA     20740775.774272   |   SETI        35509772.025886
ABC         16613838.513356   |   EINSTEIN    37304331.704900
Ron Yorston | 19 Oct 10:51 2014
Picon

Re: `busyboxvi` is not working like before

>busybox git build running `./busybox vi` now shows "'(null)' Bad address"
>instead of "- No file 1/1 100%" like before.

I submitted a patch for that in August:

   http://lists.busybox.net/pipermail/busybox/2014-August/081534.html

>and `./busybox vi new.txt` now shows "'new.txt' No such file or directory"
>instead of "- new.txt 1/1 100%"

I didn't spot that one, though.

Ron

Gmane