Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Rich Felker
On Tue, Jan 27, 2015 at 04:51:33PM -0500, Cathey, Jim wrote: > At the bottom, some of C's arithmetical rules > are 'stupid'. Especially as regards type > promotion. At least they're well-defined. No, unsigned types are just modular arithmetic. There's nothing 'stupid' or unexpected about how the

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 09:51:29PM +0100, Denys Vlasenko wrote: > Hmm, I think it's a sign-extension bug. Can you try replacing > > tv.tv_sec = timeout_end - monotonic_sec(); > > with > > tv.tv_sec = (int)(timeout_end - monotonic_sec()); > > I suspect this will fix the behavior. In fact, I'm g

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Guillermo Rodriguez Garcia
El martes, 27 de enero de 2015, Cathey, Jim escribió: > Because mathematically, differences are *always* signed! > > > > 2 - 1 == 1 > > 1 - 2 == -1 > In modulo arithmetic , addition and substraction are the same for both unsigned and signed operands. Assume you

RE: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Cathey, Jim
Oh, and carry bits. Addition/subtraction are also precision-changing! -- Jim From: busybox [mailto:busybox-boun...@busybox.net] On Behalf Of Cathey, Jim Sent: Tuesday, January 27, 2015 2:19 PM To: Guillermo Rodriguez Garcia; Tim Hentenaar Cc: busybox; Rich Felker Subject: RE: [PATCH] udhcpd: Han

RE: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Cathey, Jim
Because mathematically, differences are always signed! 2 - 1 == 1 1 - 2 == -1 Doesn't matter what the size, or sign-ability of the LHS operands are. C, however, absolutely stinks at mathematical relations that change the nature of the calculation. Precision chan

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Guillermo Rodriguez Garcia
El martes, 27 de enero de 2015, Tim Hentenaar escribió: > Perhaps it wrongly assumes that since the operands for the subtraction > are 32-bit unsigned integers, that the result will be also unsigned. Uhm, why would that be a wrong assumption ? Guillermo -- Guillermo Rodriguez Garcia guille.

Re: ntpdate-like functionality in ntpd

2015-01-27 Thread Guillermo Rodriguez Garcia
Hello Denys, El martes, 27 de enero de 2015, Denys Vlasenko escribió: > On Tue, Jan 27, 2015 at 7:27 PM, Guillermo Rodriguez Garcia > > wrote: > > Hello all, > > > > Is there a way to make ntpd work just like ntpdate (just use the first > > response received to set the time)? This is to set the

RE: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Cathey, Jim
At the bottom, some of C's arithmetical rules are 'stupid'. Especially as regards type promotion. At least they're well-defined. Absolutely true in a mathematical sense is that the difference between two unsigned numbers is SIGNED! But that's not what C does. You can get around this, easy enou

RE: ntpdate-like functionality in ntpd

2015-01-27 Thread Cathey, Jim
>I doubt having the boot process continue with the wrong time would be >acceptable. File timestamps will be wrong until the background process >completes. You really want to wait synchronously for an answer. That, of course, is not the tool-maker's call. The _system_ designer gets to decide how i

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Rich Felker
On Tue, Jan 27, 2015 at 10:28:26PM +0100, Tim Hentenaar wrote: > On Tue, Jan 27, 2015 at 09:51:29PM +0100, Denys Vlasenko wrote: > > Hmm, I think it's a sign-extension bug. Can you try replacing > > > > tv.tv_sec = timeout_end - monotonic_sec(); > > > > with > > > > tv.tv_sec = (int)(timeout_end

Re: ntpdate-like functionality in ntpd

2015-01-27 Thread Rich Felker
On Tue, Jan 27, 2015 at 10:26:47PM +0100, Denys Vlasenko wrote: > On Tue, Jan 27, 2015 at 7:27 PM, Guillermo Rodriguez Garcia > wrote: > > Hello all, > > > > Is there a way to make ntpd work just like ntpdate (just use the first > > response received to set the time)? This is to set the approximat

RE: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Cathey, Jim
>Because we don't expect machines to run for 68 years without reboot. Certain nameless-but-large customers out in the world, running certain nameless Linux/busybox-based products, have experienced abject system failures after longer runtimes. Two years is one such number. These are generally sig

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 09:51:29PM +0100, Denys Vlasenko wrote: > Hmm, I think it's a sign-extension bug. Can you try replacing > > tv.tv_sec = timeout_end - monotonic_sec(); > > with > > tv.tv_sec = (int)(timeout_end - monotonic_sec()); > > I suspect this will fix the behavior. When I make th

Re: ntpdate-like functionality in ntpd

2015-01-27 Thread Denys Vlasenko
On Tue, Jan 27, 2015 at 7:27 PM, Guillermo Rodriguez Garcia wrote: > Hello all, > > Is there a way to make ntpd work just like ntpdate (just use the first > response received to set the time)? This is to set the approximate > time at boot as quickly as possible before starting other time sensitive

RE: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Cathey, Jim
While 68 years does seem a stretch, who in their right mind wants to code implicit time-bombs into their stuff? A vendor wants to be able to say "I'm game if you are." (I.e., totally NOT a microsoft mentality! Which is to say, reboot every few days else it stops working right.) Handling monobased

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread m...@grounded.net
We ran a 486 for some 5 years pretty much non stop in one of our server rooms. By the time we shut it off, the switch broke and later some other part just crumbled when we tried starting it back up. Had we left it alone, it probably would have continued running for many more years. - Origi

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
On Tue, Jan 27, 2015 at 10:11 PM, Cathey, Jim wrote: >>Because we don't expect machines to run for 68 years without reboot. > > Certain nameless-but-large customers out in the world, running certain > nameless Linux/busybox-based products, have experienced abject system > failures after longer run

