public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: J William Piggott <elseifthen@gmx.com>
To: libc-alpha@sourceware.org
Subject: settimeofday breakage
Date: Tue, 11 Feb 2020 15:34:00 -0000	[thread overview]
Message-ID: <nycvar.YAK.7.77.849.2002111025400.1724@zhn.tzk.pbz> (raw)

  > NEWS Version 2.31
  > Deprecated and removed features, and other changes affecting compatibility:
  >
  >   However, to reduce the odds of this offset being set by accident,
  >   settimeofday can no longer be used to set the time and the offset
  >   simultaneously.  If both of its two arguments are non-null, the call
  >   will fail (setting errno to EINVAL).

I do not know who wrote this and my comment is not personal, but I
question the stated justification for this breakage.

The behavior of this function when called with two args has been in
place for nearly 30 years; I have never see a report of the kernel time
zone being set by 'accident'.

Then there is this recent comment:

  > Date: Thu, 6 Feb 2020 21:41:06 +0000
  > From: Joseph Myers <joseph@codesourcery.com>
  >
  > On Wed, 5 Feb 2020, Adhemerval Zanella wrote:
  >
  > > Once POSIX does remove the symbol, we can remove its definition from
  > > default visibility
  >
  > I don't see that being appropriate for a very long time.
  >

That was regarding gettimeofday, but should apply equally to
settimeofday.

I don't see how these two positions are reconciled:

  * get/settimeofday will be supported for the foreseeable future

  * settimeofday will be intentionally broken to prevent an 'accident'
    when using the 28 year old expected behavior.

Below is a table that I wrote for hwclock(8) to aid source readers in
understanding the block of code that follows it:

  *
  * +-------------------------------------------------------------------+
  * |                       settimeofday(tv, tz)                        |
  * |-------------------------------------------------------------------|
  * |     Arguments     |  System Time  | PCIL |           | warp_clock |
  * |   tv    |   tz    | set  | warped | set  | firsttime |   locked   |
  * |---------|---------|---------------|------|-----------|------------|
  * | pointer | NULL    |  yes |   no   |  no  |     1     |    no      |
  * | pointer | pointer |  yes |   no   |  no  |     0     |    yes     |
  * | NULL    | ptr2utc |  no  |   no   |  no  |     0     |    yes     |
  * | NULL    | pointer |  no  |   yes  |  yes |     0     |    yes     |
  * +-------------------------------------------------------------------+
  * ptr2utc: tz.tz_minuteswest is zero (UTC).
  * PCIL: persistent_clock_is_local, sets the "11 minute mode" timescale.
  * firsttime: locks the warp_clock function (initialized to 1 at boot).
  *

Note the unique behavior when called with two arguments which cannot be
easily reproduced.

What I used to accomplish in hwclock(8) with one call, now takes *three*!



             reply	other threads:[~2020-02-11 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 15:34 J William Piggott [this message]
2020-02-11 17:03 ` Adhemerval Zanella
2020-02-11 20:44   ` J William Piggott
2020-02-18 10:34     ` Karel Zak
2020-02-12  1:02 ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YAK.7.77.849.2002111025400.1724@zhn.tzk.pbz \
    --to=elseifthen@gmx.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).