Marc,
I came across this bug by accident. Its not important to me in any way but I thought you should know about at. It seems that any attempt to apply ##symbol-hash to a symbol composed of numbers, ie (##symbol-hash '33) of (##symbol-hash '5321) causes gsi to segfault. This may or may not have wider implications.
Afficher les réponses par date
Eric,
I came across this bug by accident. Its not important to me in any way but I thought you should know about at. It seems that any attempt to apply ##symbol-hash to a symbol composed of numbers, ie (##symbol-hash '33) of (##symbol-hash '5321) causes gsi to segfault. This may or may not have wider implications.
Well, '33 and '5321 are not even symbols. They are numbers. I guess that ##symbol-hash does not even check the type of its argument (like most functions whose name start with ##). So I wouldn't consider this a bug.
The following works, however:
Gambit Version 4.0 beta 10
(symbol? '|33|)
#t
Marc,
I came across this bug by accident. Its not important to me in any way but I thought you should know about at. It seems that any attempt to apply ##symbol-hash to a symbol composed of numbers, ie (##symbol-hash '33) of (##symbol-hash '5321) causes gsi to segfault. This may or may not have wider implications.
Here's a Gambit rule:
If a function name starts with ## then it is unsafe. It can crash the system if you don't give it proper arguments. You should avoid using it unless you are sure the arguments are correct.
As the name implies ##symbol-hash expects a symbol. 33 is not a symbol, it is a number. This is why (##symbol-hash '33) crashes. Now this works: (##symbol-hash (string->symbol "33")) because (string->symbol "33") is a symbol.
Marc
I realize its not a symbol. It was the fact that it crashed the system that kind of had me worried. As I said I was just playing around when I came across it. I was planning to use ##symbol-hash in an application, but if its got a chance of causing a segfault then I will avoid it (and all the others that start with ##).
If nothing else I am glad I came accross it. I didn't realize that these were that unsafe.
thanks, eric
On Wed, 8 Dec 2004 21:38:57 -0500, Marc Feeley feeley@iro.umontreal.ca wrote:
Marc,
I came across this bug by accident. Its not important to me in any way but I thought you should know about at. It seems that any attempt to apply ##symbol-hash to a symbol composed of numbers, ie (##symbol-hash '33) of (##symbol-hash '5321) causes gsi to segfault. This may or may not have wider implications.
Here's a Gambit rule:
If a function name starts with ## then it is unsafe. It can crash the system if you don't give it proper arguments. You should avoid using it unless you are sure the arguments are correct.
As the name implies ##symbol-hash expects a symbol. 33 is not a symbol, it is a number. This is why (##symbol-hash '33) crashes. Now this works: (##symbol-hash (string->symbol "33")) because (string->symbol "33") is a symbol.
Marc
Eric,
I realize its not a symbol. It was the fact that it crashed the system that kind of had me worried. As I said I was just playing around when I came across it. I was planning to use ##symbol-hash in an application, but if its got a chance of causing a segfault then I will avoid it (and all the others that start with ##).
I'm sure there is no problem using them, given that you properly test the type of the argument yourself before calling them. For example:
(if (symbol? v) (##symbol-hash v) ...)
Dominique