]> git.sur5r.net Git - bacula/bacula/commitdiff
- Fix backspace to first character in conio.c
authorKern Sibbald <kern@sibbald.com>
Mon, 4 Oct 2004 20:34:02 +0000 (20:34 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 4 Oct 2004 20:34:02 +0000 (20:34 +0000)
- Add umount command for Phil. :-)
- Fix update volume volfrompool.
- Modify restore to print an error message if the size of a
  restored file does not correspond to the saved stat packet.
- Fix count of files to be restored *not* to include
  top level created directories.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1632 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/console/conio.c
bacula/src/dird/ua_cmds.c
bacula/src/dird/ua_restore.c
bacula/src/filed/restore.c
bacula/src/findlib/attribs.c
bacula/src/findlib/bfile.c
bacula/src/version.h

index da13ee62dc84847e93110075c0f4c357f99b6228..a4896d52dd9da105fabcba6a783df291aa641846 100644 (file)
@@ -1,5 +1,5 @@
                     Kern's ToDo List
-                   17 Septermber 2004
+                     04 October 2004
 
 Major development:      
 Project                     Developer
@@ -11,25 +11,19 @@ Version 1.35                Kern (see below)
 ========================================================
 
 1.35 Items to do for release:
-- Backspace to beginning of line (conio) does not erase first char.
-- Doc to do unmount before removing magazine.
-- Detect fixed tape block mode during positioning by looking at
-  block numbers in btape "test".  Possibly adjust in Bacula.
-- Fix possible bug in update volumefrompool (email 9/28 from
-  jesk@killall.org
-- Make restore check if the file size restored is correct.
-
 - Document a get out of jail procedure if everything breaks if 
   you lost/broke the Catalog -- do the same for "I know my
   file is there how do I get it back?".
 
+- Add Pool/Storage override regression test.
+- Add relabel regression test.
+- Add delete JobId to regression.
+- Add bscan to four-concurrent-jobs regression.
 
    
 Maybe for 1.35:
 - Look at patches/bacula_db.b2z postgresql that loops during restore.
   See Gregory Wright.
-- Add delete JobId to regression.
-- Add bscan to four-concurrent-jobs regression.
 - Add IPv6 to regression
 - Perhaps add read/write programs and/or plugins to FileSets.
 - How to handle backing up portables ...
@@ -37,6 +31,7 @@ Maybe for 1.35:
 - Add some sort of guaranteed Interval for upgrading jobs.
 
 Documentation to do: (any release a little bit at a time)
+- Doc to do unmount before removing magazine.
 - Alternative to static linking "ldd prog" save all binaries listed,
   restore them and point LD_LIBRARY_PATH to them.
 - Document add "</dev/null >/dev/null 2>&1" to the bacula-fd command line
@@ -61,7 +56,6 @@ Documentation to do: (any release a little bit at a time)
     changing tape settings while a job is running.)
 - Lookup HP cleaning recommendations.
 - Lookup HP tape replacement recommendations (see trouble shooting autochanger)
-- Add more obvious documentation of @ for conf files.
 - Document doing table repair
   
           
@@ -69,6 +63,10 @@ Testing to do: (painful)
 
 
 For 1.37 Testing/Documentation:
+- When an error in input occurs and conio beeps, you can back
+  up through the prompt.
+- Detect fixed tape block mode during positioning by looking at
+  block numbers in btape "test".  Possibly adjust in Bacula.
 - Implement a Client filename case fold option (default = fold
   on Win32).
 - Fix list volumes to output volume retention in some other
@@ -1370,4 +1368,7 @@ Block Position: 0
 - Turn on transactions if multiple connections are on in DB.
 - Fix storage overrides in Run directives.
 - Look into failing Excludes in Win32
