OSDN Git Service

fixed a bug for timestamp archiving feature
authorKoji Arai <jca02266@gmail.com>
Thu, 23 Oct 2008 13:57:43 +0000 (22:57 +0900)
committerKoji Arai <jca02266@gmail.com>
Thu, 23 Oct 2008 13:57:43 +0000 (22:57 +0900)
* configure.ac: updated version.
* src/lhadd.c(cmd_add): fixed a bug reported by Reynir Stefansson.
  the variable most_recent should be reset at the first.
* tests/lha-test19: added a testcase for above.

ChangeLog
configure.ac
src/lhadd.c
tests/lha-test19

index c180e7b..7905bdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-10-23  Koji Arai  <arai@users.sourceforge.jp>
+
+       * configure.ac: updated version.
+
+       * src/lhadd.c(cmd_add): fixed a bug reported by Reynir Stefansson.
+       the variable most_recent should be reset at the first.
+
+       * tests/lha-test19: added a testcase for above.
+
 2008-10-04  Koji Arai  <arai@users.sourceforge.jp>
 
        Timestamp archiving feature is added. Thanks to Reynir Stefansson.
index 977b344..b59b37e 100644 (file)
@@ -1,5 +1,5 @@
 # Process this file with autoconf to produce a configure script.
-AC_INIT([LHa for UNIX], 1.14i-ac20081004, arai@users.sourceforge.jp, lha)
+AC_INIT([LHa for UNIX], 1.14i-ac20081023, arai@users.sourceforge.jp, lha)
 AC_DEFINE_UNQUOTED(LHA_CONFIGURE_OPTIONS, "$ac_configure_args",
            [specified options for the configure script.])
 AC_CANONICAL_HOST
index 263b696..3d72e5f 100644 (file)
@@ -481,6 +481,8 @@ cmd_add()
     boolean         old_archive_exist;
     off_t           new_archive_size;
 
+    most_recent = 0;
+
     /* exit if no operation */
     if (!update_if_newer && cmd_filec == 0) {
         error("No files given in argument, do nothing.");
@@ -559,7 +561,6 @@ cmd_add()
                 goto next;
         }
 
-        most_recent = 0;
         oafp = append_it(cmd_filev[i], oafp, nafp);
     next:
         ;
index 04d25c2..3bd2a5e 100644 (file)
@@ -6,8 +6,8 @@ echo -------------------------------------------------------------------
 cp -r test-1 test-tmp1
                                                        check $? $LINENO
 change_timestamp 01020304.02 test-tmp1/test-a &&
-change_timestamp 01020304.04 test-tmp1/test-b &&
-change_timestamp 01020304.06 test-tmp1/test-c
+change_timestamp 01020304.06 test-tmp1/test-b &&
+change_timestamp 01020304.04 test-tmp1/test-c
                                                        check $? $LINENO
 
 # most recent file is test-a
@@ -16,54 +16,57 @@ $lha c --timestamp-archive test-tmp1.lzh test-tmp1/test-a
 identical_timestamp test-tmp1.lzh test-tmp1/test-a
                                                        check $? $LINENO
 
-# most recent file is test-c
-$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-c
+# most recent file is test-b
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-b
                                                        check $? $LINENO
-identical_timestamp test-tmp1.lzh test-tmp1/test-c
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
                                                        check $? $LINENO
 
-$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-b
+# most recent file is test-b
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-c
                                                        check $? $LINENO
-# most recent file is test-c
-identical_timestamp test-tmp1.lzh test-tmp1/test-c
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
                                                        check $? $LINENO
 
-$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-c
+# most recent file is test-c
+$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-b
                                                        check $? $LINENO
-# most recent file is test-b
-identical_timestamp test-tmp1.lzh test-tmp1/test-b
+identical_timestamp test-tmp1.lzh test-tmp1/test-c
                                                        check $? $LINENO
 
 
-# directory is ignored
+# most recent file is test-c because directory is ignored
 mkdir test-tmp1/test-d &&
 $lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-d
                                                        check $? $LINENO
-# most recent file is test-b
-identical_timestamp test-tmp1.lzh test-tmp1/test-b
+identical_timestamp test-tmp1.lzh test-tmp1/test-c
                                                        check $? $LINENO
 
 case `$lha --version 2>&1` in
 *djgpp* | *-pc-mingw*)
   ;;
 *)
+  # most recent file is test-c because symbolic link is ignored
   # symbolic link is ignored
-  ln -s test-c test-tmp1/test-e
+  ln -s test-b test-tmp1/test-e
   $lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-e
                                                        check $? $LINENO
+  identical_timestamp test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
   ;;
 esac
 
-# most recent file is test-b
-identical_timestamp test-tmp1.lzh test-tmp1/test-b
-                                                       check $? $LINENO
-
-$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-b
-                                                       check $? $LINENO
 # most recent file is test-a
+$lha dq --timestamp-archive test-tmp1.lzh test-tmp1/test-c
+                                                       check $? $LINENO
 identical_timestamp test-tmp1.lzh test-tmp1/test-a
                                                        check $? $LINENO
 
+# most recent file is test-b
+$lha a --timestamp-archive test-tmp1.lzh test-tmp1/test-[bc]
+                                                       check $? $LINENO
+identical_timestamp test-tmp1.lzh test-tmp1/test-b
+                                                       check $? $LINENO
 
 $lha vv test-tmp1.lzh
                                                        check $? $LINENO