Ticket #59 (new defect)

Opened 12 months ago

Last modified 5 months ago

Inconsistent treatment of NotifyScript between Box Backup and Boxi

Reported by: achim Owned by: ben
Priority: normal Milestone:
Component: bbackupd Version: 0.11rc2
Keywords: Cc:

Description

Inconsistent treatment of NotifyScript between Boxi and BB

NotifyScript = "C:\Documents and Settings\Administrador\NotifySysAdmin?.cmd" SyncAllowScript? = C:\Documents and Settings\Administrador\SyncAllowScript?.cmd

Please note that NotifyScript needs qutation marks around filenames with spaces, whereas SyncAllowScript? does not. NotifyScript under bbackupd.exe will result in errors like this when no "" are used around filenames with spaces:

C:\Documents is not recognised as an internal or external command, program or batch file. WARNING: Notify script returned error code: 1 ('C:\Documents and Settings\Administrador\NotifySysAdmin?.cmd read-error')

So we add spaces around the NotifyScript to please BB, but then Boxi complains with

The Notify Script does not exist ("C:\Documents and Settings\Administrador\NotifySysAdmin?.cmd")

In addition, when ignoring Boxi's error above (we know that the file exists, and that BB needs spaces around it!) and trying to restore (which should not require NotifyScript at all), the following error is given upon trying to log into the server on tab "Restore Files" to selec the files:


Boxi Error


Error connecting to server: Connection SocketNameLookupError? (Check hostname specified.)


OK


Possible solution: check in the Box Backup source why Notify and SyncAllow? treat spaces in filenames differently, and make sure they both accept filenames with spaces without the need for quotation marks.

Change History

Changed 9 months ago by achim

Fix so that bbackup will accept paths with spaces for NotifyScript: change BackupDaemon?.cpp line 2196 from

// Script to run std::string script(conf.GetKeyValue?("NotifyScript") + ' ' +

sEventNames[Event]);

to

// Script to run std::string script("\"" + conf.GetKeyValue?("NotifyScript") + "\"" + ' ' +

sEventNames[Event]);

Changed 5 months ago by achim

Additional quotation marks work here:

	// Script to run
	std::string script("\"\"" + conf.GetKeyValue("NotifyScript") + "\" " +
			sEventNames[Event] + " \"" + GetConfigFileName() + "\"\"");

      // Then do it
      int returnCode = ::system(script.c_str());
      if(returnCode != 0)

but not in this case:

        std::string script("\"\"" + conf.GetKeyValue("SyncAllowScript") + "\" " +
                " \"" + GetConfigFileName() + "\"\"");			
			

        // Run it?
        pid_t pid = 0;
        try
        {
                std::auto_ptr<IOStream> pscript(LocalProcessStream(script,
                        pid));

resulting error for the latter is:

ERROR:   Failed to CreateProcess: '""d:\install\Online Backup\SyncAllowScript.cmd"  "C:\Documents and Settings\achimlatz\Da
tos de programa\Online Backup\bbackupd.conf""': El sistema no puede hallar el archivo especificado. (2)
WARNING: Exception thrown: ServerException(ServerForkError) at LocalProcessStream.cpp(223)
ERROR:   Internal error running SyncAllowScript: Server ServerForkError (""d:\install\Online Backup\SyncAllowScript.cmd"  "
C:\Documents and Settings\achimlatz\Datos de programa\Online Backup\bbackupd.conf"")

Changed 5 months ago by achim

In order to make SyncAllowScript? also work with spaces in path names for SyncAllowScript? ("C:\Program Files\Box Backup" for instance), we need to change the script name as follows:

std::string script("\"" + conf.GetKeyValue("SyncAllowScript") +
        "\" \"" + GetConfigFileName() + "\"");
Note: See TracTickets for help on using tickets.