-
+- Make restore check if the file size restored is correct.
+- Backspace to beginning of line (conio) does not erase first char.
+- Fix possible bug in update volumefrompool (email 9/28 from
+  jesk@killall.org
index 7a65d2ab99d5b94924aaaca0bcac02cd8712d501..889400b0a90313e0df48a0e33c574d4aed64f49c 100755 (executable)
@@ -2,7 +2,7 @@
       Generalized console input/output handler                    
       A maintanable replacement for readline()
 
-        Kern Sibbald, December MMIII
+        Updated for Bacula, Kern Sibbald, December MMIII
 
       This code is in part derived from code that I wrote in
       1981, so some of it is a bit old and could use a cleanup.
@@ -495,6 +495,10 @@ input_line(char *string, int length)
        case F_ERSCHR:               /* Rubout */
           backup(curline);
           delchr(1, curline, sizeof(curline));
+          if (cp == 0) {
+              t_char(' ');
+             t_char(0x8);
+          }
           break;
        case F_DELEOL:
           t_clrline(0, t_width);
@@ -527,9 +531,11 @@ input_line(char *string, int length)
           while (cp > 0) {
              backup(curline);      /* backup to beginning of line */
           }
-          t_clrline(0,t_width);     /* erase line */
+          t_clrline(0, t_width);     /* erase line */
           cp = 0;
           cl = 0;                   /* reset cursor counter */
+           t_char(' ');
+          t_char(0x8);
           break;
        case F_SOL:
           while (cp > 0) {
index fd55e82f79b94d53432ee1b4bc80ef35c576d98b..2090b43a99136c15c2f33c23f02ac1cd698b5757 100644 (file)
@@ -128,6 +128,7 @@ static struct cmdstruct commands[] = {
  { N_("time"),       time_cmd,      _("print current time")},
  { N_("trace"),      trace_cmd,     _("turn on/off trace to file")},
  { N_("unmount"),    unmount_cmd,   _("unmount <storage-name>")},
+ { N_("umount"),     unmount_cmd,   _("umount <storage-name> for old-time Unix guys")},
  { N_("update"),     update_cmd,    _("update Volume or Pool")},
  { N_("use"),        use_cmd,       _("use catalog xxx")},
  { N_("var"),        var_cmd,       _("does variable expansion")},
@@ -845,14 +846,16 @@ static void update_volfrompool(UAContext *ua, MEDIA_DBR *mr)
 
    memset(&pr, 0, sizeof(pr));
    pr.PoolId = mr->PoolId;
-   if (!get_pool_dbr(ua, &pr)) {
+   if (!db_get_pool_record(ua->jcr, ua->db, &pr) ||
+       !acl_access_ok(ua, Pool_ACL, pr.Name)) {
       return;
    }
    set_pool_dbr_defaults_in_media_dbr(mr, &pr);
    if (!db_update_media_defaults(ua->jcr, ua->db, mr)) {
       bsendmsg(ua, _("Error updating Volume record: ERR=%s"), db_strerror(ua->db));
    } else {
-      bsendmsg(ua, _("Volume defaults updated from Pool record.\n"));
+      bsendmsg(ua, _("Volume defaults updated from \"%s\" Pool record.\n"),
+        pr.Name);
    }
 }
 
@@ -866,10 +869,10 @@ static void update_all_vols_from_pool(UAContext *ua)
    MEDIA_DBR mr;
 
    memset(&pr, 0, sizeof(pr));
+   memset(&mr, 0, sizeof(mr));
    if (!get_pool_dbr(ua, &pr)) {
       return;
    }
-   memset(&mr, 0, sizeof(mr));
    set_pool_dbr_defaults_in_media_dbr(&mr, &pr);
    mr.PoolId = pr.PoolId;
    if (!db_update_media_defaults(ua->jcr, ua->db, &mr)) {
@@ -946,9 +949,10 @@ static int update_volume(UAContext *ua)
            break;
         case 8:
            update_volfrompool(ua, &mr);
-           break;
+           return 1;
         case 9:
            update_all_vols_from_pool(ua);
+           return 1;
         }
         done = true;
       }
@@ -1137,10 +1141,10 @@ static int update_volume(UAContext *ua)
 
       case 11:
         update_volfrompool(ua, &mr);
-        break;
+        return 1;
       case 12:
         update_all_vols_from_pool(ua);
-        break;
+        return 1;
       default:                       /* Done or error */
          bsendmsg(ua, "Selection done.\n");
         return 1;
index ec5fa60fef6c21fa324a418af0cc0100fa15a270..85e9e1001f340c52959c6960c3ed5d5cc11bcfc6 100644 (file)
@@ -784,7 +784,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx)
         if (node->extract || node->extract_dir) {
             Dmsg2(400, "type=%d FI=%d\n", node->type, node->FileIndex);
            add_findex(rx->bsr, node->JobId, node->FileIndex);
-           if (node->extract) {
+           if (node->extract && node->type != TN_NEWDIR) {
               rx->selected_files++;  /* count only saved files */
            }
         }
index 405c37b97e6b41c19fedda3191772015e01ae67d..3ad0006cf8922ed92d8234d001e2e85897c62fff 100644 (file)
@@ -135,7 +135,6 @@ void do_restore(JCR *jcr)
       switch (stream) {
       case STREAM_UNIX_ATTRIBUTES:
       case STREAM_UNIX_ATTRIBUTES_EX:
-
          Dmsg1(30, "Stream=Unix Attributes. extract=%d\n", extract);
         /* If extracting, it was from previous stream, so
          * close the output file.
@@ -186,7 +185,7 @@ void do_restore(JCR *jcr)
         case CF_EXTRACT:
            extract = true;
            P(jcr->mutex);
-           pm_strcpy(&jcr->last_fname, attr->ofname);
+           pm_strcpy(jcr->last_fname, attr->ofname);
            V(jcr->mutex);
            jcr->JobFiles++;
            fileAddr = 0;
@@ -195,7 +194,7 @@ void do_restore(JCR *jcr)
            break;
         case CF_CREATED:
            P(jcr->mutex);
-           pm_strcpy(&jcr->last_fname, attr->ofname);
+           pm_strcpy(jcr->last_fname, attr->ofname);
            V(jcr->mutex);
            jcr->JobFiles++;
            fileAddr = 0;
@@ -210,7 +209,6 @@ void do_restore(JCR *jcr)
       case STREAM_FILE_DATA:
       case STREAM_SPARSE_DATA: 
       case STREAM_WIN32_DATA:  
-
         if (extract) {
            if (stream == STREAM_SPARSE_DATA) {
               ser_declare;
index a24f147497a5a280ea17cb3b579c0cef727ea0fa..32a839bf3e9a0bb9bc127492a408f412ee37c5a2 100755 (executable)
@@ -300,6 +300,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
    struct utimbuf ut;   
    mode_t old_mask;
    bool ok = true;
+   off_t fsize;
 
 #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
    if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
@@ -307,7 +308,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
        if (is_bopen(ofd)) {
           bclose(ofd); 
        }
-       pm_strcpy(&attr->ofname, "*none*");
+       pm_strcpy(attr->ofname, "*none*");
        return true;
    }
    if (attr->data_stream == STREAM_WIN32_DATA ||
@@ -315,7 +316,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       if (is_bopen(ofd)) {
         bclose(ofd); 
       }
-      pm_strcpy(&attr->ofname, "*none*");
+      pm_strcpy(attr->ofname, "*none*");
       return true;
    }
 
@@ -329,7 +330,14 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
 
    old_mask = umask(0);
    if (is_bopen(ofd)) {
+      char ec1[50], ec2[50];
+      fsize = blseek(ofd, 0, SEEK_CUR);
       bclose(ofd);                   /* first close file */
+      if (fsize > 0 && fsize != attr->statp.st_size) {
+         Jmsg3(jcr, M_ERROR, 0, _("File size of restored file %s not correct. Original %s, restored %s.\n"),
+           attr->ofname, edit_uint64(attr->statp.st_size, ec1),
+           edit_uint64(fsize, ec2));
+      }
    }
 
    ut.actime = attr->statp.st_atime;
@@ -387,7 +395,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
       }
 #endif
    }
