- Date: Sun, 14 Apr 2019 12:41:08 +0200
- From: Houder <houder@xxxxxxxxx>
- Subject: Setup.exe: BUG.
While implementing a solution for the problem described here:
( Setup: why consult registry (rootdir) if -R has been specified? )
I discovered a bug in main.cc (setup.exe).
At startup, setup.exe writes the following report to the log file:
yyyy/mm/dd HH:MM:SS Starting cygwin install, version 2.900
yyyy/mm/dd HH:MM:SS User has backup/restore rights
yyyy/mm/dd HH:MM:SS Current Directory: <directory> <====
The last line above should read:
yyyy/mm/dd HH:MM:SS Local Directory: <directory>, a.k.a. Local Package
The call flow in main.cc is as follows:
The code in main.cc can be described as follows:
- local_dir is assigned the current directory (the directory from which
setup.exe is started)
- however, at the beginning of main_display the constructor of class
LocalDirSetting is executed (as result of the declaration of
- the constructor of class LocalDirSetting may assign a different value
local_dir ... (different from the current directory)
(it is here where I discovered another bug in setup.exe)
- the constructor first checks whether or not option -l has been
- using option -l one can specify the local directory a.k.a the Local
Package Directory, as an argument to setup.exe
- if option -l has not been specified, the constructor checks if
the execution of constructor UserSettings (as result of the
of Settings (WinMain) ) has produced a value for "last-cache"
- "last-cache" (one of the user settings from a previous invocation of
setup.exe is retrieved from /etc/setup/setup.rc
- "last cache" is another alias for the local directory a.k.a. the
- CURRENTLY, setup.exe attempts to locate /etc/setup/setup.rc only in
the root directory as specified by the registry ("rootdir")
Currently? Yes, currently, setup.exe does not attempt to locate the file
in the directory as specified by the -R option (first choice), or in the
current directory (second choice - which would make sense if setup.exe
started in the root directory).
The upshot of the above is, that the report that is written to the
is wrong if a different value is assigned to local_dir in main_display.
[ and yes, people do create shortcuts to the setup executable and
arguments to the setup program over there. Believe it or not.}
Logging of the current directory should occur in WinMain (see below).
The code in main.cc as far as it concerns the text above.
static inline void
/* nondisplay classes */
LocalDirSetting localDir; <====
// Henri: WRONG! It is the Local Directory a.k.a. the Local Package
Log (LOG_TIMESTAMP) << "Current Directory: " << local_dir << endLog;
WinMain (HINSTANCE h,
HINSTANCE hPrevInstance, LPSTR command_line, int cmd_show)
GetCurrentDirectory (MAX_PATH, cwd);
local_dir = std::string (cwd);
if (!elevate && !output_only)
... setup logging ...
// Henri: now you would be right!
Log (LOG_TIMESTAMP) << "WinMain: Current Directory: " << local_dir <<
... run setup.exe in elevated mode ...
UserSettings Settings (local_dir); <====
... handle exceptions ...
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple