Mantis - Squeak
Viewing Issue Advanced Details
7456 Files major always 01-17-10 05:55 04-18-10 21:58
closed trunk  
none trunk  
0007456: In sq 8864 evaluating 'FileDirectory default = nil' causes an MNU #pathName

For this one evaluate
'FileDirectory default = nil'
in a workspace .

By comparison

'nil = FileDirectory default'
 evaluates to false

This is the bug that prompted report 0007445.

The culprit is

'ar 10/4/2009 22:22 FileDirectory = {comparing}'

Which is assuming the argument is also a file directory.

= has a duty to take on all comers.

To make the problem clearer I have given it a separate report.

This bug is also telling us that there ought to be a test for #= that tries out all receivers.

Which is telling us that all classes need to respond safely to some message like
MyClass testInstance .

Vaguely, this could be done by a class returning a safe initialized instance of itself. Or if no such thing exists returning a initialized instance of a safe Mock subclass. I haven't worked out the details of this idea because it is a new one.

has duplicate 0007445closed andreas In 8864 Saveing a project can still hang (4th bug and counting) 
 EquivBugTest-wiz.1.cs [^] (1,745 bytes) 02-12-10 04:04

01-17-10 05:57   
Reminder sent to: andreas

This is the problem you need to solve for 7445. Cheers --Jer
nicolas cellier   
01-27-10 18:06   
I agree we should protect =
However I never used x = nil. Is this code in image ?
Either I use (x isNil) or (x == nil) which is also used by (x ifNil: [])

That's why qualifying the bug as major or priority as urgent is a bit exagerated IMO
01-27-10 20:55   
Hi Nicolas,

The general problem is the form:

anObject = anObjectOfADifferentClass
sometimes raises an error.

In this case the offending receiver class is FileDirectory.

My choice of nil as the second object was to simplify the test that demonstrates the problem. The instance were I actually came across the report is in the other report.

The invariant should be that comparing two objects via #= should always work giving a Boolean. If it doesn't then the order of the arguments becomes critical.

Jocularly, if you can't compare something to the undefined object what can you compare it to?

In squeak #= is not automatically commutative. This requires awareness and care on the part of the coders.

Currently FileDirectory can only be compared to other FileDirectories. Or you have to insure that the file directory is the argument not the receiver. Otherwise it invokes the debugger. That is a solid enough bug in my book.

The importance and urgency to me is this. If we have one of these in the image and we don't know when it will crop up, we have a very brittle image subject to unexpected failures. Plus it will mask other bugs that need finding as well.

Yours in service and curiosity, --Jerome Peace

02-12-10 04:19   
Uploaded a test designed to fail until the problem is fixed.

This is simply a unit test built from the example given above.

If this doesn't pass the problem isn't fixed. So it is a necessary test.

It is not a comprehensive test, just specific to FileDirectory.

The comprehensive test would take a test instance of each class then send #= and #~ to each.

I am proposing that a #testInstance selector be added to the language.

The idea is it would provide a testable default instance of each class. Untestable (dangerous classes) are required to return nil instead of a default instance. All other classes should return something like a initialized instance.

The backup in Object and ProtoObject would be to return nil.
02-28-10 21:30   
Fixed in 9552.