Re: [PATCH]: Fix for several getdate.y issues
Ondřej Vašík wrote: Jim Meyering wrote: Would you mind separating that into a few separate change sets? ... I hope I will do the rest of patches ( 1 or 2 more are still necessary to cover all the issues I found). Here is the second set of patches. First one (getdate_4) addresses issue with countable dayshift (like next yesterday, last tomorrow etc. . I dropped the change of adding tWEEK_UNIT as this is not necessary for functionality of the changes. Second one (getdate_5) addresses signed relative time offset issue. That was not possible until time zone is specified(only case where it was allowed was the hybrid section solution). Grammar before the patch handles any signed number as timezone (as empty o_colon_minutes and o_merid section handles anything like valid). I added grammar for signed numbers without time offset unit (which will handle old required behaviour of o_colon_minutes and o_merid) and added grammar for signed relative time offset. date_2 patch is for coreutils and mentions changes in NEWS and adds one test (getdate_5 patch related). Total number of shift/reduce conflicts is 32 (which is 4 lower than 36 in the first all-in-one patch - as there is no tWEEK_UNIT token type). Increase of the shift/reduce conflicts is caused by o_colon_minutes and o_merid change - which was required for the functionality of the patch_5. Greetings, Ondrej Vasik From 0f60536a86f4a8e1c657d9d31348a366d74d5e3b Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED] Date: Mon, 30 Jun 2008 16:48:17 +0200 Subject: [PATCH] *lib/getdate.y: prevent usage of invalid date syntax of countable ordinal dayshift e.g. 40 yesterday or next yesterday Signed-off-by: Ondřej Vašík [EMAIL PROTECTED] --- lib/getdate.y | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index f33c0a4..93e8e6f 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -292,7 +292,7 @@ extract_hhmmss (parser_control *pc, long int ho, long int mi, time_t sec, long i %token tAGO tDST %token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT -%token intval tDAY_UNIT +%token intval tDAY_UNIT tDAY_SHIFT %token intval tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN %token intval tMONTH tORDINAL tZONE @@ -522,6 +522,8 @@ relunit: { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; } | tDAY_UNIT { $$ = RELATIVE_TIME_0; $$.day = $1; } + | tDAY_SHIFT + { $$ = RELATIVE_TIME_0; $$.day = $1; } | tORDINAL tHOUR_UNIT { $$ = RELATIVE_TIME_0; $$.hour = $1; } | tUNUMBER tHOUR_UNIT @@ -668,10 +670,10 @@ static table const time_units_table[] = /* Assorted relative-time words. */ static table const relative_time_table[] = { - { TOMORROW, tDAY_UNIT, 1 }, - { YESTERDAY,tDAY_UNIT, -1 }, - { TODAY, tDAY_UNIT, 0 }, - { NOW, tDAY_UNIT, 0 }, + { TOMORROW, tDAY_SHIFT, 1 }, + { YESTERDAY,tDAY_SHIFT, -1 }, + { TODAY, tDAY_SHIFT, 0 }, + { NOW, tDAY_SHIFT, 0 }, { LAST, tORDINAL, -1 }, { THIS, tORDINAL, 0 }, { NEXT, tORDINAL, 1 }, -- 1.5.2.2 From 4a31fd8c749229be352d2045d4aecd3a125bbad7 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED] Date: Mon, 30 Jun 2008 17:32:28 +0200 Subject: [PATCH] *lib/getdate.y: Allow usage of relative signed time offset even before time zone is specified. Signed-off-by: Ondřej Vašík [EMAIL PROTECTED] --- lib/getdate.y | 56 +--- 1 files changed, 45 insertions(+), 11 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index 93e8e6f..ff7850c 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1,8 +1,8 @@ %{ /* Parse a string into an internal time stamp. - Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software - Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -278,8 +278,8 @@ extract_hhmmss (parser_control *pc, long int ho, long int mi, time_t sec, long i %parse-param { parser_control *pc } %lex-param { parser_control *pc } -/* This grammar has 20 shift/reduce conflicts. */ -%expect 20 +/* This grammar has 32 shift/reduce conflicts. */ +%expect 32 %union { @@ -371,7 +371,43 @@ time: pc-zones_seen++; pc-time_zone = time_zone_hhmm (pc, $6, $7); } - ; + | tUNUMBER ':' tUNUMBER relunit_snumber + { + extract_hhmmss (pc, $1.value, $3.value, 0, 0); + pc-meridian = MER24; + extract_relative_time (pc, $4, 1); + } + | tUNUMBER ':' tUNUMBER ':' unsigned_seconds relunit_snumber + { + extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec); + pc-meridian = MER24; + extract_relative_time (pc, $6, 1); + } + | tUNUMBER ':' tUNUMBER + { + extract_hhmmss (pc, $1.value, $3.value, 0, 0); +
Re: [PATCH]: Fix for several getdate.y issues
Ondřej Vašík [EMAIL PROTECTED] wrote: ... From 4c9db16207b5c76bb85b05ee5853c525372bb80a Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED] Date: Fri, 27 Jun 2008 16:32:28 +0200 Subject: [PATCH] *lib/getdate.y: Do not ignore specified time zone when relative offset for days/months/years is specified. It's good to have each fix in a separate change set. Thanks. Would you please add a unit test to exercise each bug-fixing change? That should make it very clear, e.g., what effect the above change will have. Now that Simon has added tests/test-getdate.c, it should be clear how to add new unit tests. To run getdate's tests, do this: ../gnulib/gnulib-tool --with-tests --test getdate assuming you have a sibling gnulib directory. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: [PATCH]: Fix for several getdate.y issues
Ondřej Vašík [EMAIL PROTECTED] wrote: Jim Meyering wrote: ... From 4c9db16207b5c76bb85b05ee5853c525372bb80a Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED] Date: Fri, 27 Jun 2008 16:32:28 +0200 Subject: [PATCH] *lib/getdate.y: Do not ignore specified time zone when relative offset for days/months/years is specified. Signed-off-by: Ondřej Vašík [EMAIL PROTECTED] --- lib/getdate.y | 40 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index 1deec51..7b55c31 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1436,26 +1436,7 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) ... - /* Add relative date. */ +/* Add relative date. */ That indentation-only change appears to be unnecessary. It looks like your factorization change (#2) can be applied first, and if so, I'll apply it shortly. For the remainder, when you resend with unit-test additions, please post them one per message. Also, do consider whether any of these changes merit changes to the documentation in doc/getdate.texi. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: tee logs no output if stdout is closed
Andreas Schwab wrote: It seems to me that tee should have a SIGPIPE handler which closes the broken fd and stops trying to write to it, and if ALL outputs have been closed, exit. That would not be compatible with POSIX. In what way? Also, won't ignoring SIGPIPE cause problems later when tee tries to write() to the broken fd and gets back an error? ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: tee logs no output if stdout is closed
Bruno Haible [EMAIL PROTECTED] wrote: Andreas Schwab wrote: How about adding an option '-p' to 'tee', that causes it to ignore SIGPIPE while writing to stdout? Just add a trap '' SIGPIPE before starting tee. Thanks, this does half of the trick: Each 'tee' invocation then writes the complete stdin contents to the log file. But each 'tee' invocation also complains: tee: standard output: Broken pipe tee: write error tee: standard output: Broken pipe tee: write error ... I don't see any better solution than putting support for this into 'tee' itself. Jim, here's a patch. From 9813ded2983b0a7f276dc249e68a246bf9c1686a Mon Sep 17 00:00:00 2001 From: Bruno Haible [EMAIL PROTECTED] Date: Tue, 1 Jul 2008 02:22:10 +0200 Subject: [PATCH] New tee option -p. * src/tee.c (ignore_sigpipe): New variable. (long_options): Add option -p. (usage): Document option -p. (main): Handle option -p. (tee_files): When option -p is specified, ignore SIGPIPE write errors. * doc/coreutils.texi (tee invocation): Document option -p. Hi Bruno, Thanks for the patch, but I'm reluctant to use it in part because it covers only the write syscalls deriving from tee's explicit fwrite call. It does not handle an EPIPE failure that comes of a close_stdout-induced write syscall, so you'd still get the offending diagnostics some of the time. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: tee logs no output if stdout is closed
Phillip Susi [EMAIL PROTECTED] writes: Andreas Schwab wrote: It seems to me that tee should have a SIGPIPE handler which closes the broken fd and stops trying to write to it, and if ALL outputs have been closed, exit. That would not be compatible with POSIX. In what way? It would match the behaviour as defined by ASYNCHRONOUS EVENTS in 1.11 Utility Description Defaults. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils