History log of /freebsd-11-stable/usr.sbin/tzsetup/tzsetup.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 364903 28-Aug-2020 philip

MFC r350079:

tzsetup: upgrade to zone1970.tab

zone.tab is deprecated. Install zone1970.tab alongside it, and use it
for tzsetup(8). This is also useful for other applications that need
the modern better maintained file.

PR: 243394
Submitted by: tmunro


# 338440 03-Sep-2018 delphij

MFC r337522:

In read_zones(), check if the file name actually fit in the buffer
and make sure it would terminate with nul with strlcpy().

Reviewed by: imp (earlier revision)
Differential Revision: https://reviews.freebsd.org/D16595


# 322375 10-Aug-2017 marius

MFC: r322097, r322203

- Since r301131, /etc/localtime is also installed when selecting UTC in
interactive configurations. Thus, the code added in r220172 which treats
a NULL zone file name as UTC and removes /etc/localtime in that case can
go again.
- Consistently refer to "could not delete" (as chosen by the oldest such
code in here) when unlink(2) fails instead of a to mixture of "delete"
and "unlink" in error messages.


# 319192 30-May-2017 ngie

MFC r306375,r307802:

r306375 (by emaste):

Add a WITHOUT_DIALOG src.conf(5) knob

It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup).

r307802 (by bapt):

Fix build of tzsetup when WITHOUT_DIALOG is set

Hide dialog specific code behind HAVE_DIALOG. It allows to build a stripped
down version (missing the dialog UI) but perfectly function tzsetup when
world is built WITHOUT_DIALOG

Reorganise a bit the code to limit the number of blocks under HAVE_DIALOG


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 301131 01-Jun-2016 smh

Fix tzsetup not installing /etc/localtime for UTC

If tzsetup UTC is run then it successfully configured the system for UTC
including installing /etc/localtime however if the user ran just tzsetup
for interactive configuration and select UTC no /etc/localtime was installed
which resulted in failures for utilities which require said file.

Change set_zone_utc to call install_zoneinfo("UTC") to ensure that
/etc/localtime is created for interactive UTC selection.

Users who have previously run tzsetup in interactive mode and select UTC
can install the missing /etc/localtime by running tzsetup -r.

Also correct static miss-match for set_zone_utc.

MFC after: 2 weeks
Relnotes: Yes
Sponsored by: Multiplay


# 300706 25-May-2016 truckman

Avoid buffer overflow or truncation when constructing path_zoneinfo_file.

Reported by: Coverity
CID: 1011160
MFC after: 1 week


# 298033 15-Apr-2016 araujo

Use NULL instead of 0 for pointers.

fgetln(3) will returns NULL if cannot get a line from a stream.
strsep(3) it will returns NULL if the end of the string was reached.
jemalloc(3) malloc will returns NULL if it cannot allocate memory.
fgetln(3) it will returns NULL if it cannot get a line from a stream.

MFC after: 4 weeks


# 290031 26-Oct-2015 delphij

Revert r289269 for now. After looking at share/zoneinfo/Makefile this could
potentially break non-root installs and we need a better solution, probably
by doing it differently when no UI is involved.


# 289269 13-Oct-2015 delphij

Use chroot(2) instead of using prefixes for files.

Previously, the code prefixes the chroot path to actual file paths to
simulate the effect. This, however, will not work for tzset(3) which
expects the current system have a working set of timezone data files,
and that is not always the case.

This changeset simplifies the handling of paths and use an actual
chroot(2) call to implement the effect.

PR: bin/197313
MFC after: 2 weeks


# 281733 19-Apr-2015 eadler

tzsetup: remove set but unused variable
- leave a comment explaining which variable it used to be

Reported by: gcc5.1


# 274399 11-Nov-2014 dteske

Fix whitespace.

Thanks to: nwhitehorn


# 274394 11-Nov-2014 dteske

Default `bsdconfig timezone' and `tzsetup' to `-s' in a VM.

Recommended by: cperciva
Reviewed by: cperciva
Relnotes: tzsetup and bsdconfig now assume that the "hardware" clock inside a VM is set to UTC


# 247780 04-Mar-2013 dteske

Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option.

PR: bin/164976
Submitted by: dteske


