| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of
_GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED.
* lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the
declaration.
* lib/c-stack.c (null_action, segv_handler, overflow_handler,
c_stack_action): Likewise.
* lib/chown.c (chown): Likewise.
* lib/clean-temp-simple.c (cleanup_action): Likewise.
* lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization,
fts_set): Likewise.
* lib/getgroups.c (getgroups): Likewise.
* lib/getopt.c (_getopt_initialize): Likewise.
* lib/getugroups.c (getugroups): Likewise.
* lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread,
gl_locale_name_posix, gl_locale_name_environ): Likewise.
* lib/mkdir.c (rpl_mkdir): Likewise.
* lib/mkfifo.c (mkfifo): Likewise.
* lib/mkfifoat.c (mkfifoat): Likewise.
* lib/mknod.c (mknod): Likewise.
* lib/mknodat.c (mknodat): Likewise.
* lib/mountlist.c (me_remote): Likewise.
* lib/openpty.c (openpty): Likewise.
* lib/parse-datetime.y (yyerror): Likewise.
* lib/passfd.c (sendfd, recvfd): Likewise.
* lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init,
pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal,
pthread_cond_broadcast, pthread_cond_destroy): Likewise.
* lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init,
pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock,
pthread_mutex_unlock, pthread_mutex_destroy): Likewise.
* lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init,
pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise.
* lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock,
pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy):
Likewise.
* lib/pthread-thread.c (pthread_attr_destroy): Likewise.
* lib/readlink.c (readlink): Likewise.
* lib/rename.c (rpl_rename): Likewise.
* lib/set-permissions.c (set_permissions): Likewise.
* lib/sockets.c (gl_sockets_startup): Likewise.
* lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime,
stat_time_normalize): Likewise.
* lib/strptime.c (__strptime_internal): Likewise.
* lib/strtod.c (LDEXP): Likewise.
* lib/symlink.c (symlink): Likewise.
* lib/symlinkat.c (symlinkat): Likewise.
* lib/tempname.c (try_dir, try_nocreate): Likewise.
* lib/textstyle.in.h (styled_ostream_begin_use_class,
styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref,
styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink,
styled_ostream_flush_to_current_style, fd_ostream_create,
term_ostream_get_color, term_ostream_set_color,
term_ostream_get_bgcolor, term_ostream_set_bgcolor,
term_ostream_get_weight, term_ostream_set_weight,
term_ostream_get_posture, term_ostream_set_posture,
term_ostream_get_underline, term_ostream_set_underline,
term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id,
term_ostream_set_hyperlink, term_ostream_create,
term_styled_ostream_create, html_styled_ostream_create,
handle_color_option, handle_style_option, style_file_prepare,
styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise.
* lib/unicodeio.c (exit_failure_callback, fallback_failure_callback):
Likewise.
* lib/wait-process.c (cleanup_slaves_action): Likewise.
* tests/signature.h (SIGNATURE_CHECK2): Likewise.
* tests/test-areadlink.c (do_areadlink): Likewise.
* tests/test-areadlinkat.c (do_areadlinkat): Likewise.
* tests/test-ceilf-ieee.c (main): Likewise.
* tests/test-ceilf1.c (main): Likewise.
* tests/test-dirent.c (dir): Likewise.
* tests/test-fchownat.c (main): Likewise.
* tests/test-fdopendir.c (main): Likewise.
* tests/test-filenamecat.c (main): Likewise.
* tests/test-floor1.c (main): Likewise.
* tests/test-floorf-ieee.c (main): Likewise.
* tests/test-floorf1.c (main): Likewise.
* tests/test-fseeko.c (main): Likewise.
* tests/test-fstatat.c (main): Likewise.
* tests/test-ftello.c (main): Likewise.
* tests/test-getdomainname.c (main): Likewise.
* tests/test-getgroups.c (main): Likewise.
* tests/test-gethostname.c (main): Likewise.
* tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise.
* tests/test-mkdirat.c (main): Likewise.
* tests/test-openat.c (main): Likewise.
* tests/test-parse-datetime.c (main): Likewise.
* tests/test-quotearg-simple.c (main): Likewise.
* tests/test-quotearg.c (main): Likewise.
* tests/test-sethostname2.c (main): Likewise.
* tests/test-unlinkat.c (main): Likewise.
* tests/test-version-etc.c (main): Likewise.
* tests/test-xalloc-die.c (main): Likewise.
* tests/test-xfprintf-posix.c (main): Likewise.
* tests/test-xprintf-posix.c (main): Likewise.
* tests/test-xvasprintf.c (main): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This splits the old parse-datetime into two parts; the
first is parse-datetime2 which supports all the new bells
and whistles, the second is parse-datetime, which reverts to
its original intent. This avoids some bogus diagnostics
when build GNU Tar with gcc -flto -fanalyze and
with --enable-gcc-warnings. And it slims down the
executable a bit.
* NEWS: Mention this.
* lib/parse-datetime.y (parser_control) [!GNULIB_PARSE_DATETIME2]:
Omit parse_datetime_debug member.
(debugging): New function. Use it everywhere the old code
would load parse_datetime_debug.
(parse_datetime_body): New static function, with the body
of the old parse_datetime2. Set pc.parse_datetime_debug
only if GNULIB_PARSE_DATETIME2.
(parse_datetime2, parse_datetime): Use this new function.
(parse_datetime2) [!GNULIB_PARSE_DATETIME2]: Remove.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y: Include idx.h.
(textint): Mark digits as nonnegative.
(parser_control): Mark dates_seen, days_seen, local_zones_seen,
dsts_seen, times_seen, zones_seen as nonnegative.
(lookup_word): Mark wordlen as nonnegative.
(yylex): Mark count as nonnegative.
(parse_datetime2): Mark tzsize as nonnegative.
* modules/parse-datetime (Depends-on): Add idx.
|
|
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2): Fix format typo in
previous patch to this file. Problem reported by Chris Elvidge in
<https://bugs.gnu.org/44763#32>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When parse-datetime.y’s overflow code was written, INT_ADD_WRAPV
did not work for unsigned destinations, and since time_t might
be unsigned that meant it did not work for time_t destinations.
This limitation of INT_ADD_WRAPV has been fixed, so we can
now streamline parse-datetime.y a bit.
* lib/parse-datetime.y: Do not include limits.h, as LONG_MAX
has not been used for a while.
(yylex, parse_datetime2): Assume C99 declarations after statements.
(yyles): Use INT_SUBTRACT_WRAPV instead of an explicit comparison
to TYPE_MINIMUM.
(parse_datetime2): No need for time_overflow now that
INT_ADD_WRAPV works for unsigned results.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/argp.h (_GL_ATTRIBUTE_FORMAT): Remove macro.
* lib/argp-fmtstream.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-snprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-vsnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/c-xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/error.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/parse-datetime.y (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/vasnprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
* lib/xvasprintf.h (_GL_ATTRIBUTE_FORMAT): Likewise.
|
| |
|
|
|
|
|
|
| |
This is a clerical change that mostly changes http: to https: in URLs
where either will work. It also updates some URLs that have moved,
removes some URLs that no longer work, and fixes related text.
|
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y (zone):
follow-up to the previous commit: the 'T' case is handled outside the
conversion table (used as either military timezone UTC-7 or ISO8601
separator). Change it from "HOUR(7)" to "-HOUR(7)" to match other
timezone letters.
|
|
|
|
|
|
|
| |
Problem and trivial fix reported by Neil Hoggarth in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html
* lib/parse-datetime.y (military_table):
Do it the right way, not the RFC 822 way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y: Use "%define api.pure" rather than obsolescent
"%pure-parser". The former is available since Bison 2.3b (2008, [1]),
while the latter is marked as obsolete since version 3.4 (May 2019, [2]):
./lib/parse-datetime.y:568.1-12: warning: deprecated directive, \
use '%define api.pure' [-Wdeprecated]
568 | %pure-parser
| ^~~~~~~~~~~~
[1] https://git.sv.gnu.org/cgit/bison.git/commit/?id=d9df47b656fd
[2] https://git.sv.gnu.org/cgit/bison.git/commit/?id=de5207244b5c
|
| |
|
|
|
|
|
| |
* lib/parse-datetime.y (mktime_ok): Simplify.
Remove args TZ and T; no longer needed. Callers changed.
|
| |
|
|
|
|
|
|
|
| |
Bruno Haible reported the build failure in
https://lists.gnu.org/r/bug-gnulib/2018-06/msg00066.html
* lib/parse-datetime.y (parse_datetime2): Remove leading "static"
on declaration of new local.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2): Save RELATIVE_TIME_0 into
a function local prior to the first "goto fail". The prior use would
evoke this:
parse-datetime.y: In function 'parse_datetime2':
parse-datetime.y:1791:19: error: jump skips variable initialization \
[-Werror=jump-misses-init]
parse-datetime.y:2385:2: note: label 'fail' defined here
parse-datetime.y:188:43: note: '({anonymous})' declared here
parse-datetime.y:1841:12: note: in expansion of macro 'RELATIVE_TIME_0'
|
| |
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2):
* lib/posixtm.c (posixtime):
Do not access uninitialized storage, even though the resulting
value is never used.
|
| |
|
|
|
|
|
|
|
| |
Reported by Bruno Haible in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00038.html
* lib/parse-datetime.y (parse_datetime2): Do not use
uninitialized.
|
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2): Cleanup on
localtime_rz() failure.
|
|
|
|
|
|
| |
* lib/parse-datetime.y: Include <stdarg.h>, for va_start etc.
(_GL_ATTRIBUTE_FORMAT): New macro.
These are needed to get './gnulib-tool --test parse-datetime' to work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
%z problem reported by Pádraig Brady in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00103.html
While fixing it, I decided to prefer signed ints to size_t, as
they are less error-prone (e.g., ubsan catches overflow).
* lib/parse-datetime.y (textint, parser_control, lookup_word, yylex)
(parse_datetime2): Prefer ptrdiff_t to size_t for sizes and object
counts, since signed integers make for better debugging.
(date): Don’t assume %z works in printf formats.
(debug_strfdatetime, debug_strfdate, debug_strftime): Use int for
sizes of buffers known to be small, e.g., because we’re using snprintf.
(parse_datetime2): Simplify call to debug_mktime_not_ok.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This long patch was triggered by this bug report from Ruediger Meier:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00028.html
I fixed the bug he noted, then found some others nearby, and then
still others. Oh my goodness, there were a lot of bugs. I cleaned
up some of the code to follow GNU standards while I was at it.
* lib/parse-datetime.y (ISDIGIT): Remove; all callers changed to
use c_isdigit.
(EPOCH_YEAR): Remove; unused.
(TM_YEAR_BASE): Now an enum rather than a macro.
(HOUR, debug_strfdatetime): Multiply hour by 3600, not 60, to get
time zone offset, since timezones now are in terms of seconds and
not minutes.
(long_time_t): Remove. All uses replaced by time_t or intmax_t as
appropriate. Verify that intmax_t is wide enough.
(time_overflow, time_zone_str): New functions, used to deal
more reliably with overflow.
(dbg_printf): Add printf attribute, to help catch integer width errors.
(textint, relative_time, parser_control, time_zone_hhmm, set_hhmmss)
(%union, to_hour, yylex, parse_datetime2):
Use intmax_t instead of long int and/or long_time_t.
All uses changed.
(DBGBUFSIZE): Move earlier.
(relative_time, set_hhmmss, parser_control):
Just use int for nanoseconds and for time zones; that’s wide enough.
(parser_control): Use bool for members like year_seen that can
be booleans instead of counters. All uses changed.
Remove debug_default_input_timezone; no longer needed.
All uses removed.
(apply_relative_time): Return a bool overflow flag.
All uses changed to check for overflow.
(apply_relative_time, zone, date, relunit, relunit_snumber)
(signed_seconds, unsigned_seconds, yylex, parse_datetime2):
Check for integer overflow portably.
(str_days): Use just int for N, as it’s wide enough.
Prefer 2D char arrays to arrays of char * when it looks like
2D is a win on typical platforms.
Prefer snprintf to strncpy/strncat, for simplicity;
all buffers are smaller than INT_MAX so this is safe.
(TIME_ZONE_BUFSiZE, TM_YEAR_BUFSIZE): New constants.
(debug_print_current_time): Don’t assume tv_nsec is of type long,
as this is not true on x32. Output "." before any nanoseconds.
(debug_print_current_time, parse_datetime2):
Output local zones using a more-consistent format.
(debug_print_current_time, date, parse_datetime2):
(main) [TEST]:
Don’t assume time_t is the same width as long.
(print_rel_part): New function, replacing ...
(PRINT_REL_PART): ... this macro, which was removed. All uses changed.
(debug_print_relative_time): Use bool for boolean.
(local_zone): dsts_seen now counts only tDST instances.
(date): Fix printf of size_t to use %z. Do not assume numeric
tokens have negative values merely because the context suggests
a syntax with "-" separating tokens.
(time_zone_hhmm): Return bool success indicator, which checks for
overflow. Store result into PC->time_zone instead. All callers
changed.
(tm_year_str): New function. Return a bool success indicator and
store the result into a buffer. All callers changed. Output the
numerically correct string even if adding 1900 to the year would
overflow.
(to_tm_year): New function, replacing the old to_year. All
callers changed.
(tm_diff): Sync with glibc.
(lookup_word): Use to_uchar instead of doing it by hand.
(TZBUFSIZE): Now local to the only function that needs it.
(debug_strfdatetime): Simplify now that time zones are int seconds.
(debug_strfdate): Work even if tm_year + 1900 would overflow.
(get_effective_timezone): Remove. All uses removed.
(parse_datetime2): Use fprintf in pieces instead of snprintfing
to a fixed-size buffer. Don’t assume that gmtime succeeds iff
localtime succeeds. Use tm_gmtoff if available. Simplify how
‘goto fail;’ works in conjunction with the ‘ok’ flag.
* m4/parse-datetime.m4 (gl_PARSE_DATETIME): Don’t define
TIME_T_FITS_IN_LONG_INT, as it is no longer needed.
* modules/parse-datetime (Depends-on): Add inttypes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This API change was prompted by a report by Pádraig Brady in:
https://bug.debian.org/851934#10
To help fix the bug, make parse_datetime2 more reentrant.
* NEWS: Document this incompatible change.
* lib/parse-datetime.h, lib/parse-datetime.y (parse_datetime2):
Add two arguments, the timezone and the timezone name.
All callers changed. If TZ="..." is specified, use it for
calculating defaults.
* lib/parse-datetime.y: Don't include xalloc.h or use xmalloc, as
this code should be usable in a library.
(mktime_ok, get_effective_timezone):
Accept timezone arg too. All callers changed.
(get_tz): Remove.
(get_effective_timezone): Check for failures.
* modules/parse-datetime: Add time_r, time_rz. Remove xalloc.
|
|
|
|
| |
Use the spelling "timestamp", as that is what POSIX uses.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Input dates such as
date -d "Apr 11 22:59:00 2011"
are parsed as date (Apr 11, with default year 2016), then time, then a
number (2011). Based on the combination of previously seen tokens,
'digits_to_date_time' determines 2011 to be a year value.
This fixes the debug messages to correctly show the updated year.
Before:
$ date --debug -d 'Apr 11 22:59:00 2011'
date: parsed date part: (Y-M-D) 2016-04-11
date: parsed time part: 22:59:00
date: parsed number part: today/this/now
After:
$ ./src/date --debug -d 'Apr 11 22:59:00 2011'
date: parsed date part: (Y-M-D) 2016-04-11
date: parsed time part: 22:59:00
date: parsed number part: year: 2011
* lib/parse-datetime.y (struct parser_control): Add 'year_seen',
'debug_year_seen' member fields.
(digits_to_date_time): Update 'year_seen' as needed.
(debug_print_current_time): Inform about year updates.
(parse_datetime2): Initialize year_seen,debug_year_seen member fields.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"Local timezones" are strings that affect only DST relative to the
default timezone. The debug messages in parse-datetime.y printed
wrong information when encountering local timezones.
Examples:
Here EET/EEST are time zones ('zone' token, with values +02:00/+03:00):
TZ=Asia/Tokyo ./src/date --debug -d '2011-12-11 EET'
TZ=Asia/Tokyo ./src/date --debug -d '2011-06-11 EEST'
When the default timezone relates to the zone strings, EET/EEST are
parsed as local timezones (tLOCAL_ZONE), and only change the DST
value (0/1, respectively):
TZ=Europe/Helsinki ./src/date --debug -d '2011-12-11 EET'
TZ=Europe/Helsinki ./src/date --debug -d '2011-06-11 EEST'
* lib/parse-datetime.y (debug_print_current_time): If local timezone was
seen, inform about DST change, don't print actual timezone.
(debug_strfdatetime): If local timezone was seen, use default timezone
(and adjust as needed) instead of using incorrect timezone.
(parse_datetime2): Use correct time-zone source string, and adjust
default timezone as needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Incorrect date arithmetic due to daylight saving time (DST) are a
common (false) bug report in coreutils.
Detect two such cases and print a warning:
1. year/month/day adjustments (performed on 'struct tm'),
where 'mktime' returns a different isdst value.
2. hour/minute/seconds/ns adjustments (performed on 'time_t'),
where the result of 'localtime(3)' on the value will return a
different isdst value.
Note: DST changes could be harmless or unnoticeable.
Examples (with 'TZ=America/New_York'):
Unnoticeable: result is 2016-Dec-14
$ date -d '2016-06-15 EDT + 6 months' +%b
Dec
Unnoticeable: result is 2016-Dec-15 11:00:00
$ date -d '2016-06-15 12:00:00 EDT + 6 months' +%F
2016-12-15
This is unexpected:
$ date -d '2016-06-01 EDT + 6 months' +%F
2016-11-30
The new debug warnings will show:
$ ./src/date --debug -d '2016-06-01 EDT + 6 months' +%F
...
date: warning: daylight saving time changed after date adjustment
...
* lib/parse-datetime.y (parse_datetime2): Detect DST changes, and print
an appropriate warning message.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Date arithmetic are done directly on the fields of 'struct tm',
which can result in invalid dates. Normalization with 'mktime(3)'
will then produce a different date - which might cause unexpected results.
Examples:
'2016-10-31 - 1 month' => 2016-09-31 normalized to 2016-10-01.
'2016-02-29 + 1 year' => 2017-02-29 normalized to 2017-03-01.
Note that date normalization is not inherently wrong and not rejected,
as it has legitimate uses:
'2016-12-29 + 5 days' => 2016-12-34 noramlized to 2017-01-03.
If the user asked to adjust months but 'mday' changed,
or user asked to adjust years but 'month' changed - warn about it.
$ ./src/date --debug -d '2016-10-31 - 1 month'
...
date: warning: when adding relative months/years, \
it is recommended to specify the 15th of the month
...
date: warning: month/year adjustment resulted in shifted dates:
date: adjusted Y M D: 2016 09 31
date: normalized Y M D: 2010 10 01
...
* lib/parse-datetime.y (parse_datetime2): Detect such cases and print
a warning message. Improve recommendation of when to use 15 of the month
or noon for date arithmetic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Relative part (e.g '+8 days') after a timezone string was not reported
(was only reported after a timezone number). Due to the parser's structure,
timezone strings with numbers were handled separately.
before:
# Timezone number + relative part: OK
$ ./src/date --debug +%F -d '2013-10-30 00:00:00 +00:00 -8 days'
...
date: parsed relative part: -8 day(s)
# Timezone string + relative part: missing
$ ./src/date --debug +%F -d '2013-10-30 00:00:00 UTC -8 days'
[ missing message ]
After: messages are printed in both cases.
* lib/parse-datetime.y ('zone' token): Call debug_print_relative_time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A lone number is an absolute value, not a relative time part.
before:
$ date --debug -d '20130101'
date: parsed number part: today/this/now
After:
$ ./src/date --debug -d '20130101'
date: parsed number part: (Y-M-D) 2013-01-01
* lib/parse-datetime.y ('item'/'number' tokens): Call
'debug_print_current_time' instead of 'debug_print_relative_time'.
|
|
|
|
|
|
|
|
|
|
| |
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (TYPE_WIDTH): New macro.
(TYPE_MAXIMUM, _GL_SIGNED_INT_MAXIMUM, INT_STRLEN_BOUND):
* lib/ftoastr.h (_GL_FLOAT_DIG_BITS_BOUND):
* lib/parse-datetime.y (parse_datetime2):
Use it.
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2): If we parse
all of the input but determine it's invalid, ensure
we don't output the now invalid input pointer.
This issue was seen with `date -d 'now +1'`.
|
|
|
|
| |
* lib/parse-datetime.y (parse_datetime2): Fix typo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow-up to commit 12ad79069 ("add optional debug printing").
Improve parse-datetime's debug implementation: remove macros,
replace global debug flag variable with a function parameter,
use nstrftime for formatting.
See: https://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00021.html
* lib/parse-datetime.h: (parse_datetime_debug): Remove global extern
declaration.
(parse_datetime2): New function, accepts 'flags' parameter, supporting
debug flag. Existing interface 'parse_datetime' left unmodified.
* lib/parse-datetime.c: (parse_datetime_debug): Remove global variable.
(struct parser_control): add 'parse_datetime_debug' member variable.
(parse_datetime): Call new function 'parse_datetime2' without debug.
(parse_datetime2): Adapted from previous 'parse_datetime', initialize
pc.parse_datetime_debug variable as needed.
(to_year): Accept new flags parameter, instead of using global variable.
(debug_print_current_time,debug_print_relative_time,debug_mktime_not_ok):
use struct 'debug' variable instead of global variable.
(DEBUG,DEBUG_PRINT_CURRENT_TIME,DEBUG_PRINT_RELATIVE_TIME,
DEBUG_MKTIME_NOT_OK,PROGRESS,PROGRESS0): Remove macros. Call
correspnding functions directly instead of using macros.
* modules/parse-datetime: Add gnulib's strftime module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Print parsing information, warnings, and errors to stderr.
* lib/parse-datetime.h (parse_datetimte_debug): New global variable.
* lib/parse-datetime.y:
(DEBUG_*): Macros calling debug functions if debugging is enabled.
(PROGRESS*): Same as DEBUG, for progress reporting.
(dbg_printf): Print message to stderr, with 'date' prefix.
(struct parser_control): Add 'debug_*_seen' variables.
(str_days): Converts day ordinal/number to string (e.g. 'last wed').
(debug_print_current_time, debug_print_relateive_time): Prints the
current/relative date/time value of parser_control.
(YACC parser syntax): Print parsed parts with DEBUG_* macros.
(to_year): Warn about 2-digit year parsing.
(yylex): Warn about unrecognized words.
(get_effective_timezone): Returns current timezone in minutes.
(debug_strf{time,date,datetime}): Convert 'struct tm' to string as
clearly and unambigiously as possible.
(debug_mktime_not_ok): Print detailed information about failed
date/time values.
(parse_datetime): Add DEBUG messages for failures, warnings. Add
PROGRESS messages for status messages.
* modules/parse-datetime: Add 'timegm', 'gettext-h' dependencies.
|
|
|
|
|
|
|
|
|
|
| |
* build-aux/gendocs.sh (version):
* doc/gendocs_template:
* doc/gendocs_template_min:
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR):
Update copyright dates by hand in templates and the like.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
| |
* doc/gnulib.texi:
* lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date.
* all files: Run 'make update-copyright'.
|
|
|
|
|
|
| |
* lib/parse-datetime.y (yylex): Use the same prototype in the
function definition as the declaration, to avoid a -Wstrict-prototypes
warning seen when using byacc.
|
|
|
|
|
|
| |
* lib/parse-datetime.y (yylex): Compare pointer to end of buffer,
instead of calculating difference of pointers. This removes an
annoying warning, devoid of any use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was reported in http://bugs.gnu.org/16872
from the coreutils command: date -d 'TZ="""'
The infinite loop for this case was present since the
initial TZ="" parsing support in commit de95bdc2 29-10-2004.
This was changed to a crash or heap corruption depending
on the platform with commit 2e3e4195 18-01-2010.
* lib/parse-datetime.y (parse_datetime): Break out of the
TZ="" parsing loop once the second significant " is found.
Also skip over any subsequent whitespace to be consistent
with the non TZ= case.
* tests/test-parse-datetime.c: Add test cases for TZ="" parsing.
|
|
|
|
|
|
| |
I ran 'make update-copyright'.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recent versions of 'clang' complain about C source code that
uses expressions of the form '"string literal" + integer',
I guess on the theory that it's confusing for readers who are
used to C++. On those grounds I suppose it's OK to make this
minor style change.
* lib/parse-datetime.y (parse_datetime):
* tests/test-fchdir.c (main):
* tests/test-snprintf-posix.h (test_function):
* tests/test-snprintf.c (main):
* tests/test-vasnprintf-posix.c (test_function):
* tests/test-vasnprintf.c (test_function):
* tests/test-vsnprintf.c (main):
* tests/unistdio/test-ulc-asnprintf1.h (test_function):
Rewrite '"str" + E' to '&"str"[E]'.
|
|
|
|
|
|
| |
Run "make update-copyright". Compare to commit 1602f0a from last year.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
* lib/parse-datetime.y (to_uchar):
* lib/parse-duration.c (str_const_to_ul, str_const_to_l)
(scale_n_add):
Now static, not static inline.
* m4/parse-datetime.m4 (gl_PARSE_DATETIME):
* modules/parse-duration (configure.ac):
Do not require AC_C_INLINE.
|
|
|
|
|
|
|
|
|
|
|
|
| |
date -d "$(printf '\xb0')" would print 00:00:00 with today's date
rather than diagnosing the invalid input. Now it reports this:
date: invalid date '\260'
* lib/parse-datetime.y (to_uchar): Define.
(yylex): Don't sign-extend "other" bytes.
* m4/parse-datetime.m4: Require AC_C_INLINE for first use of "inline".
Thanks to Bruno Haible for the patch to this file.
* tests/test-parse-datetime.c (main): Add a test to trigger the bug.
Peter Evans reported the bug in GNU date: http://bugs.gnu.org/11843
|
| |
|