control-c

2015-01-27 Thread m...@grounded.net
I fire up either a cmd or power shell in windows 7. I start 'busybox bash' and get into a shell. I run a script then can never kill it unless I close the powershell window. How do I kill this process if control-c won't work? Thanks. ___ busybox mailing

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
On Tue, Jan 27, 2015 at 4:02 PM, Tim Hentenaar wrote: > if (server_config.auto_time) { > - tv.tv_sec = timeout_end - monotonic_sec(); > tv.tv_usec = 0; > + tv.tv_sec = 0; > + > + msec = monot

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
>> + tv.tv_sec = 0; >> + >> + msec = monotonic_sec(); >> + if (msec < timeout_end) >> + tv.tv_sec = timeout_end - msec; > > Why are we using a 32-bit type for seconds in 2015? Because we don't expect machines

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
Hmm, I think it's a sign-extension bug. Can you try replacing tv.tv_sec = timeout_end - monotonic_sec(); with tv.tv_sec = (int)(timeout_end - monotonic_sec()); I suspect this will fix the behavior. ___ busybox mailing list busybox@busybox.net http://l

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Rich Felker
On Tue, Jan 27, 2015 at 04:02:16PM +0100, Tim Hentenaar wrote: > On Tue, Jan 27, 2015 at 08:41:30AM -0500, Rich Felker wrote: > > On Wed, Jan 21, 2015 at 11:00:03PM +0100, Tim Hentenaar wrote: > > > --- > > > networking/udhcp/dhcpd.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff

ntpdate-like functionality in ntpd

2015-01-27 Thread Guillermo Rodriguez Garcia
Hello all, Is there a way to make ntpd work just like ntpdate (just use the first response received to set the time)? This is to set the approximate time at boot as quickly as possible before starting other time sensitive services. The closest I can get is ntpd -nqp but this seems to need 5 vali

Re: [RESEND] Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 02:13:38PM +0100, Denys Vlasenko wrote: > On Tue, Jan 27, 2015 at 1:28 PM, Tim Hentenaar wrote: > > callmonotonic_sec # > > movl24(%rsp), %ecx # %sfp, D.9844 > > movl52+bb_common_bufsiz1(%rip), %r14d # MEM[(struct > > server_con

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 08:41:30AM -0500, Rich Felker wrote: > On Wed, Jan 21, 2015 at 11:00:03PM +0100, Tim Hentenaar wrote: > > --- > > networking/udhcp/dhcpd.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c > > index 4b3ed2

Re: [RESEND] Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 02:13:38PM +0100, Denys Vlasenko wrote: > With gcc 4.7.2: > > calludhcp_sp_fd_set # > cmpl$0, bb_common_bufsiz1+52(%rip) #, MEM[(struct > server_config_t * {ref-all})&bb_common_bufsiz1].auto_time > movl%eax, %ebx #, max_sock >

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
Hi Rich, On Tue, Jan 27, 2015 at 08:41:30AM -0500, Rich Felker wrote: > On Wed, Jan 21, 2015 at 11:00:03PM +0100, Tim Hentenaar wrote: > > --- > > networking/udhcp/dhcpd.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c > > in

Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Rich Felker
On Wed, Jan 21, 2015 at 11:00:03PM +0100, Tim Hentenaar wrote: > Howdy y'all, > > I've noticed an interesting issue with udhcpd and auto_time. > > Some paths within the while loop don't go through continue_with_autotime. > Thus, if it takes a bit too long to reset timeout_end, the monotonic > tim

Re: [RESEND] Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
On Tue, Jan 27, 2015 at 1:28 PM, Tim Hentenaar wrote: > callmonotonic_sec # > movl24(%rsp), %ecx # %sfp, D.9844 > movl52+bb_common_bufsiz1(%rip), %r14d # MEM[(struct > server_config_t * {ref-all})&bb_common_bufsiz1].auto_time, > movq$0, 88(

Re: [RESEND] Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Tim Hentenaar
On Tue, Jan 27, 2015 at 11:15:06AM +0100, Denys Vlasenko wrote: > On Mon, Jan 26, 2015 at 6:13 PM, Tim Hentenaar wrote: > > Hi Denys, > > > > On Sun, Jan 25, 2015 at 09:58:50PM +0100, Denys Vlasenko wrote: > >> I don't understand why current code does not reach write_leases(). > >> If tv.tv_sec is

Re: [RESEND] Re: [PATCH] udhcpd: Handle auto_time timeout overflow

2015-01-27 Thread Denys Vlasenko
On Mon, Jan 26, 2015 at 6:13 PM, Tim Hentenaar wrote: > Hi Denys, > > On Sun, Jan 25, 2015 at 09:58:50PM +0100, Denys Vlasenko wrote: >> I don't understand why current code does not reach write_leases(). >> If tv.tv_sec is negative, we should not reach select() here - >> >> retval

1.23.1 is released

2015-01-27 Thread Denys Vlasenko
27 January 2015 -- BusyBox 1.23.1 (stable) BusyBox 1.23.1. (git, patches, how to add a patch) Bug fix release. 1.23.1 has fixes for ash (fixed a problem with ${#N} expansion), ftpd (fixed "zombie apocalypse"), modprobe (was not ignoring directory component of path names in a few places), vi. 2