In Matlab, a directory called
foo can be created by calling
mkdir is successful, then the function returns logical 1; otherwise it returns logical 0. Now consider the case where Matlab is run on Linux and there is already a file called
foo in the current directory. Linux does not permit the existence of a file and a directory of the same name in the same folder so the call to
mkdir should fail. Instead,
mkdir will leave the file intact, return logical 1, and print the misleading warning "Directory already exists". That is, there is no directory called
foo after this supposedly successful function call.
The peculiarity of this behavior has been reported to Mathworks in September 2015. The example above was tested with Matlab R2015b and R2014a on Linux.
In a filesystem, there are two kinds of paths: relative paths and absolute paths. Absolute paths always point to the same target while the target of a relative path depends on the current working directory. In Matlab, paths are called "path names" and there is a third kind of path name: the partial path name. It is defined as follows:
A partial path name is the last portion of a full path name for a location on the MATLAB search path.
(The Matlab search path is similar to the environment variable PATH and is used to locate Matlab files.) In consequence of this definition, a path name may be treated by Matlab as a partial path name even if the user is unaware of them.
In this post, I will demonstrate Matlab behavior that is unexpected if you are not aware of the existence of partial path names. I will also explain how this causes a bug in xUnit 3 and xUnit 4.
Continue reading Matlab: Unawareness of Partial Path Names may cause Bugs