Opened 7 years ago

Closed 7 years ago

#6128 closed task (fixed)

Test torrc handling in Vidalia alpha

Reported by: sebb Owned by: sebb
Priority: Medium Milestone: Vidalia: 0.3.x
Component: Archived/Vidalia Version:
Severity: Keywords: test torrc vidalia alpha
Cc: chiiph, sebb Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Vidalia alpha has new implementation of handling the torrc.
Review and test code required.

Child Tickets

Change History (12)

comment:1 Changed 7 years ago by sebb

Milestone: Vidalia: 0.3.x
Status: newassigned
Version: Vidalia: 0.3.2-alpha

comment:2 Changed 7 years ago by sebb

Status: assignedneeds_review

comment:3 Changed 7 years ago by chiiph

Status: needs_reviewneeds_revision

Looks really good!

It would be nice to have a couple of more tests:

  • Applying a new torrc actually changes the config value in the running tor.
  • Applying a new torrc to a running tor that has a different value for, say, DataDirectory (which cannot be changed while tor is running), and see if the other values changed (Vidalia should apply the other values).
  • Removing a value leaves the file as expected (may be with a comment that should be left in place).
  • Same as before but adding a new value

Another thing: how does this behave with the bootstrap tests? I haven't been able to actually test those yet though.

comment:4 Changed 7 years ago by sebb

Ok, thanks, I will update the tests.
As for bootstrap testing code, I need to work on it again. Looks like the alpha branch has introduced some changes, and the testing code wont run. To be precise, it runs, but bootstrap never goes further than first stage, so it requires more work.
Another thing is that I can't seem to even run the vidalia.exe compiled from the alpha branch, it always crashes, with this stack trace:

#0 0x6f300878 in ?? () from C:\Qt\bin\QtScript4.dll
#1 0x6f3766ac in ZNK11QScriptable8argumentEi () from C:\Qt\bin\QtScript4.dll
#2 0x6f354b14 in ZN13QScriptEngineD0Ev () from C:\Qt\bin\QtScript4.dll
#3 0x6f36bbad in ZN12QScriptValue11setPropertyERK7QStringRKS_RK6QFlagsINS_12Pr
pertyFlagEE () from C:\Qt\bin\QtScript4.dll
#4 0x0042cf2d in qtscript_create_VidaliaTab_class(QScriptEngine*) ()
#5 0x00407feb in vidalia_initialize_bindings(QScriptValue&) ()
#6 0x00407e8c in VidaliaExtensions::initialize(QString const&,
QScriptEngine*)()
#7 0x00401ef6 in PluginEngine::PluginEngine(QObject*) ()
#8 0x00477aeb in MainWindow::MainWindow() ()
#9 0x0047230a in main ()

So its something related to script module. Maybe I just miss something obvious, next week I'm gonna join the irc channel anyway, so don't bother with this one.

comment:5 Changed 7 years ago by sebb

"- Removing a value leaves the file as expected (may be with a comment that should be left in place).

  • Same as before but adding a new value"

this is done, branch updated
for the first two remarks, how would you do that - start tor instance "manually" (using the start(), authenticate() etc methods) or reuse mainWindow code to start it, by creating MainWindow instance ? I tried second option (which I think is better for tests), but creating MainWindow object gives me the same segmentation fault as above.

comment:6 Changed 7 years ago by chiiph

What Qt version are you using? You could add some debug prints and check whether it's the whole VidaliaTab qtscript class or just a specific part of it.

I think either option is good, as long as they do the job. You are testing Torrc, not the bootstrap.

comment:7 Changed 7 years ago by sebb

Qt 4.7.3
after debugging, its looks like the problem is located in qtscript_VidaliaTab.cpp file, lines 235-238

QScriptValue fun = engine->newFunction(qtscript_VidaliaTab_prototype_call,qtscript_VidaliaTab_function_lengths[i+1]);
fun.setData(QScriptValue(engine, uint(0xBABE0000 + i))); proto.setProperty(QString::fromLatin1(qtscript_VidaliaTab_function_names[i+1]),fun);

It does not depend on the "i" index, it crashes for every value.
When I remove the "setProperty" call, it wont crash.
I thought this is related to "fromLatin1" call, but it crashes even for
' proto.setProperty("prop",fun); '
It does not crash if I remove the "fun" argument, so this works ok:
proto.setProperty(QString::fromLatin1(qtscript_VidaliaTab_function_names[i+1]),QScriptValue());

finally, this is the call causing the crash:
engine->newFunction(qtscript_VidaliaTab_prototype_call, qtscript_VidaliaTab_function_lengths[i+1]);

commenting it out makes program work ok.

I don't know QtScript module, I dont think I can solve it without spending few days.

comment:8 Changed 7 years ago by chiiph

Try upgrading to 4.8.1.

Your fix might work, but you will be losing functionality, since you are no longer providing the actual function.

Either way, I think you should leave it the way it works, and we can continue discussing that bug after this is done.

comment:9 Changed 7 years ago by sebb

sure, i didn't mean to provide a fix, just to identify the source of this bug
i'll try to upgrade to Qt 4.8 and let you know

comment:10 Changed 7 years ago by sebb

Looks like it works fine with Qt 4.8.1. I should be done with remaining tests soon.

comment:11 Changed 7 years ago by sebb

Status: needs_revisionneeds_review

comment:12 Changed 7 years ago by chiiph

Resolution: fixed
Status: needs_reviewclosed

Merged!

Note: See TracTickets for help on using tickets.