-   pm_strcpy(&attr->ofname, "*none*");
+   pm_strcpy(attr->ofname, "*none*");
    umask(old_mask);
    return ok;
 }
index 1f9122a070cb948dc4eba6f546bb673a72bc778e..bd5fefbb1ca7efa17022cd21f7a518429411e992 100644 (file)
@@ -313,31 +313,6 @@ int bclose(BFILE *bfd)
    return stat;
 }
 
-/*
- * Generate error message 
- */
-/* DO NOT USE */
-char *xberror(BFILE *bfd)
-{
-   LPTSTR msg;
-
-   FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
-                FORMAT_MESSAGE_FROM_SYSTEM,
-                NULL,
-                bfd->lerror,
-                0,
-                (LPTSTR)&msg,
-                0,
-                NULL);
-   strip_trailing_junk(msg);
-   if (!bfd->errmsg) {
-      bfd->errmsg = get_pool_memory(PM_FNAME);
-   }
-   pm_strcpy(bfd->errmsg, msg);
-   LocalFree(msg);
-   return bfd->errmsg;
-}
-
 /* Returns: bytes read on success
  *          0         on EOF
  *         -1         on error
index 9ff89567bf1b75b409ec08b074cc71c1d5d5e887..61cfa78779a77d0385bfbfe4c8f7ee07e8fcf009 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
-#define VERSION "1.35.7"
-#define BDATE   "03 October 2004"
-#define LSMDATE "03Oct04"
+#define VERSION "1.35.8"
+#define BDATE   "04 October 2004"
+#define LSMDATE "04Oct04"
 
 /* Debug flags */
 #undef  DEBUG