[Box Backup-dev] Problems with command line parsing in bbackupctl
when using the force-sync option [Chris version of Box Backup]
Chris Wilson
boxbackup-dev@fluffy.co.uk
Sat, 25 Feb 2006 14:02:19 +0000 (GMT)
Hi Mark,
> When I execute bbackupctl on Windows XP with the sync option, everything
> works fine, but when I use the force-sync option I get an acces violation
> which I could trace back to the code in emu.h.
>
> The function getopt(..) parses the first command line option -c perfect, but
> when it needs to parse the next option (which isn't there!) it fails at the
> instruction str = args[optind]; on line 225. This is because args[4] doesn't
> exist (it's a null pointer).
>
> I think this problem is caused by the fact that the command line is searched
> for combinations of - and a letter, which goes wrong with force-sync, because
> there is a dash in it too.
>
> Maybe I am wrong, but I do know that I can't do a force sync rigth now, and I
> don't know what to fix.
>
> Does anybody know a fix for this problem?
You're absolutely right. The getopt emulation code is badly broken. I
hadn't noticed before, because I build with mingw which supplies a working
getopt, so I don't use the emulated version.
I will rewrite the getopt emulation, but it's a tricky bit of code and
will take some time to get right. In the mean time I will work around it
by removing the dashes from the bbackupctl options which contain them. I
will check that workaround into my SVN tree shortly.
Thanks for pointing this out!
Cheers, Chris.
--
_ ___ __ _
/ __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |