You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This covers a possible concern pertaining to a forthcoming minor
gix-testtools bugfix.
The null device, accessible as `/dev/null` on a Unix-like system,
or as `NUL` (and in some other ways) on Windows, is the best
candidate to replace the current value of `:` (on Unix) or `-`
(on Windows) for `GIT_CONFIG_SYSTEM` and `GIT_CONFIG_GLOBAL` when
test fixture scripts are running.
This is because the filenames `:` (on Unix) and `-` (on Windows) do
not have any special meaning. They are valid but unusual filenames;
files of these names most often do not exist, but can, and when
they do, their contents are used the populate the system or global
scope for test fixtures, which is not the intended behavior. `git`
does not treat them as anything but filenames: a `:` is not treated
as a separator because those variables are interpreted as single
paths rather than lists of paths, and a `-` is not treated to mean
standard input (or any other special data source) because it
appears in an environment variable rather than as a command-line
argument.
But `/dev/null` and `NUL` can exist, too.
On Unix, where `/dev/null` should be used, the whole point is that
`/dev/null` exists. That absolute path is not treated specially.
Instead, the device node for the null device is linked there.
On Windows, where the null device is named `NUL`, an entry for it
with that name does also sort of exist in the filesystem,
accessible via the fully qualified device path `\\.\NUL` as well as
by some other fully qualified forms such as `\??\NUL`. However, not
all interfaces support all path forms, so accessing it in those
ways is not necessarily more robust than accessing it with the
relative path `NUL`.
Yet it is possible for an actual file, not the null device, to
exist with the name `NUL` in an arbitrary directory. Such a file
can only be referred to using the UNC syntax with a `\\?\` prefixed
path (not to be confused with the `\\.\` device namespace prefix,
nor the NT `\??\` prefix).
When such a file exists, `NUL` itself still does not refer to it;
`NUL` still refers to the null device. The additon to the test here
(and refactorings to support it) create an acutal file called `NUL`
to demonstrate that changing `-` to `NUL` really does avoid getting
a configuration file, regardless of what files exist.
0 commit comments