Changeset 1790
- Timestamp:
- 03/08/2007 00:29:31 (17 months ago)
- Location:
- box/chris/general
- Files:
-
- 14 modified
-
bin/bbackupctl/bbackupctl.cpp (modified) (12 diffs)
-
bin/bbackupquery/BackupQueries.cpp (modified) (54 diffs)
-
bin/bbackupquery/bbackupquery.cpp (modified) (8 diffs)
-
bin/bbstoreaccounts/bbstoreaccounts.cpp (modified) (20 diffs)
-
lib/backupclient/BackupClientRestore.cpp (modified) (1 diff)
-
lib/backupstore/BackupStoreCheck.cpp (modified) (23 diffs)
-
lib/backupstore/BackupStoreCheck2.cpp (modified) (9 diffs)
-
lib/common/DebugMemLeakFinder.cpp (modified) (1 diff)
-
lib/common/Logging.cpp (modified) (2 diffs)
-
lib/crypto/Random.cpp (modified) (1 diff)
-
lib/raidfile/RaidFileController.cpp (modified) (1 diff)
-
lib/server/SSLLib.cpp (modified) (1 diff)
-
test/bbackupd/testfiles/extcheck1.pl.in (modified) (1 diff)
-
test/bbackupd/testfiles/extcheck2.pl.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupctl/bbackupctl.cpp
r1784 r1790 110 110 111 111 // Read in the configuration file 112 if(!quiet) printf("Using configuration file %s\n", 113 configFilename.c_str()); 112 if(!quiet) BOX_NOTICE("Using configuration file " << configFilename); 114 113 115 114 std::string errs; … … 120 119 if(config.get() == 0 || !errs.empty()) 121 120 { 122 printf("Invalid configuration file:\n%s", errs.c_str());121 BOX_ERROR("Invalid configuration file: " << errs); 123 122 return 1; 124 123 } … … 129 128 if(!conf.KeyExists("CommandSocket")) 130 129 { 131 printf("Daemon isn't using a control socket, "130 BOX_ERROR("Daemon isn't using a control socket, " 132 131 "could not execute command.\n" 133 132 "Add a CommandSocket declaration to the " 134 "bbackupd.conf file. \n");133 "bbackupd.conf file."); 135 134 return 1; 136 135 } … … 154 153 catch(...) 155 154 { 156 printf("Failed to connect to daemon control socket.\n"155 BOX_ERROR("Failed to connect to daemon control socket.\n" 157 156 "Possible causes:\n" 158 157 " * Daemon not running\n" 159 158 " * Daemon busy syncing with store server\n" 160 159 " * Another bbackupctl process is communicating with the daemon\n" 161 " * Daemon is waiting to recover from an error \n"160 " * Daemon is waiting to recover from an error" 162 161 ); 163 164 #if defined WIN32 && ! defined NDEBUG165 BOX_ERROR("Failed to connect to the command socket");166 #endif167 162 168 163 return 1; … … 194 189 &updateStoreInterval, &minimumFileAge, &maxUploadWait) != 4) 195 190 { 196 printf("Config summary didn't decode\n");191 BOX_ERROR("Config summary didn't decode."); 197 192 return 1; 198 193 } … … 200 195 if(!quiet) 201 196 { 202 printf("Daemon configuration summary:\n"203 " AutomaticBackup = %s\n"204 " UpdateStoreInterval = %d seconds\n"205 " MinimumFileAge = %d seconds\n"206 " MaxUploadWait = %d seconds\n",207 autoBackup?"true":"false", updateStoreInterval,208 minimumFileAge, maxUploadWait);197 BOX_INFO("Daemon configuration summary:\n" 198 " AutomaticBackup = " << 199 (autoBackup?"true":"false") << "\n" 200 " UpdateStoreInterval = " << updateStoreInterval << 201 " seconds\n" 202 " MinimumFileAge = " << minimumFileAge << " seconds\n" 203 " MaxUploadWait = " << maxUploadWait << " seconds\n"); 209 204 } 210 205 … … 267 262 if (currentState != 0) 268 263 { 269 printf("Waiting for current sync/error state "270 "to finish... \n");264 BOX_INFO("Waiting for current sync/error state " 265 "to finish..."); 271 266 } 272 267 } … … 311 306 if(line == "start-sync") 312 307 { 313 if (!quiet) printf("Sync started...\n");308 if (!quiet) BOX_INFO("Sync started..."); 314 309 syncIsRunning = true; 315 310 } … … 318 313 if (syncIsRunning) 319 314 { 320 if (!quiet) printf("Sync finished.\n");315 if (!quiet) BOX_INFO("Sync finished.\n"); 321 316 // Send a quit command to finish nicely 322 317 connection.Write("quit\n", 5); … … 327 322 else 328 323 { 329 if (!quiet) printf("Previous sync finished.\n");324 if (!quiet) BOX_INFO("Previous sync finished."); 330 325 } 331 326 // daemon must still be busy … … 341 336 if(!quiet) 342 337 { 343 printf("Succeeded.\n");338 BOX_INFO("Succeeded.\n"); 344 339 } 345 340 finished = true; … … 347 342 else if(line == "error") 348 343 { 349 printf("ERROR. (Check command spelling)\n");344 BOX_ERROR("Check command spelling"); 350 345 returnCode = 1; 351 346 finished = true; -
box/chris/general/bin/bbackupquery/BackupQueries.cpp
r1784 r1790 182 182 GetConsoleCP())) 183 183 { 184 printf("Failed to convert encoding");184 BOX_ERROR("Failed to convert encoding"); 185 185 return; 186 186 } … … 256 256 if(alias[a] == 0) 257 257 { 258 printf("Unrecognised command: %s\n",Command);258 BOX_ERROR("Unrecognised command: " << Command); 259 259 return; 260 260 } … … 276 276 if(::strchr(commands[cmd].opts, *c) == NULL) 277 277 { 278 printf("Invalid option '%c' for command %s\n",279 *c,commands[cmd].name);278 BOX_ERROR("Invalid option '" << *c << "' for " 279 "command " << commands[cmd].name); 280 280 return; 281 281 } … … 306 306 { 307 307 // Simple implementation, so do it here 308 printf("%s (%08llx)\n", 309 GetCurrentDirectoryName().c_str(), 310 (long long)GetCurrentDirectoryID()); 308 BOX_INFO(GetCurrentDirectoryName() << " (" << 309 BOX_FORMAT_OBJECTID(GetCurrentDirectoryID())); 311 310 } 312 311 break; … … 321 320 322 321 case COMMAND_sh: 323 printf("The command to run must be specified as an argument.\n");322 BOX_ERROR("The command to run must be specified as an argument."); 324 323 break; 325 324 … … 402 401 if(rootDir == 0) 403 402 { 404 printf("Directory '%s' not found on store\n",405 args[0].c_str());403 BOX_ERROR("Directory '" << args[0] << "' not found " 404 "on store."); 406 405 return; 407 406 } … … 748 747 if(args.size() != 1 || args[0].size() == 0) 749 748 { 750 printf("Incorrect usage.\ncd [-o] [-d] <directory>\n");749 BOX_ERROR("Incorrect usage. cd [-o] [-d] <directory>"); 751 750 return; 752 751 } … … 765 764 if(id == 0) 766 765 { 767 printf("Directory '%s' not found\n", args[0].c_str());766 BOX_ERROR("Directory '" << args[0] << "' not found."); 768 767 return; 769 768 } … … 786 785 if(args.size() != 1 || args[0].size() == 0) 787 786 { 788 printf("Incorrect usage.\nlcd <local-directory>\n");787 BOX_ERROR("Incorrect usage. lcd <local-directory>"); 789 788 SetReturnCode(COMMAND_RETURN_ERROR); 790 789 return; … … 796 795 if(!ConvertConsoleToUtf8(args[0].c_str(), dirName)) 797 796 { 798 printf("Failed to convert path from console encoding.\n");797 BOX_ERROR("Failed to convert path from console encoding."); 799 798 SetReturnCode(COMMAND_RETURN_ERROR); 800 799 return; … … 806 805 if(result != 0) 807 806 { 808 printf((errno == ENOENT || errno == ENOTDIR)?"Directory '%s' does not exist\n":"Error changing dir to '%s'\n", 809 args[0].c_str()); 807 if(errno == ENOENT || errno == ENOTDIR) 808 { 809 BOX_ERROR("Directory '" << args[0] << "' does not exist."); 810 } 811 else 812 { 813 BOX_ERROR("Error changing to directory '" << 814 args[0] << ": " << strerror(errno)); 815 } 816 810 817 SetReturnCode(COMMAND_RETURN_ERROR); 811 818 return; … … 816 823 if(::getcwd(wd, PATH_MAX) == 0) 817 824 { 818 printf("Error getting current directory\n"); 825 BOX_ERROR("Error getting current directory: " << 826 strerror(errno)); 819 827 SetReturnCode(COMMAND_RETURN_ERROR); 820 828 return; … … 824 832 if(!ConvertUtf8ToConsole(wd, dirName)) 825 833 { 826 printf("Failed to convert new path from console encoding.\n");834 BOX_ERROR("Failed to convert new path from console encoding."); 827 835 SetReturnCode(COMMAND_RETURN_ERROR); 828 836 return; 829 837 } 830 printf("Local current directory is now '%s'\n", dirName.c_str());838 BOX_INFO("Local current directory is now '" << dirName << "'."); 831 839 #else 832 printf("Local current directory is now '%s'\n", wd);840 BOX_INFO("Local current directory is now '" << wd << "'."); 833 841 #endif 834 842 } … … 848 856 if(args.size() != 2) 849 857 { 850 printf("Incorrect usage.\ngetobject <object-id> <local-filename>\n"); 858 BOX_ERROR("Incorrect usage. getobject <object-id> " 859 "<local-filename>"); 851 860 return; 852 861 } … … 855 864 if(id == std::numeric_limits<long long>::min() || id == std::numeric_limits<long long>::max() || id == 0) 856 865 { 857 printf("Not a valid object ID (specified in hex)\n");866 BOX_ERROR("Not a valid object ID (specified in hex)."); 858 867 return; 859 868 } … … 863 872 if(::stat(args[1].c_str(), &st) == 0 || errno != ENOENT) 864 873 { 865 printf("The local file %s already exists\n", args[1].c_str());874 BOX_ERROR("The local file '" << args[1] << " already exists."); 866 875 return; 867 876 } … … 881 890 objectStream->CopyStreamTo(out); 882 891 883 printf("Object ID %08llx fetched successfully.\n", id); 892 BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(id) << 893 " fetched successfully."); 884 894 } 885 895 else 886 896 { 887 printf("Object does not exist on store.\n"); 897 BOX_ERROR("Object ID " << BOX_FORMAT_OBJECTID(id) << 898 " does not exist on store."); 888 899 ::unlink(args[1].c_str()); 889 900 } … … 892 903 { 893 904 ::unlink(args[1].c_str()); 894 printf("Error occured fetching object.\n");905 BOX_ERROR("Error occured fetching object."); 895 906 } 896 907 } … … 912 923 if(args.size() < 1 || (opts['i'] && args.size() != 2) || args.size() > 2) 913 924 { 914 printf("Incorrect usage.\n"925 BOX_ERROR("Incorrect usage.\n" 915 926 "get <remote-filename> [<local-filename>] or\n" 916 "get -i <object-id> <local-filename> \n");927 "get -i <object-id> <local-filename>"); 917 928 return; 918 929 } … … 932 943 if(!ConvertConsoleToUtf8(i->c_str(), out)) 933 944 { 934 fprintf(stderr, "failed to convert encoding\n");945 BOX_ERROR("Failed to convert encoding."); 935 946 return; 936 947 } … … 953 964 if(dirId == 0) 954 965 { 955 printf("Directory '%s' not found\n",956 dirName.c_str());966 BOX_ERROR("Directory '" << dirName << 967 "' not found."); 957 968 return; 958 969 } … … 982 993 fileId == 0) 983 994 { 984 printf("Not a valid object ID (specified in hex)\n");995 BOX_ERROR("Not a valid object ID (specified in hex)."); 985 996 return; 986 997 } … … 989 1000 if(dir.FindEntryByID(fileId) == 0) 990 1001 { 991 printf("ID '%08llx' not found in current " 1002 BOX_ERROR("File ID " << 1003 BOX_FORMAT_OBJECTID(fileId) << 1004 " not found in current " 992 1005 "directory on store.\n" 993 "(You can only download objects by ID " 994 "from the current directory.)\n", 995 fileId); 1006 "(You can only download files by ID " 1007 "from the current directory.)"); 996 1008 return; 997 1009 } … … 1008 1020 if(en == 0) 1009 1021 { 1010 printf("Filename '%s' not found in current " 1022 BOX_ERROR("Filename '" << args[0] << "' " 1023 "not found in current " 1011 1024 "directory on store.\n" 1012 1025 "(Subdirectories in path not " 1013 "searched.) \n", args[0].c_str());1026 "searched.)"); 1014 1027 return; 1015 1028 } … … 1028 1041 if(::stat(localName.c_str(), &st) == 0 || errno != ENOENT) 1029 1042 { 1030 printf("The local file %s already exists, will not"1031 " overwrite it.\n", localName.c_str());1043 BOX_ERROR("The local file " << localName << " already exists, " 1044 "will not overwrite it."); 1032 1045 SetReturnCode(COMMAND_RETURN_ERROR); 1033 1046 return; … … 1047 1060 1048 1061 // Done. 1049 printf("Object ID %08llx fetched sucessfully.\n", fileId); 1062 BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(fileId) << 1063 " fetched successfully."); 1050 1064 } 1051 1065 catch (BoxException &e) … … 1161 1175 else 1162 1176 { 1163 printf("Warning: couldn't determine the time of the last synchronisation -- checks not performed.\n"); 1177 BOX_WARNING("Failed to determine the time of the last " 1178 "synchronisation -- checks not performed."); 1164 1179 } 1165 1180 } … … 1168 1183 if(params.mQuickCompare) 1169 1184 { 1170 printf("WARNING: Quick compare used -- file attributes are not checked.\n"); 1185 BOX_WARNING("Quick compare used -- file attributes are not " 1186 "checked."); 1171 1187 } 1172 1188 … … 1193 1209 if(!params.mIgnoreExcludes) 1194 1210 { 1195 printf("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes\n");1211 BOX_ERROR("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes."); 1196 1212 return; 1197 1213 } … … 1204 1220 else 1205 1221 { 1206 printf("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>\n");1222 BOX_ERROR("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>"); 1207 1223 return; 1208 1224 } … … 1210 1226 if (!params.mQuietCompare) 1211 1227 { 1212 printf("\n[ %d (of %d) differences probably due to file "1213 "modifications after the last upload ]\n",1214 params.mDifferences ExplainedByModTime,1215 params.mDifferences);1216 } 1217 1218 printf("Differences: %d (%d dirs excluded, %d files excluded, "1219 "%d files not checked)\n",1220 params.m Differences, params.mExcludedDirs,1221 params.m ExcludedFiles, params.mUncheckedFiles);1228 BOX_INFO("[ " << 1229 params.mDifferencesExplainedByModTime << " (of " << 1230 params.mDifferences << ") differences probably " 1231 "due to file modifications after the last upload ]"); 1232 } 1233 1234 BOX_INFO("Differences: " << params.mDifferences << " (" << 1235 params.mExcludedDirs << " dirs excluded, " << 1236 params.mExcludedFiles << " files excluded, " << 1237 params.mUncheckedFiles << " files not checked)"); 1222 1238 1223 1239 // Set return code? … … 1254 1270 if(!locations.SubConfigurationExists(rLocation.c_str())) 1255 1271 { 1256 printf("Location %s does not exist.\n", rLocation.c_str());1272 BOX_ERROR("Location " << rLocation << " does not exist."); 1257 1273 return; 1258 1274 } … … 1265 1281 DIRECTORY_SEPARATOR_ASCHAR) 1266 1282 { 1267 fprintf(stderr, "Warning: location '%s' path ends "1268 "with ' %s', compare may fail!",1269 rLocation.c_str(), DIRECTORY_SEPARATOR);1283 BOX_WARNING("Location '" << rLocation << "' path ends " 1284 "with '" DIRECTORY_SEPARATOR "', " 1285 "compare may fail!"); 1270 1286 } 1271 1287 } … … 1320 1336 if(dirID == 0) 1321 1337 { 1322 printf("Local directory '%s' exists, but"1323 " server directory '%s' does not exist\n",1324 rLocalDir.c_str(), rStoreDir.c_str());1338 BOX_WARNING("Local directory '" << rLocalDir << "' exists, " 1339 "but server directory '" << rStoreDir << "' does not " 1340 "exist."); 1325 1341 rParams.mDifferences ++; 1326 1342 return; … … 1370 1386 if(errno == ENOTDIR) 1371 1387 { 1372 printf("Local object '%s' is a file, " 1373 "server object '%s' is a directory\n", 1374 localDirDisplay.c_str(), 1375  
