From 1d221440d955045ae52f5edbdeb2a853f3430fae Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 4 Oct 2004 20:34:02 +0000 Subject: [PATCH] - Fix backspace to first character in conio.c - 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 | 27 ++++++++++++++------------- bacula/src/console/conio.c | 10 ++++++++-- bacula/src/dird/ua_cmds.c | 16 ++++++++++------ bacula/src/dird/ua_restore.c | 2 +- bacula/src/filed/restore.c | 6 ++---- bacula/src/findlib/attribs.c | 14 +++++++++++--- bacula/src/findlib/bfile.c | 25 ------------------------- bacula/src/version.h | 6 +++--- 8 files changed, 49 insertions(+), 57 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index da13ee62dc..a4896d52dd 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -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 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 diff --git a/bacula/src/console/conio.c b/bacula/src/console/conio.c index 7a65d2ab99..889400b0a9 100755 --- a/bacula/src/console/conio.c +++ b/bacula/src/console/conio.c @@ -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) { diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index fd55e82f79..2090b43a99 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -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 ")}, + { N_("umount"), unmount_cmd, _("umount 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; diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index ec5fa60fef..85e9e1001f 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -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 */ } } diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 405c37b97e..3ad0006cf8 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -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; diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index a24f147497..32a839bf3e 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -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; } diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index 1f9122a070..bd5fefbb1c 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -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 diff --git a/bacula/src/version.h b/bacula/src/version.h index 9ff89567bf..61cfa78779 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 -- 2.39.5