# 231181 08-Feb-2012 wollman

It's not an error if unlink(2) fails because the pathname doesn't exist.

Noticed by: kevlo
Pointy hat to: wollman


# 230520 25-Jan-2012 emaste

Clean up reinstall option and remove duplicate code

- Move the reinstall logic to be before menus are initialised
(menus are not needed when reinstalling a zonefile).

- Remove unnecessary re-initialization of path_db.

- Update variable name and error message because we now use the
zone name relative to /usr/share/zoneinfo, not the full path.

pr: bin/164041
Submitted by: Devin Teske <dteske vicor com>
MFC after: 1 week


# 230299 18-Jan-2012 emaste

Fix #ifdef VERBOSE for UTC case

Update verbose output to match what actually happens when selecting
the UTC option, and when the -n option is used.

Patch updated slightly for new libdialog.

PR: bin/164042
Submitted by: Devin Teske <dteske vicor com>
MFC after: 2 weeks


# 230296 18-Jan-2012 emaste

Don't write /var/db/zoneinfo when zone is not actually changed.

If the specified zone file does not exist or the -n flag is specified,
do not update /var/db/zoneinfo.

PR: bin/164039
Submitted by: Devin Teske <dteske vicor com>
MFC after: 1 week


# 230005 12-Jan-2012 wollman

Use a reasonable-sized buffer when formatting error messages about
installing zoneinfo. While we're in the vicinity, add some missing
error checking to eliminate an unhelpful error message when unlink()
fails.

/me is embarrassed by the quality of his 16-year-old code.
The whole thing is awful and could stand a complete rewrite.

PR: 164038
Submitted by: Devin Teske (but implemented differently)


# 228176 01-Dec-2011 fjoe

Sync xdialog_menu() implementation with sade.


# 227947 24-Nov-2011 fjoe

calloc +1 DIALOG_LISTITEM to prevent possible wild pointer access
in dlg_default_listitem().


# 227934 24-Nov-2011 fjoe

Port to new libdialog.


# 227011 02-Nov-2011 dougb

If the user is moving from any other time zone to UTC we need
to delete any old /var/db/zoneinfo file that may exist so that
tzsetup -r does the right thing.


# 222139 20-May-2011 ru

- add missing options and arguments to program's usage()
and sync it with manpage's SYNOPSIS

- generally clean up a manpage's formatting

Reviewed by: edwin


# 220172 30-Mar-2011 edwin

Add a menu entry for UTC in the main menu.

PR: bin/156019
Submitted by: Daniel O'Conner
Reviewed by: Garrett Cooper <gcooper@FreeBSD.org>
MFC after: 1 week


# 210243 19-Jul-2010 nork

Fix support for chrooted installs.

Approved by: imp (mentor)


# 209190 14-Jun-2010 emaste

Use literal format strings. Found by clang.


# 208831 05-Jun-2010 edwin

Add comment that this value is unused.
It is obvious that it isn't used, but both clang and Coverity talk about it.

Found with: Coverity Prevent(tm)
CID: 8066


# 208830 05-Jun-2010 edwin

When there is a problem with writing, also bail out.

Found with the clang checker.


# 198350 21-Oct-2009 edwin

- Add support for chrooted installs.
- Add examples to the man-page.

MFC after: 1 week


# 198267 20-Oct-2009 edwin

Instead of having to know which timezone was picked last time, you
now can run "tzsetup -r" which will reinstall the last choice. This
data is recorded in /var/db/zoneinfo.

MFC after: 1 week


# 198254 19-Oct-2009 edwin

When tzsetup is run as non-root and the "CMOS clock question on
UTC" is answered as No, it would abort without properly ending the
dialog session.

MFC after: 1 week


# 195339 04-Jul-2009 attilio

Add a new options (-s) that, when specified, skips the question about
adjusting the clock to UTC.
That avoids to write on /etc/wall_cmos_clock which is useful in some
cases (example: host user in a jail).

Sponsored by: Sandvine Incorporated
Initially submitted by: Matt Koivisto <mkoivisto at sandvine dot com>
Approved by: re (kib)


# 179530 03-Jun-2008 jkim

