Comment 28 for bug 1947099

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Hi Fabio,

> [1] But now when I try to obtain an IP using dhcp without specifying any timeout,
> it dumps lots of "Lowered timeout to match user request" messages.
> Is that expected?
>
> https://pastebin.ubuntu.com/p/5Tpc5Rwdkq/

No, this is a regression without `-t`, and has to be fixed before SRU.

...

Without `-t`, loop_timeout == -1, which makes the new check pass/true.

(because `start` ~= `now` (seconds range), even for the theoretically
lowest possible value of `timeout` (zero; note it's not loop_timeout).

We need a gating `loop_timeout >= 0` check, as used in the inner loop.

- if (now.tv_sec + timeout > start + loop_timeout) {
+ if (loop_timeout >= 0 && now.tv_sec + timeout > start + loop_timeout) {

...

While checking the code in detail, I was a bit concerned that,
in the first pass, the `prev = now` assignment in the inner loop
now takes the newly used `now` (this patch), not the one from before
the while loop.

However, that shouldn't matter much, as it's only used for time/delta
reporting (disabled in non-debug build; but just for correctness) and
even so, for the first pass the time difference between the first/start
`now` and that assignment in the new check doesn't seem to be significant.

...

That one line change worked fine in a quick test here.

Could you test that, by, I guess (sorry, I have to EOD):

... unpacking the source package from the unapproved queue
(dpkg-source -x *.dsc && cd klibc-*),
create a new patch with `quilt new ipconfig-timeout-fix-fix.patch`,
add file with `quilt add usr/kinit/ipconfig/main.c`,
change that file,
update patch with `quilt refresh`,
update changelog `DEB_EMAIL="Your Name <email address hidden>" TZ=UTC dch -l+test 'd/p/ipcfg-tmo-f-f.patch: Test fix'`
sudo apt build-dep -y klibc
dpkg-buildpackage -us -uc

Thanks!