clock_gettime() returns 0 if it succeeds, so don't capture that into the
fail logic. With this, WITH_DETECT_TZ_CHANGES successfully detects a
change after 61 seconds.
Reviewed by: imp, trasz
Differential Revision: https://reviews.freebsd.org/D33494
Implement optional timezone change detection for local time libc
functions. This is disabled by default; set WITH_DETECT_TZ_CHANGES
to build it.
Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #47
Differential Revision: https://reviews.freebsd.org/D30183
Note by imp: this is clearly a mis-merge from the vendor branch which
doesn't have this stutter in it.
Reviewed by: imp@,ngie@
Pull Request: https://github.com/freebsd/freebsd-src/pull/154
> Remove doaccess variable and access(2) call since this interfers with
> applications like zdump(8) because pledge(2) doesn't allow access(2) to
> /usr/share/zoneinfo.
>
> millert@ better described why this call can go away:
>
> "This looks like an attempt to do access checks based on the real uid instead
> of the effective uid. Basically for setuid programs we don't want to allow a
> user to set TZ to a path they should not be able to otherwise access.
>
> However, we already have a check for issetugid() above so I think the doaccess
> bits can just be removed and we can rely on open()."
>
> After discussion with tb@, deraadt@ and millert@, this was also OK'ed by them
Reviewed by: imp
Obtained from: OpenBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17701
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.
Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96
Previously we would truncate tm.tm_year for any time_t corresponding to
a year that does not fit in int. This issue was discovered because it
caused the bash-static build to fail when linking with LLD.
As reported by Rafael Espíndola:
Configure has
AC_FUNC_MKTIME
which expands to a test of mktime that fails with the freebsd
implementation. Given that, bash compiles a mktime.o file that
defines just mktime and uses localtime. That goes in a .a file
that is before libc.
The freebsd libc defines mktime in localtime.o, which also defines
localtime among other functions.
When lld sees an undefined reference to mktime from libc, it uses
the bash provided one and then tries to find a definition of
localtime. It is found on libc's localtime.o, but now we have a
duplicated error.
The reason it works with bfd is that bash doesn't use mktime
directly and the undefined reference from libc is resolved to the
libc implementation. It would also fail to link if bash itself
directly used mktime.
The bash-static configure test verifies that, for many values of t, either
localtime(t) returns NULL or mktime(localtime(t)) == t. This test failed
when localtime returned a truncated tm_year.
This was fixed in tzcode in 2004 but has persisted in our tree since
rS2708.
Reported by: Rafael Espíndola
Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9534
Don't warn about valid time zone abbreviations. POSIX
through 2000 says that an abbreviation cannot start with ':', and
cannot contain ',', '-', '+', NUL, or a digit. POSIX from 2001
on changes this rule to say that an abbreviation can contain only
'-', '+', and alphanumeric characters from the portable character
set in the current locale. To be portable to both sets of rules,
an abbreviation must therefore use only ASCII letters." Adapted
from tzcode2015f.
This is needed to be able to update tzdata to a newer version
MFC after: 3 days
This implements part of RFC-2217
It's based off a patch originally written by Sujal Patel at Isilon, and
contributions from other Isilon employees.
PR: 173728
Phabric: D995
Reviewed by: markj, markm
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
sufficiently from upstream (including a full whitespace commit and large
portions rewritten) that this change does not move us further from the
upstream.
PR: docs/186608
Submitted by: Jamie Landeg-Jones <jamie@dyslexicfish.net>
MFC after: 3 days
The stdtime sources were moved from lib/libc to contrib/tzcode, and tzfile.h
is not an installed header, so the man page refers to its location in the
source tree.
The documentation could be more clear about the internal nature of the
header, but those changes should go through upstream tzcode.
PR: docs/176864
Approved by: hrs (mentor)
asctime.c:
* Set errno to EINVAL and return "??? ??? ?? ??:??:?? ????\n" if
asctime_r is called with a NULL struct tm pointer. (Note that
asctime_r is called by ctime_r and asctime; asctime is called by
ctime.)
localtime.c:
* Set errno to EINVAL and return WRONG if time1 is called with a
NULL struct tm pointer; avoid dereference if a NULL struct tm
pointer is passed to timelocal, timegm, or timeoff. (Note that
time1 is called by mktime, timegm, and timeoff; mktime is called
by timelocal.)
* more core-avoidance work
* Change to set timezone and altzone based on time types with
greatest transition times (for the benefit of Asia/Seoul).
zic.8:
* Warning about case-sensitivity of names, but not of abbrevations
zic.c:
* Conditionally output extra types with most-recently-use offsets
last (for use by systems with pre-2011 versions of localtime.c,
helping to ensure that globals "altzone and "timezone" get set
correctly).
The code has been running for nearly four weeks on my laptop running
FreeBSD 8.1 without a problem.
MFC after: 1 month
The Makefiles are leftovers from the copies and should live in usr.sbin/zic/*
From usr.sbin/zic:
The sources are from a vendor contributed source, therefore should
live in contrib/tzcode/zic.