- Replace rcsid with __FBSDID.
- Remove paths.h and embed it in the source.
- Remove stale alpha support.
- Clean up compiler warnings and fix style(9) bugs.


# 179497 02-Jun-2008 jkim

Fix a crash when Arctic Ocean is selected.

MFC after: 1 week


# 133425 10-Aug-2004 murray

Update wording regarding geography to match the man page and web site.
Specifically, change the second level menu title from 'Country' to
'Country or Region', since e.g. Hong Kong is not a country.

Submitted by: Xin LI <delphij@frontfree.net>


# 123035 28-Nov-2003 olgeni

Cosmetic fix: a message was mixed with a dialog box border line.

Approved by: re (rwatson)


# 96647 15-May-2002 des

Explicitly cast NCONTINENTS to int to silence an overflow warning.


# 91728 06-Mar-2002 obrien

Default to UTC on sparc64 also.


# 75215 05-Apr-2001 obrien

Default the UTC question to "yes" on the Alpha.


# 70486 29-Dec-2000 ben

Convert to use the <sys/queue.h> macros rather than fiddling with the queue
structure internals.

Reviewed by: markm


# 70092 16-Dec-2000 jkh

Use dialog_noyes() for UTC selection; uses No as default answer now.


# 66907 09-Oct-2000 wollman

Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).


# 60938 26-May-2000 jake

Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by: msmith and others


# 60833 23-May-2000 jake

Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by: phk
Reviewed by: phk
Approved by: mdodd


# 56487 23-Jan-2000 charnier

Convert err() to errx(), reason is already provided. Complete the
abort on allocation failure instead of deferencing NULL later.


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49435 05-Aug-1999 ru

- ignore the user-supplied umask, set it to 0022 by default
- install /etc/wall_cmos_clock with 0444 mode rather than 0666
- -Wall inspection

PR: 12967


# 48121 23-Jun-1999 mharo

Make UTC or local time message a little more clear.


# 43544 02-Feb-1999 wollman

Add a `default' feature to tzsetup for use in script-driven installation
(if someone writes the other half). Also rewrite the man page in a more
appropriate (formal) style.


# 41852 16-Dec-1998 peter

Old stuff lying around a source tree:
Create/remove /etc/wall_cmos_clock without using system() and magic paths.


# 32394 10-Jan-1998 steve

Minor brace gymnastics so that /etc/wall_cmos_clock is really
created.

PR: 5473
Submitted by: MIHIRA Yoshiro <sanpei@yy.cs.keio.ac.jp>


# 30999 06-Nov-1997 joerg

Teach tzsetup to understand blank lines in the iso3166 file.

Found by: evanc@synapse.net (Evan Champion)


# 30763 27-Oct-1997 charnier

Add usage(). Document -n flag. Do not touch/remove /etc/wall_cmos_clock
when -n (do nothing) is used.


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 22815 16-Feb-1997 jkh

Ask about local or UTC here, like we used to.


# 22181 01-Feb-1997 jhay

At the end it was much simpler than I thought. 26 * 26 = 676 and not 576.
South Africa and a few other countries exists again. This fix pr 2595.
This should go into 2.2.


# 21915 21-Jan-1997 jkh

Make some of the less necessary user feedback #ifdef VERBOSE.

We could also make this stuff only come out when getpid() != 1
and thus avoid the install case (where it really is just too verbose,
and people have complained), but this seems less messy and no one
complained when tzsetup didn't print the final "things went fine!"
messages (which sort of contravene the UNIX spirit of only yelling
when you need to anyway).


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 19887 19-Nov-1996 joerg

Remove two uninitialized and unused variables that used to cause a
segfault before.


# 19872 19-Nov-1996 wollman

Completely re-vamped `tzsetup':

- It no longer attempts to fiddle wall-vs-UTC-in-RTC. The results
were just confusing most of the time.

- The program no longer contains a pre-compiled list of timezones
(compiled by groveling through the tzdata source files for comments
starting with `ZONE-DESCR'). Now it uses the new `zone.tab' file
supplied with current versions of the timezone data files, to determine
the list at run time. (It also requires the ISO 3166 table I
committed some months ago.)

AS A RESULT, this program will NOT work until the new timezone data files
are committed (should happen sometime soon).