Denys Vlasenko | 1 Oct 14:01 2007

Re: Remove common patterns -- second try

I applied bigger part of it. Thanks. See 6.patch.

7.patch is a part which is not applied, as it is slower.

On Sunday 30 September 2007 19:53, Loïc Grenié wrote:
>     While I'm at it: bb_verror_msg is written in such a way that msg can have
>   an embedded NUL char. Is it important ? Otherwise the function can be
>   simplified (using strcat or vasprintf instead of moving pointers around).

strcat and vasprintf are slower than msg[i++] = 'c' and strcpy.

No need to kill yourself for the last byte or two.

> PS: with my local gcc, whenever bb_simple_perror_msg is declared in
> networking/libiproute/iproute.c, the function do_iproute takes 40 bytes
> more. I've removed from the patch the kludge that I've used here but
> I don't know whether this is a general problem.

It's a gcc problem.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29950
--
vda
Attachment (6.patch): text/x-diff, 25 KiB
Attachment (7.patch): text/x-diff, 1751 bytes
_______________________________________________
busybox mailing list
busybox <at> busybox.net
(Continue reading)

Mike Frysinger | 1 Oct 15:02 2007
Picon

Re: svn commit: trunk/busybox: archival coreutils libbb miscutils netwo etc...

On Monday 01 October 2007, vda <at> busybox.net wrote:
> Author: vda
> Date: 2007-10-01 05:05:12 -0700 (Mon, 01 Oct 2007)
> New Revision: 20160
>
> Log:
> printf("%s\n") -> puts()

should add a src test for this
-mike
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
Mike | 1 Oct 21:54 2007

Coupla bugs ? syslogd -C, logger, losetup

Howdy,

    syslogd option paramater -C is not recognised in 1.7.1.

    I poked around and the culprit appears to be an extra semicolon in
the options parameter declaration for it. This trivial patch seems to do
the trick for me (compiled + tested minimally).

diff -ur busybox-1.7.1.orig/sysklogd/syslogd.c
busybox-1.7.1/sysklogd/syslogd.c
--- busybox-1.7.1.orig/sysklogd/syslogd.c       2007-09-03
11:48:35.000000000 +0000
+++ busybox-1.7.1/sysklogd/syslogd.c    2007-09-29 16:53:12.000000000 +0000
 <at>  <at>  -159,7 +159,7  <at>  <at> 
        USE_FEATURE_ROTATE_LOGFILE("b:" ) \
        USE_FEATURE_REMOTE_LOG(    "R:" ) \
        USE_FEATURE_REMOTE_LOG(    "L"  ) \
-       USE_FEATURE_IPC_SYSLOG(    "C::")
+       USE_FEATURE_IPC_SYSLOG(    "C:")
#define OPTION_DECL *opt_m, *opt_l \
        USE_FEATURE_ROTATE_LOGFILE(,*opt_s) \
        USE_FEATURE_ROTATE_LOGFILE(,*opt_b) \

	Also, losetup seems to not be working correctly and I can't seem to get 
it to work with my compressed loop device /dev/cloop/[0-7]. It looks 
like a flub with parsing argv but I ran out of time looking at it.

	ALSO, I just noticed, logger seems to only take the first argument on 
the command like for squirting into syslog. eg:

(Continue reading)

Kazuo TAKADA | 2 Oct 11:52 2007
Picon
Picon

[PATCH] tail can't handle the /proc directory

Hi,

I found bug in busybox 1.7.2 and before.
The tail command can't handle the /proc directory and doesn't return
from a while loop.

