[review] XM_CATALOG_BOOTSTRAP_RESOLVER.Reserved_directory_path is not safe

2 messages Options
Embed this post
Permalink
Jocelyn.Fiat.List

[review] XM_CATALOG_BOOTSTRAP_RESOLVER.Reserved_directory_path is not safe

Reply Threaded More More options
Print post
Permalink
In the code of {XM_CATALOG_BOOTSTRAP_RESOLVER}.Reserved_directory_path
we have
            Result := Execution_environment.variable_value ("GOBO")
            Result := unix_file_system.pathname_from_file_system
(Result, file_system)

However `Execution_environment.variable_value ("GOBO")' can return a
Void value
and then the call to unix_file_system.pathname_from_file_system (Result,
file_system) will violate precondition of  `pathname_from_file_system'
or raise exception (if assertion are disabled).

Regards,
-- Jocelyn




------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop
Eric Bezault

Re: [review] XM_CATALOG_BOOTSTRAP_RESOLVER.Reserved_directory_path is not safe

Reply Threaded More More options
Print post
Permalink
Jocelyn wrote:

> In the code of {XM_CATALOG_BOOTSTRAP_RESOLVER}.Reserved_directory_path
> we have
>             Result := Execution_environment.variable_value ("GOBO")
>             Result := unix_file_system.pathname_from_file_system
> (Result, file_system)
>
> However `Execution_environment.variable_value ("GOBO")' can return a
> Void value
> and then the call to unix_file_system.pathname_from_file_system (Result,
> file_system) will violate precondition of  `pathname_from_file_system'
> or raise exception (if assertion are disabled).

I modified it as follows:

        Reserved_directory_path: STRING is
                        -- Path to directory containing latest schemas
                once
                        Result := file_system.pathname ("${GOBO}", "misc")
                        Result := Execution_environment.interpreted_string (Result)
                ensure
                        reserved_directory_path_not_void: Result /= Void
                end

Note that it looks like this routine is never called.

--
Eric Bezault
mailto:[hidden email]
http://www.gobosoft.com

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gobo-eiffel-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop