Ticket #59 (new defect)

Opened 2 years ago

Last modified 3 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

comment:1 Changed 2 years 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]);

comment:2 Changed 23 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"")

comment:3 Changed 23 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() + "\"");

comment:4 Changed 9 months ago by achim

Any news on this?

It is still an issue in the latest (VSS) trunk. The fix/workaround is pretty easy (see above), and until this is fixed, we cannot put the bbackupd.conf file in a directory that contains a space in its name: a major limitatin, given that "Documents and Settings" should be the default folder for bbackupd.conf.

Thanks!

comment:5 Changed 3 months ago by chris

Won't be "fixed" (this way) while the tests rely on running scripts through Perl, which completely breaks if you assume the whole option value is a single command name.

I think quoting the command is the best option, and can be done in Boxi.

Note: See TracTickets for help on using tickets.