For example:
----------------------------------------
% ./busybox tail /proc/meminfo
(It doesn't exit...)
----------------------------------------

The patch below can resolve this problem.

----------------------------------------------------------------------
--- coreutils/tail.c.orig	2007-09-03 20:48:40.000000000 +0900
+++ coreutils/tail.c	2007-10-02 17:54:34.000000000 +0900
 <at>  <at>  -51,7 +51,7  <at>  <at> 
 	struct stat sbuf;

 	end = current = lseek(fd, 0, SEEK_CUR);
-	if (!fstat(fd, &sbuf))
+	if (!fstat(fd, &sbuf) && sbuf.st_size)
 		end = sbuf.st_size;
 	lseek(fd, end < current ? 0 : current, SEEK_SET);
 	r = safe_read(fd, buf, count);
----------------------------------------------------------------------

'man fstat' said:

(Continue reading)

Denys Vlasenko | 2 Oct 11:55 2007

Re: Coupla bugs ? syslogd -C, logger, losetup

On Monday 01 October 2007 20:54, Mike wrote:
> Howdy,
> 
>     syslogd option paramater -C is not recognised in 1.7.1.
> 
>     I poked around and the culprit appears to be an extra semicolon in
> the options parameter declaration for it. This trivial patch seems to do
> the trick for me (compiled + tested minimally).
> 
> 
> diff -ur busybox-1.7.1.orig/sysklogd/syslogd.c
> busybox-1.7.1/sysklogd/syslogd.c
> --- busybox-1.7.1.orig/sysklogd/syslogd.c       2007-09-03
> 11:48:35.000000000 +0000
> +++ busybox-1.7.1/sysklogd/syslogd.c    2007-09-29 16:53:12.000000000 +0000
>  <at>  <at>  -159,7 +159,7  <at>  <at> 
>         USE_FEATURE_ROTATE_LOGFILE("b:" ) \
>         USE_FEATURE_REMOTE_LOG(    "R:" ) \
>         USE_FEATURE_REMOTE_LOG(    "L"  ) \
> -       USE_FEATURE_IPC_SYSLOG(    "C::")
> +       USE_FEATURE_IPC_SYSLOG(    "C:")
> #define OPTION_DECL *opt_m, *opt_l \
>         USE_FEATURE_ROTATE_LOGFILE(,*opt_s) \
>         USE_FEATURE_ROTATE_LOGFILE(,*opt_b) \

Double :: means that the parameter is optional.
In this case, you _must_ specify parameter without space:

Ok:  busybox syslogd -n -C8
Bad: busybox syslogd -n -C 8
(Continue reading)

Denys Vlasenko | 2 Oct 12:14 2007

Re: [PATCH] tail can't handle the /proc directory

On Tuesday 02 October 2007 10:52, Kazuo TAKADA wrote:
> Hi,
> 
> I found bug in busybox 1.7.2 and before.
> The tail command can't handle the /proc directory and doesn't return
> from a while loop.
> 
> For example:
> ----------------------------------------
> % ./busybox tail /proc/meminfo
> (It doesn't exit...)
> ----------------------------------------
> 
> The patch below can resolve this problem.
> 
> ----------------------------------------------------------------------
> --- coreutils/tail.c.orig	2007-09-03 20:48:40.000000000 +0900
> +++ coreutils/tail.c	2007-10-02 17:54:34.000000000 +0900
>  <at>  <at>  -51,7 +51,7  <at>  <at> 
>  	struct stat sbuf;
>  
>  	end = current = lseek(fd, 0, SEEK_CUR);
> -	if (!fstat(fd, &sbuf))
> +	if (!fstat(fd, &sbuf) && sbuf.st_size)
>  		end = sbuf.st_size;
>  	lseek(fd, end < current ? 0 : current, SEEK_SET);
>  	r = safe_read(fd, buf, count);
> ----------------------------------------------------------------------

I am applying this patch (see attached). Does it work for you?
(Continue reading)

Kazuo TAKADA | 2 Oct 12:28 2007
Picon
Picon

Re: [PATCH] tail can't handle the /proc directory

>On Tuesday 02 October 2007 10:52, Kazuo TAKADA wrote:
>> Hi,
>> 
>> I found bug in busybox 1.7.2 and before.
>> The tail command can't handle the /proc directory and doesn't return
>> from a while loop.
{snip..}
>
>I am applying this patch (see attached). Does it work for you?
>--
>vda

OK, it works.
Thanks.

--------
Kazuo TAKADA
Loïc Grenié | 2 Oct 14:17 2007
Picon

unzip concatenated gzip files

   This patch tries to allow the unzipping of concatenated gzip files.
  Test:

% echo First > first
% gzip first
% echo Second > second
% gzip second
% cat first.gz second.gz > total.gz
% ./busybox gunzip total.gz
% cat total
First
Second
%

    If there are no errors, this should address Debian's bug #402482.
  The feature costs 400 bytes on i386. I've removed a couple of
  initializations that (look) useless (to me). I've also added a feature
  for message "decompression OK, trailing garbage ignored".

       Loïc

Attachment (gunzip.diff): text/x-diff, 11 KiB
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
Denys Vlasenko | 2 Oct 16:05 2007

Re: Coupla bugs ? syslogd -C, logger, losetup

On Tuesday 02 October 2007 12:06, Mike wrote:
> 
> The syslogd paramater is broke. Previous versions allows "-C 4096", 
> whereas 1.7.1 doesn't. Removing the space makes it incompatible with 
> scripts and so forth. Also forcing there to be no space makes it's 
> option parsing unlike practically every other code out there. We should 
> strive for compatibillity as removing the space adds no value. So lets 
> fix the parser

Parsing of -Cn has not changed since at least 1.1.0

Previous versions of syslogd were ignoring non option arguments.

I downloaded busybox-1.1.0, added debug printf:

        while ((opt = getopt(argc, argv, "m:nO:s:Sb:R:LC::")) > 0) {
                 ...
        }
+printf("shm_size=%u\n", shm_size);

built and ran it like this:

$ ./busybox syslogd -n -C 64
shm_size=16384
syslogd: Could not connect to socket /dev/log: Address already in use

$ ./busybox syslogd -n -C64
shm_size=65536
syslogd: Could not connect to socket /dev/log: Address already in use

IOW: syslogd -C 64 *is ignoring 64*. 64 becomes first non-option
parameter and is ignored by syslogd from busybox 1.1.0.

Current syslogd refuses to start when it sees non-option arguments.

If you are dissatisfied with this behavior, please propose
a solution.

> instead of bashing me, ok? 

Hmm.

> losetup is broke as I stated and does not function in real life. 
> Previous versions do, however, and I spent quite a good time trying to 
> figue out why 1.00 and others work whereas 1.7.1 doesn't. I don't have 
> to "do better" than reporting my real life experience and if you get 
> defensive and make these disrespectful and rude comments to me again in 
> the future, I'll just document your bugs elsewhere and maintain a 
> private tree as I do for many of these other little projects and we 
> won't have this discourse again.

Give me a sequence of commands where losetup fails.
I will try to reproduce and subsequently fix.
--
vda
Kazuo TAKADA | 3 Oct 04:31 2007
Picon
Picon

[PATCH] dd doesn't return a failure status

Hi,

If the dd command fails in a sequence of copying, it always returns
EXIT_SUCCESS.  So, I can't judge whether the command had succeeded or
failed.

Its behavior doesn't conform to POSIX.

  POSIX 1003.1:
  http://www.opengroup.org/onlinepubs/009695399/utilities/dd.html
  | EXIT STATUS
  | The following exit values shall be returned:
  |
  |  0
  |     The input file was copied successfully.
  | >0
  |     An error occurred.

For example, copy some data to a small size device repeatly.

--------------------------------------------------
(with a root account)
# ./busybox dd if=/dev/zero of=/dev/ram
dd: writing '/dev/ram': No space left on device
32769+0 records in
32768+0 records out
# echo $?
0			<= should be failed!!

# ./busybox dd if=/dev/zero of=/dev/ram count=1
1+0 records in
1+0 records out
# echo $?
0

# /bin/dd if=/dev/zero of=/dev/ram	<= GNU's one
dd: writing to `/dev/ram': No space left on device
32769+0 records in
32768+0 records out
# echo $?
1
--------------------------------------------------

The old busybox-1.2.2.1 returns EXIT_FAILURE.  It is the version that
dd had not reconstructed yet.

Can you accept the patch below?
write_and_stats() is the function which returns a bool value.

----------------------------------------------------------------------
--- coreutils/dd.c.orig	2007-09-03 20:48:39.000000000 +0900
+++ coreutils/dd.c	2007-10-03 10:31:50.000000000 +0900
 <at>  <at>  -106,7 +106,7  <at>  <at> 
 #endif
 	};
 	size_t ibs = 512, obs = 512;
-	ssize_t n, w;
+	ssize_t n, w = 0;
 	char *ibuf, *obuf;
 	/* And these are all zeroed at once! */
 	struct {
 <at>  <at>  -303,13 +303,17  <at>  <at> 
 				tmp += d;
 				oc += d;
 				if (oc == obs) {
-					if (write_and_stats(ofd, obuf, obs, obs, outfile))
+					if (write_and_stats(ofd, obuf, obs, obs, outfile)) {
+						w = -1;
 						goto out_status;
+					}
 					oc = 0;
 				}
 			}
-		} else if (write_and_stats(ofd, ibuf, n, obs, outfile))
+		} else if (write_and_stats(ofd, ibuf, n, obs, outfile)) {
+			w = -1;
 			goto out_status;
+		}
 	}

 	if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
 <at>  <at>  -330,5 +334,5  <at>  <at> 
  out_status:
 	dd_output_status(0);

-	return EXIT_SUCCESS;
+	return (w >= 0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
----------------------------------------------------------------------

Best regards,
Kazuo TAKADA

Gmane