From 7b56b4e7b60043d52d684e8799021d0303006691 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Tue, 27 Sep 2016 22:40:15 +0300
Subject: [PATCH] Ticket #3696: extfs: fix documentation of allowed date
formats.
We also improve the documentation of vfs_parse_filedate(), which does the
actual work.
Note that in the user-facing documentation (extfs/helpers/README) there are
two things we prefer *not* to mention about vfs_parse_filedate's ability:
* Accepting the format "MM-DD-YY hh:mm[:ss]", as this two-digit year is
more likely to confuse readers of such dates.
* Accepting '/', instead of '-', as the separator in MM-DD-YYYY. (Considering
that some scripts do use '/', maybe we should mention it?)
---
lib/vfs/parse_ls_vga.c | 38 +++++++++++++++++++++++++++-----------
src/vfs/extfs/helpers/README | 7 ++++---
2 files changed, 31 insertions(+), 14 deletions(-)
diff --git a/lib/vfs/parse_ls_vga.c b/lib/vfs/parse_ls_vga.c
index cba2475..33c6d41 100644
a
|
b
|
vfs_parse_filedate (int idx, time_t * t) |
543 | 543 | if (is_week (p, &tim)) |
544 | 544 | p = columns[idx++]; |
545 | 545 | |
| 546 | /* |
| 547 | ALLOWED DATE FORMATS |
| 548 | |
| 549 | We expect 3 fields max or we'll see oddities with certain file names. |
| 550 | |
| 551 | Formats that contain either year or time (the default 'ls' formats): |
| 552 | |
| 553 | * Mon DD hh:mm[:ss] |
| 554 | * Mon DD YYYY |
| 555 | |
| 556 | Formats that contain both year and time, to make it easier to write |
| 557 | extfs scripts: |
| 558 | |
| 559 | * MM-DD-YYYY hh:mm[:ss] |
| 560 | * MM-DD-YY hh:mm[:ss] |
| 561 | |
| 562 | ('/' and '\' can be used instead of '-'.) |
| 563 | |
| 564 | where Mon is Jan-Dec, DD, MM, YY two digit day, month, year, |
| 565 | YYYY four digit year, hh, mm, ss two digit hour, minute or second. |
| 566 | |
| 567 | (As for the "3 fields max" restriction: this prevents, for example, a |
| 568 | file name "13:48" from being considered part of a "Sep 19 2016" date |
| 569 | string preceding it.) |
| 570 | */ |
| 571 | |
546 | 572 | /* Month name */ |
547 | 573 | if (is_month (p, &tim)) |
548 | 574 | { |
… |
… |
vfs_parse_filedate (int idx, time_t * t) |
555 | 581 | } |
556 | 582 | else |
557 | 583 | { |
558 | | /* We expect: |
559 | | 3 fields max or we'll see oddities with certain file names. |
560 | | So both year and time is not allowed. |
561 | | Mon DD hh:mm[:ss] |
562 | | Mon DD YYYY |
563 | | But in case of extfs we allow these date formats: |
564 | | MM-DD-YY hh:mm[:ss] |
565 | | where Mon is Jan-Dec, DD, MM, YY two digit day, month, year, |
566 | | YYYY four digit year, hh, mm, ss two digit hour, minute or second. */ |
567 | | |
568 | | /* Special case with MM-DD-YY or MM-DD-YYYY */ |
| 584 | /* Case with MM-DD-YY or MM-DD-YYYY */ |
569 | 585 | if (is_dos_date (p)) |
570 | 586 | { |
571 | 587 | p[2] = p[5] = '-'; |
diff --git a/src/vfs/extfs/helpers/README b/src/vfs/extfs/helpers/README
index 121e064..8b4a309 100644
a
|
b
|
SSSSSSSS is the file size |
62 | 62 | FILENAME is the filename |
63 | 63 | PATH is the path from the archive's root without the leading slash (/) |
64 | 64 | DATETIME has one of the following formats: |
65 | | Mon DD hh:mm, Mon DD YYYY, Mon DD YYYY hh:mm, MM-DD-YYYY hh:mm |
| 65 | Mon DD hh:mm[:ss], Mon DD YYYY, MM-DD-YYYY hh:mm[:ss] |
66 | 66 | |
67 | 67 | where Mon is a three letter English month name, DD is day |
68 | | 1-31, MM is month 01-12, YYYY is four digit year, hh hour is |
69 | | and mm is minute. |
| 68 | 01-31 (can be 1-31, if following Mon), MM is month 01-12, |
| 69 | YYYY is four digit year, hh is hours, mm is minutes, |
| 70 | and ss is optional seconds. |
70 | 71 | |
71 | 72 | If the -> [PATH/]FILENAME part is present, it means: |
72 | 73 | |