From: Houder <houder@xs4all.nl>
To: cygwin@cygwin.com
Subject: Setup.exe: BUG.
Date: Sun, 14 Apr 2019 10:41:00 -0000 [thread overview]
Message-ID: <77bf0a487a2ffeb94af5f3fd6264b77e@xs4all.nl> (raw)
L.S.,
While implementing a solution for the problem described here:
https://cygwin.com/ml/cygwin/2019-04/msg00032.html
( 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
Directory!
The call flow in main.cc is as follows:
Winmain
main_display
The code in main.cc can be described as follows:
WinMain
- 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
localDir)
-
main_display
- the constructor of class LocalDirSetting may assign a different value
to
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
specified
- 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
declaration
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
Local
Package Directory
- 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
is
started in the root directory).
The upshot of the above is, that the report that is written to the
logfile
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
specify
arguments to the setup program over there. Believe it or not.}
Logging of the current directory should occur in WinMain (see below).
Henri
-----
The code in main.cc as far as it concerns the text above.
static inline void
main_display ()
{
/* nondisplay classes */
LocalDirSetting localDir; <====
SourceSetting SourceSettings;
...
// Henri: WRONG! It is the Local Directory a.k.a. the Local Package
Directory
Log (LOG_TIMESTAMP) << "Current Directory: " << local_dir << endLog;
...
}
int WINAPI
WinMain (HINSTANCE h,
HINSTANCE hPrevInstance, LPSTR command_line, int cmd_show)
{
...
try {
...
char cwd[MAX_PATH];
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 <<
endLog;
}
...
if (elevate)
{
... run setup.exe in elevated mode ...
}
else
{
...
UserSettings Settings (local_dir); <====
main_display ();
Settings.save ();
...
}
}
... handle exceptions ...
}
=====
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
reply other threads:[~2019-04-14 10:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=77bf0a487a2ffeb94af5f3fd6264b77e@xs4all.nl \
--to=houder@xs4all.nl \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).