From: Kern Sibbald Date: Tue, 18 Mar 2008 19:45:26 +0000 (+0000) Subject: kes Apply doc fix from bug #1062. X-Git-Tag: Release-3.0.0~1663 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=28b9cc0d9d43ffdde633f14c781fbfed8b4990da;p=bacula%2Fbacula kes Apply doc fix from bug #1062. kes Resolve crash and improper restore wx-console Win32 restore GUI. Fixes bug #1065. kes Update Win32 wxWidgets to latest version. kes Attempt to do correct handling of Win32 mount points. Should fix bug #1046. kes Fix Win32 FD backup/restore memory leak due to improper termination of BackupRead/Write. This fixes bug# 1038. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6628 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index e54b08ed67..00f0a4c928 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -651,6 +651,9 @@ inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; } inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); } inline const char *first_path_separator(const char *path) { return strpbrk(path, "/\\"); } +extern void pause_msg(const char *file, const char *func, int line, const char *msg); +#define pause(msg) if (debug_level) pause_msg(__FILE__, __func__, __LINE__, (msg)) + #else #define PathSeparator '/' /* Define Winsock functions if we aren't on Windows */ @@ -661,6 +664,7 @@ inline const char *first_path_separator(const char *path) { return strpbrk(path, inline bool IsPathSeparator(int ch) { return ch == '/'; } inline char *first_path_separator(char *path) { return strchr(path, '/'); } inline const char *first_path_separator(const char *path) { return strchr(path, '/'); } +#define pause(msg) #endif diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 0a0aa6a25e..299b78f9e2 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -320,10 +320,10 @@ void do_restore(JCR *jcr) bclose(&rctx.bfd); } - /* TODO: manage deleted files */ - if (rctx.type == FT_DELETED) { /* deleted file */ - continue; - } + /* TODO: manage deleted files */ + if (rctx.type == FT_DELETED) { /* deleted file */ + continue; + } /* * Unpack attributes and do sanity check them @@ -1114,7 +1114,6 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, * packet length may be re-read by unser_crypto_packet_len() */ cipher_ctx->packet_len = 0; } - return wsize; } diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 275d196393..286944434a 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -376,7 +376,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) mode_t old_mask; bool ok = true; boffset_t fsize; - + if (uid_set) { my_uid = getuid(); my_gid = getgid(); @@ -626,8 +626,9 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) POOLMEM *win32_ofile; // if we have neither ansi nor wchar version, we leave - if (!(p_SetFileAttributesW || p_SetFileAttributesA)) + if (!(p_SetFileAttributesW || p_SetFileAttributesA)) { return false; + } if (!p || !*p) { /* we should have attributes */ Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid); @@ -686,10 +687,9 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } Dmsg1(100, "SetFileAtts %s\n", attr->ofname); - if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { + if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (p_SetFileAttributesW) { - POOLMEM* pwszBuf = get_pool_memory (PM_FNAME); + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); make_win32_path_UTF8_2_wchar(&pwszBuf, attr->ofname); BOOL b=p_SetFileAttributesW((LPCWSTR)pwszBuf, atts.dwFileAttributes & SET_ATTRS); diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index f5c961a419..10f867439b 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -54,6 +54,18 @@ boffset_t (*plugin_blseek)(JCR *jcr, boffset_t offset, int whence) = NULL; #define fdatasync(fd) #endif +#ifdef HAVE_WIN32 +void pause_msg(const char *file, const char *func, int line, const char *msg) +{ + char buf[1000]; + if (msg) { + bsnprintf(buf, sizeof(buf), "%s:%s:%d %s", file, func, line, msg); + } else { + bsnprintf(buf, sizeof(buf), "%s:%s:%d", file, func, line); + } + MessageBox(NULL, buf, "Pause", MB_OK); +} +#endif /* =============================================================== * @@ -140,16 +152,16 @@ void int64_LE2BE(int64_t* pBE, const int64_t v) { /* convert little endian to big endian */ if (htonl(1) != 1L) { /* no work if on little endian machine */ - memcpy(pBE, &v, sizeof(int64_t)); + memcpy(pBE, &v, sizeof(int64_t)); } else { - int i; - uint8_t rv[sizeof(int64_t)]; - uint8_t *pv = (uint8_t *) &v; - - for (i = 0; i < 8; i++) { - rv[i] = pv[7 - i]; - } - memcpy(pBE, &rv, sizeof(int64_t)); + int i; + uint8_t rv[sizeof(int64_t)]; + uint8_t *pv = (uint8_t *) &v; + + for (i = 0; i < 8; i++) { + rv[i] = pv[7 - i]; + } + memcpy(pBE, &rv, sizeof(int64_t)); } } @@ -158,16 +170,16 @@ void int32_LE2BE(int32_t* pBE, const int32_t v) { /* convert little endian to big endian */ if (htonl(1) != 1L) { /* no work if on little endian machine */ - memcpy(pBE, &v, sizeof(int32_t)); + memcpy(pBE, &v, sizeof(int32_t)); } else { - int i; - uint8_t rv[sizeof(int32_t)]; - uint8_t *pv = (uint8_t *) &v; - - for (i = 0; i < 4; i++) { - rv[i] = pv[3 - i]; - } - memcpy(pBE, &rv, sizeof(int32_t)); + int i; + uint8_t rv[sizeof(int32_t)]; + uint8_t *pv = (uint8_t *) &v; + + for (i = 0; i < 4; i++) { + rv[i] = pv[3 - i]; + } + memcpy(pBE, &rv, sizeof(int32_t)); } } @@ -553,9 +565,14 @@ int bclose(BFILE *bfd) goto all_done; } + /* + * We need to tell the API to release the buffer it + * allocated in lpContext. We do so by calling the + * API one more time, but with the Abort bit set. + */ if (bfd->use_backup_api && bfd->mode == BF_READ) { BYTE buf[10]; - if (!bfd->lpContext && !p_BackupRead(bfd->fh, + if (bfd->lpContext && !p_BackupRead(bfd->fh, buf, /* buffer */ (DWORD)0, /* bytes to read */ &bfd->rw_bytes, /* bytes read */ @@ -567,7 +584,7 @@ int bclose(BFILE *bfd) } } else if (bfd->use_backup_api && bfd->mode == BF_WRITE) { BYTE buf[10]; - if (!bfd->lpContext && !p_BackupWrite(bfd->fh, + if (bfd->lpContext && !p_BackupWrite(bfd->fh, buf, /* buffer */ (DWORD)0, /* bytes to read */ &bfd->rw_bytes, /* bytes written */ diff --git a/bacula/src/findlib/create_file.c b/bacula/src/findlib/create_file.c index 09a645c5bf..2028f475eb 100644 --- a/bacula/src/findlib/create_file.c +++ b/bacula/src/findlib/create_file.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/findlib/enable_priv.c b/bacula/src/findlib/enable_priv.c index fee72ae9c7..aac1716618 100644 --- a/bacula/src/findlib/enable_priv.c +++ b/bacula/src/findlib/enable_priv.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2003-2007 Free Software Foundation Europe e.V. + Copyright (C) 2003-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/findlib/mkpath.c b/bacula/src/findlib/mkpath.c index 38308ea575..9dd67893c9 100644 --- a/bacula/src/findlib/mkpath.c +++ b/bacula/src/findlib/mkpath.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/findlib/savecwd.c b/bacula/src/findlib/savecwd.c index 6e8bab8672..b0cb1e7cb9 100644 --- a/bacula/src/findlib/savecwd.c +++ b/bacula/src/findlib/savecwd.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/win32/filed/vss_generic.cpp b/bacula/src/win32/filed/vss_generic.cpp index 96ebcb4dde..54eef600bd 100644 --- a/bacula/src/win32/filed/vss_generic.cpp +++ b/bacula/src/win32/filed/vss_generic.cpp @@ -363,7 +363,7 @@ BOOL VSSClientGeneric::WaitAndCheckForAsyncOperation(IVssAsync* pAsync) return TRUE; -#ifdef DEBUG +#ifdef xDEBUG // Check if the async operation succeeded... if(hrReturned != VSS_S_ASYNC_FINISHED) { wchar_t *pwszBuffer = NULL; diff --git a/bacula/src/win32/installer/Makefile b/bacula/src/win32/installer/Makefile index f3b904963b..3c0ee400d6 100644 --- a/bacula/src/win32/installer/Makefile +++ b/bacula/src/win32/installer/Makefile @@ -58,8 +58,8 @@ DEPKGS_BINARIES := \ dvd+rw-booktype.exe \ dvd+rw-format.exe \ dvd+rw-mediainfo.exe \ - wxbase270_gcc_bacula.dll \ - wxmsw270_core_gcc_bacula.dll + wxbase28_gcc_bacula.dll \ + wxmsw28_core_gcc_bacula.dll NONGCC_BINARIES := \ libmysql.dll diff --git a/bacula/src/win32/installer/build-installer.cmd b/bacula/src/win32/installer/build-installer.cmd index b4faacddfe..385537ea39 100644 --- a/bacula/src/win32/installer/build-installer.cmd +++ b/bacula/src/win32/installer/build-installer.cmd @@ -12,7 +12,7 @@ SET BACULA_DLLS=bacula.dll cats_mysql.dll cats_postgresql.dll cats_sqlite3.dll SET BACULA_EXES=bacula-dir.exe bacula-fd.exe bacula-sd.exe bconsole.exe wx-console.exe SET BACULA_TOOLS=bcopy.exe bextract.exe bls.exe bscan.exe bsleep.exe bsmtp.exe btape.exe dbcheck.exe scsilist.exe -SET DEP_DLLS=libeay32.dll pthreadVCE.dll ssleay32.dll zlib1.dll zlib1.dll.manifest wxbase270_vc_bacula.dll wxmsw270_core_vc_bacula.dll libmysql.dll libpq.dll comerr32.dll libintl-2.dll libiconv-2.dll krb5_32.dll +SET DEP_DLLS=libeay32.dll pthreadVCE.dll ssleay32.dll zlib1.dll zlib1.dll.manifest wxbase28_vc_bacula.dll wxmsw28_core_vc_bacula.dll libmysql.dll libpq.dll comerr32.dll libintl-2.dll libiconv-2.dll krb5_32.dll SET DEP_EXES=openssl.exe loaderinfo.exe mt.exe mtx.exe scsitape.exe sed.exe tapeinfo.exe sqlite3.exe sqlite3.exe.manifest expr64.exe snooze.exe mkisofs.exe growisofs.exe dvd-ram-control.exe dvd+rw-booktype.exe dvd+rw-format.exe dvd+rw-mediainfo.exe SET SCRIPTS=mtx-changer.cmd disk-changer.cmd dvd-handler.cmd diff --git a/bacula/src/win32/installer/winbacula.nsi b/bacula/src/win32/installer/winbacula.nsi index ca5216628d..f360c6dc28 100644 --- a/bacula/src/win32/installer/winbacula.nsi +++ b/bacula/src/win32/installer/winbacula.nsi @@ -787,16 +787,16 @@ Section "Graphical Console" SecWxConsole Call InstallCommonFiles !if "${BUILD_TOOLS}" == "VC8" - File "${SRC_DIR}\wxbase270_vc_bacula.dll" - File "${SRC_DIR}\wxmsw270_core_vc_bacula.dll" + File "${SRC_DIR}\wxbase28_vc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll" !endif !If "${BUILD_TOOLS}" == "VC8_DEBUG" - File "${SRC_DIR}\wxbase270_vc_bacula.dll" - File "${SRC_DIR}\wxmsw270_core_vc_bacula.dll" + File "${SRC_DIR}\wxbase28_vc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_vc_bacula.dll" !endif !if "${BUILD_TOOLS}" == "MinGW" - File "${SRC_DIR}\wxbase270_gcc_bacula.dll" - File "${SRC_DIR}\wxmsw270_core_gcc_bacula.dll" + File "${SRC_DIR}\wxbase28_gcc_bacula.dll" + File "${SRC_DIR}\wxmsw28_core_gcc_bacula.dll" !endif File "${SRC_DIR}\bwx-console.exe" diff --git a/bacula/src/win32/libwin32/main.cpp b/bacula/src/win32/libwin32/main.cpp index f7451ac97d..447500a567 100644 --- a/bacula/src/win32/libwin32/main.cpp +++ b/bacula/src/win32/libwin32/main.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -379,3 +379,15 @@ int BaculaAppMain() WSACleanup(); _exit(0); } + + +void pause_msg(const char *file, const char *func, int line, const char *msg) +{ + char buf[1000]; + if (msg) { + bsnprintf(buf, sizeof(buf), "%s:%s:%d %s", file, func, line, msg); + } else { + bsnprintf(buf, sizeof(buf), "%s:%s:%d", file, func, line); + } + MessageBox(NULL, buf, "Pause", MB_OK); +} diff --git a/bacula/src/win32/wx-console/wx-console.vcproj b/bacula/src/win32/wx-console/wx-console.vcproj index ee93c79d59..bab6aca168 100644 --- a/bacula/src/win32/wx-console/wx-console.vcproj +++ b/bacula/src/win32/wx-console/wx-console.vcproj @@ -1,352 +1,352 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ProjectType="Visual C++" + Version="8.00" + Name="wx-console" + ProjectGUID="{9BA8E10D-0D82-4B25-8543-DE34641FBC10}" + RootNamespace="wx-console" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bacula/src/wx-console/wxbconfigpanel.cpp b/bacula/src/wx-console/wxbconfigpanel.cpp index 1cfca94661..d71812dc30 100644 --- a/bacula/src/wx-console/wxbconfigpanel.cpp +++ b/bacula/src/wx-console/wxbconfigpanel.cpp @@ -1,15 +1,7 @@ -/* - * - * Config panel, used to specify parameters (for example clients, filesets... in restore) - * - * Nicolas Boichat, April 2004 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + Copyright (C) 2004-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Config panel, used to specify parameters (for example clients, filesets... in restore) + * + * Nicolas Boichat, April 2004 + * + * Version $Id$ + */ /* Windows debug builds set _DEBUG which is used by wxWidgets to select their * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc. @@ -159,6 +159,14 @@ int wxbConfigParam::GetIndex() { return -1; } +int wxbConfigParam::GetCount() { + if (choicectrl) { + return choicectrl->GetCount(); + } + return -1; +} + + void wxbConfigParam::SetIndex(int ind) { if (choicectrl) { choicectrl->SetSelection(ind); @@ -289,6 +297,16 @@ int wxbConfigPanel::FindRow(const wxChar* title) { return -1; } +int wxbConfigPanel::GetRowCount(const wxChar* title) +{ + int i; + if ((i = FindRow(title)) > -1) { + return (*config)[i].GetCount(); + } + + return -1; +} + void wxbConfigPanel::EnableApply(bool enable) { cfgOk->Enable(!enable); if (cfgApply) cfgApply->Enable(enable); diff --git a/bacula/src/wx-console/wxbconfigpanel.h b/bacula/src/wx-console/wxbconfigpanel.h index e64ec8c063..3f712caae6 100644 --- a/bacula/src/wx-console/wxbconfigpanel.h +++ b/bacula/src/wx-console/wxbconfigpanel.h @@ -1,15 +1,7 @@ -/* - * - * Config panel, used to specify parameters (for example clients, filesets... in restore) - * - * Nicolas Boichat, April 2004 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + Copyright (C) 2004-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Config panel, used to specify parameters (for example clients, filesets... in restore) + * + * Nicolas Boichat, April 2004 + * + * Version $Id$ + */ #ifndef WXBCONFIGPANEL_H #define WXBCONFIGPANEL_H @@ -68,6 +68,7 @@ class wxbConfigParam { void Clear(); void Add(wxString value); + int GetCount(); wxString GetTitle(); @@ -102,6 +103,7 @@ public: void ClearRowChoices(const wxChar* title); void AddRowChoice(const wxChar* title, wxString value); + int GetRowCount(const wxChar* title); /* If enable is true, enables apply button, and disables ok button */ void EnableApply(bool enable = true); diff --git a/bacula/src/wx-console/wxbrestorepanel.cpp b/bacula/src/wx-console/wxbrestorepanel.cpp index f74163bc00..7504bf597e 100644 --- a/bacula/src/wx-console/wxbrestorepanel.cpp +++ b/bacula/src/wx-console/wxbrestorepanel.cpp @@ -1,15 +1,7 @@ -/* - * - * wxbPanel for restoring files - * - * Nicolas Boichat, April-July 2004 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + Copyright (C) 2004-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * wxbPanel for restoring files + * + * Nicolas Boichat, April-July 2004 + * + * Version $Id$ + */ /* Note concerning "done" output (modifiable marked with +) Run Restore job @@ -551,14 +551,17 @@ void wxbRestorePanel::CmdStart() wxbMainFrame::GetInstance()->SetStatusText(_("Please configure your restore parameters.")); } else if (status == entered) { -/* if (clientChoice->GetStringSelection().Length() < 1) { +#ifdef xxx + if (clientChoice->GetStringSelection().Length() < 1) { wxbMainFrame::GetInstance()->SetStatusText(_("Please select a client.")); return; } if (jobChoice->GetStringSelection().Length() < 1) { wxbMainFrame::GetInstance()->SetStatusText(_("Please select a restore date.")); return; - }*/ + } +#endif + wxbMainFrame::GetInstance()->SetStatusText(_("Building restore tree...")); SetStatus(choosing); @@ -577,17 +580,22 @@ void wxbRestorePanel::CmdStart() wxT("\" storage=\"") << configPanel->GetRowString(wxT("Storage")) << wxT("\" before=\"") << configPanel->GetRowString(wxT("Before")) << wxT("\" select\n")); - //wxbUtils::WaitForPrompt("6\n"); - //WaitForEnd(); - /*wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxString() << configPanel->GetRowString(wxT("Before")) << "\n", true); + +#ifdef xxx + wxbUtils::WaitForPrompt("6\n"); + WaitForEnd(); + + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxString() << configPanel->GetRowString(wxT("Before")) << "\n", true); + int client = pp->getChoices()->Index(configPanel->GetRowString(wxT("Client"))); if (client == wxNOT_FOUND) { wxbMainFrame::GetInstance()->SetStatusText("Failed to find the selected client."); return; } - delete pp;*/ + delete pp; - //wxbMainFrame::GetInstance()->Send(wxString() << configPanel->GetRowString(wxT("Before")) << "\n"); + wxbMainFrame::GetInstance()->Send(wxString() << configPanel->GetRowString(wxT("Before")) << "\n"); +#endif while (!tableparser->hasFinished() && !dt->hasFinished()) { wxTheApp->Yield(true); @@ -623,8 +631,10 @@ void wxbRestorePanel::CmdStart() gauge->SetValue(0); gauge->SetRange(tot); - /*wxbMainFrame::GetInstance()->Print( - wxString("[") << tot << "]", CS_DEBUG);*/ +#ifdef xxx + wxbMainFrame::GetInstance()->Print( + wxString("[") << tot << "]", CS_DEBUG); +#endif wxDateTime base = wxDateTime::Now(); wxDateTime newdate; @@ -849,8 +859,8 @@ void wxbRestorePanel::CmdStart() } if (scheduledtime.Subtract(currenttime).IsLongerThan(wxTimeSpan::Seconds(150))) { - wxbMainFrame::GetInstance()->Print(_("Restore is scheduled in more than two minutes, bwx-console will not wait for its completion.\n"), CS_DEBUG); - wxbMainFrame::GetInstance()->SetStatusText(_("Restore is scheduled in more than two minutes, bwx-console will not wait for its completion.")); + wxbMainFrame::GetInstance()->Print(_("Restore is scheduled to run. bwx-console will not wait for its completion.\n"), CS_DEBUG); + wxbMainFrame::GetInstance()->SetStatusText(_("Restore is scheduled to run. bwx-console will not wait for its completion.")); SetStatus(finished); return; } @@ -1069,7 +1079,8 @@ void wxbRestorePanel::CmdCancel() { * 11: JobId (no) */ -void wxbRestorePanel::CmdConfigApply() { +void wxbRestorePanel::CmdConfigApply() +{ if (cfgUpdated == 0) return; wxbMainFrame::GetInstance()->SetStatusText(_("Applying restore configuration changes...")); @@ -1096,7 +1107,7 @@ void wxbRestorePanel::CmdConfigApply() { } else if ((cfgUpdated >> ConfigReplace) & 1) { wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ - wxbUtils::WaitForPrompt(wxT("10\n")); + wxbUtils::WaitForPrompt(wxT("11\n")); dt = new wxbDataTokenizer(true); wxbUtils::WaitForPrompt(wxString() << (restorePanel->GetRowSelection(_("Replace"))+1) << wxT("\n")); def = wxT("1"); @@ -1119,49 +1130,64 @@ void wxbRestorePanel::CmdConfigApply() { cfgUpdated = cfgUpdated & (~(1 << ConfigPriority)); } else if ((cfgUpdated >> ConfigClient) & 1) { - wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("5\n"), true); - int client = pp->getChoices()->Index(restorePanel->GetRowString(_("Client"))); - if (client == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected client.")); - failed = true; - client = 1; + if (restorePanel->GetRowCount(_("Client")) > 1) { + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("5\n"), true); + int client = pp->getChoices()->Index(restorePanel->GetRowString(_("Client"))); + if (client == wxNOT_FOUND) { + wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected client.")); + failed = true; + client = 1; + } + delete pp; + dt = new wxbDataTokenizer(true); + wxbUtils::WaitForPrompt(wxString() << client << wxT("\n")); + def = wxT("1"); + cfgUpdated = cfgUpdated & (~(1 << ConfigClient)); + } else { + cfgUpdated = cfgUpdated & (~(1 << ConfigClient)); + continue; } - delete pp; - dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << client << wxT("\n")); - def = wxT("1"); - cfgUpdated = cfgUpdated & (~(1 << ConfigClient)); } else if ((cfgUpdated >> ConfigFileset) & 1) { - wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("4\n"), true); - int fileset = pp->getChoices()->Index(restorePanel->GetRowString(_("Fileset"))); - if (fileset == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected fileset.")); - failed = true; - fileset = 1; + if (restorePanel->GetRowCount(_("Fileset")) > 1) { + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("4\n"), true); + int fileset = pp->getChoices()->Index(restorePanel->GetRowString(_("Fileset"))); + if (fileset == wxNOT_FOUND) { + wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected fileset.")); + failed = true; + fileset = 1; + } + delete pp; + dt = new wxbDataTokenizer(true); + wxbUtils::WaitForPrompt(wxString() << fileset << wxT("\n")); + def = wxT("1"); + cfgUpdated = cfgUpdated & (~(1 << ConfigFileset)); + } else { + cfgUpdated = cfgUpdated & (~(1 << ConfigFileset)); + continue; } - delete pp; - dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << fileset << wxT("\n")); - def = wxT("1"); - cfgUpdated = cfgUpdated & (~(1 << ConfigFileset)); } else if ((cfgUpdated >> ConfigStorage) & 1) { - wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ - wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("2\n"), true); - int fileset = pp->getChoices()->Index(restorePanel->GetRowString(_("Storage"))); - if (fileset == wxNOT_FOUND) { - wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected storage.")); - failed = true; - fileset = 1; + if (restorePanel->GetRowCount(_("Storage")) > 1) { + wxbUtils::WaitForPrompt(wxT("mod\n")); /* TODO: check results */ + wxbPromptParser *pp = wxbUtils::WaitForPrompt(wxT("2\n"), true); + int storage = pp->getChoices()->Index(restorePanel->GetRowString(_("Storage"))); + if (storage == wxNOT_FOUND) { + wxbMainFrame::GetInstance()->SetStatusText(_("Failed to find the selected storage.")); + failed = true; + storage = 1; + } + delete pp; + dt = new wxbDataTokenizer(true); + wxbUtils::WaitForPrompt(wxString() << storage << wxT("\n")); + def = wxT("1"); + cfgUpdated = cfgUpdated & (~(1 << ConfigStorage)); + } else { + cfgUpdated = cfgUpdated & (~(1 << ConfigStorage)); + continue; } - delete pp; - dt = new wxbDataTokenizer(true); - wxbUtils::WaitForPrompt(wxString() << fileset << wxT("\n")); - def = wxT("1"); - cfgUpdated = cfgUpdated & (~(1 << ConfigStorage)); } else { cfgUpdated = 0; @@ -1175,7 +1201,7 @@ void wxbRestorePanel::CmdConfigApply() { } } - if (i == dt->GetCount()) { + if (i != 0 && i == dt->GetCount()) { delete dt; dt = wxbUtils::WaitForEnd(def + wxT("\n"), true); failed = true; @@ -1184,6 +1210,7 @@ void wxbRestorePanel::CmdConfigApply() { UpdateSecondConfig(dt); /* TODO: Check result */ EnableConfig(true); + restorePanel->EnableApply(false); if (!failed) { wxbMainFrame::GetInstance()->SetStatusText(_("Restore configuration changes were applied.")); @@ -1967,7 +1994,6 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { cfgUpdated = 0; break; case listing: - break; case choosing: start->Enable(true); @@ -1996,6 +2022,7 @@ void wxbRestorePanel::SetStatus(status_enum newstatus) { centerSizer->Layout(); this->Layout(); restorePanel->EnableApply(false); + cancel->Enable(true); break; case restoring: start->SetLabel(_("Restoring...")); @@ -2362,7 +2389,8 @@ void wxbRestorePanel::OnListRemove(wxCommandEvent& event) { listremove->Enable(false); } -void wxbRestorePanel::OnListRefresh(wxCommandEvent& event) { +void wxbRestorePanel::OnListRefresh(wxCommandEvent& event) +{ if (IsWorking()) { return; } @@ -2372,7 +2400,8 @@ void wxbRestorePanel::OnListRefresh(wxCommandEvent& event) { SetWorking(false); } -void wxbRestorePanel::OnConfigUpdated(wxCommandEvent& event) { +void wxbRestorePanel::OnConfigUpdated(wxCommandEvent& event) +{ if (status == entered) { if (event.GetId() == ConfigJobName) { if (IsWorking()) { diff --git a/bacula/src/wx-console/wxbutils.cpp b/bacula/src/wx-console/wxbutils.cpp index 6fccb368bd..daf9d634a6 100644 --- a/bacula/src/wx-console/wxbutils.cpp +++ b/bacula/src/wx-console/wxbutils.cpp @@ -1,15 +1,7 @@ -/* - * - * wxbDataParser, class that receives and analyses data - * - * Nicolas Boichat, April-July 2004 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + Copyright (C) 2004-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * wxbDataParser, class that receives and analyses data + * + * Nicolas Boichat, April-July 2004 + * + * Version $Id$ + */ /* Windows debug builds set _DEBUG which is used by wxWidgets to select their * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc. @@ -42,13 +42,9 @@ #undef _DEBUG #include "bacula.h" - #include "wxbutils.h" - #include "wxbmainframe.h" - #include "csprint.h" - #include "wxbtableparser.h" /* A macro named Yield is defined under MinGW */ @@ -335,7 +331,6 @@ bool wxbPromptParser::Analyse(wxString str, int status) { choices->Add(wxT("no")); numerical = false; } - return true; } else { /* ended or (dis)connected */ diff --git a/bacula/src/wx-console/wxbutils.h b/bacula/src/wx-console/wxbutils.h index c3f05bf067..d91ff2d35a 100644 --- a/bacula/src/wx-console/wxbutils.h +++ b/bacula/src/wx-console/wxbutils.h @@ -1,16 +1,7 @@ -/* - * - * wxbDataParser, class that receives and analyses data - * wxbPanel, main frame's notebook panels - * - * Nicolas Boichat, April-July 2004 - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2006 Free Software Foundation Europe e.V. + Copyright (C) 2004-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -34,6 +25,15 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * wxbDataParser, class that receives and analyses data + * wxbPanel, main frame's notebook panels + * + * Nicolas Boichat, April-July 2004 + * + * Version $Id$ + */ #ifndef WXBUTILS_H #define WXBUTILS_H diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index d7bf709e83..a3c0d4611a 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,15 @@ Technical notes on version 2.3 General: +18Mar08 +kes Apply doc fix from bug #1062. +kes Resolve crash and improper restore wx-console Win32 restore + GUI. Fixes bug #1065. +kes Update Win32 wxWidgets to latest version. +kes Attempt to do correct handling of Win32 mount points. Should + fix bug #1046. +kes Fix Win32 FD backup/restore memory leak due to improper termination + of BackupRead/Write. This fixes bug# 1038. 16Mar08 ebl Reduce memory usage for accurate backup, working only with ctime and mtime. (not all Lstat field)