public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [setup - the official Cygwin setup program] branch master, updated. release_2.882
Date: Mon, 23 Oct 2017 16:35:00 -0000	[thread overview]
Message-ID: <20171023163524.83433.qmail@sourceware.org> (raw)




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=a70f0d5617189495dc1515ecb68dbd7ef5be111c

commit a70f0d5617189495dc1515ecb68dbd7ef5be111c
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Oct 20 13:30:48 2017 +0100

    Add OS version to user-agent string

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=50147e2040aad768e6c4a80e3f1cecc8383408a2

commit 50147e2040aad768e6c4a80e3f1cecc8383408a2
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Oct 18 17:57:54 2017 +0100

    Add bitness to user-agent string
    
    We have no idea about the proportion of 32-bit and 64-bit Cygwin installs.
    
    Add a 'Win32', 'WoW64' or 'Win64' token to the user-agent string to report
    bitness.
    
    Future work: it might be useful to report the OS version as well

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=f003c5585301efc65c1848d71993d8a13a94cdd5

commit f003c5585301efc65c1848d71993d8a13a94cdd5
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Oct 19 02:20:55 2017 +0100

    Fix -Werror=misleading-indentation errors seen with gcc 6
    
    This looks like an actual bug which has been lurking here since forever,
    fortunately not exposed since hardly anything uses Option::Optional...
    
    libgetopt++/src/OptionSet.cc: In member function 'void OptionSet::doOption(std::__cxx11::string&, const size_type&)':
    libgetopt++/src/OptionSet.cc:125:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
                             if (!isOption(maybepos))
                             ^~
    libgetopt++/src/OptionSet.cc:128:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
            argv.erase(argv.begin() + 1);
            ^~~~
    libgetopt++/src/OptionSet.cc:159:25: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
                             if (!isOption(maybepos))
                             ^~
    libgetopt++/src/OptionSet.cc:161:8: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
            argv.erase(argv.begin() + 1);
            ^~~~

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=2666daacead168518c0a85044e14d6304bb45a8d

commit 2666daacead168518c0a85044e14d6304bb45a8d
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Sep 27 17:49:29 2017 +0100

    Fix -Werror=unused-const-variable error seen with gcc 6
    
    sha2.c:199:24: error: 'sha224_initial_hash_value' defined but not used [-Werror=unused-const-variable=]

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=395cf0390abbf35873f8914f5ab152b014e13a69

commit 395cf0390abbf35873f8914f5ab152b014e13a69
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Oct 10 17:10:57 2017 +0100

    Fix spinning after replace-on-reboot failure or skipped
    
    If:
    - extracting a file failed AND --no-replaceonreboot was used
    - OR, writing the .new file for replacing on reboot failed
    we don't advance to the next file in the archive, so we just sit there,
    trying the same operation repeatedly.
    
    Yes, this seems to mean that --no-replaceonreboot never worked usefully.
    
    Also advance to next file in extract_other error case.
    
    See https://cygwin.com/ml/cygwin/2017-10/msg00090.html


Diff:
---
 install.cc                   |   19 +++++++++++++++----
 libgetopt++/src/OptionSet.cc |    6 ++++--
 nio-ie5.cc                   |   31 +++++++++++++++++++++++++++++--
 sha2.c                       |    2 ++
 win32.h                      |    2 ++
 5 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/install.cc b/install.cc
index f8f0b59..a47edcd 100644
--- a/install.cc
+++ b/install.cc
@@ -498,6 +498,8 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
       archive::extract_results extres;
       while ((extres = archive::extract_file (tarstream, prefixURL, prefixPath)) != archive::extract_ok)
         {
+          bool error_in_this_file = false;
+
           switch (extres)
             {
 	    case archive::extract_inuse: // in use
@@ -602,13 +604,13 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
                 if (NoReplaceOnReboot)
                   {
                     ++errors;
-                    error_in_this_package = true;
+                    error_in_this_file = true;
                     Log (LOG_PLAIN) << "Not replacing in-use file " << prefixURL
                                     << prefixPath << fn << endLog;
                   }
                 else
                   {
-                    error_in_this_package = extract_replace_on_reboot(tarstream, prefixURL, prefixPath, fn);
+                    error_in_this_file = extract_replace_on_reboot(tarstream, prefixURL, prefixPath, fn);
                   }
               }
               break;
@@ -633,8 +635,7 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
                           MB_OK | MB_ICONWARNING | MB_TASKMODAL);
                   }
 
-                // don't mark this package as successfully installed
-                error_in_this_package = true;
+                error_in_this_file = true;
               }
               break;
 	    case archive::extract_ok:
@@ -642,6 +643,16 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver,
             }
 
           // We're done with this file
+
+          // if an error occured ...
+          if (error_in_this_file)
+            {
+              // skip to next file in archive
+              tarstream->skip_file();
+              // don't mark this package as successfully installed
+              error_in_this_package = true;
+            }
+
           break;
         }
       progress (pkgfile->tell ());
diff --git a/libgetopt++/src/OptionSet.cc b/libgetopt++/src/OptionSet.cc
index f57b89a..81ffeae 100644
--- a/libgetopt++/src/OptionSet.cc
+++ b/libgetopt++/src/OptionSet.cc
@@ -122,10 +122,11 @@ OptionSet::doOption(string &option, string::size_type const &pos)
                     if (argv.size() > 1) {
                         string::size_type maybepos = argv[1].find_first_not_of("-");
 
-                        if (!isOption(maybepos))
+                        if (!isOption(maybepos)) {
                             /* not an option */
                             value = argv[1];
 			    argv.erase(argv.begin() + 1);
+                        }
                     }
                 } else {
                     /* value if present is in this argv */
@@ -156,9 +157,10 @@ OptionSet::doOption(string &option, string::size_type const &pos)
                     if (argv.size() > 1) {
                         string::size_type maybepos = argv[1].find_first_not_of("-");
 
-                        if (!isOption(maybepos))
+                        if (!isOption(maybepos)) {
                             value = argv[1];
 			    argv.erase(argv.begin() + 1);
+                        }
                     }
                 }
             }
diff --git a/nio-ie5.cc b/nio-ie5.cc
index 24d2c13..a649233 100644
--- a/nio-ie5.cc
+++ b/nio-ie5.cc
@@ -29,13 +29,40 @@
 #include "LogSingleton.h"
 #include "setup_version.h"
 #include "getopt++/StringOption.h"
+#include <sstream>
 
 static StringOption UserAgent ("", '\0', "user-agent", "User agent string for HTTP requests");
-static std::string default_useragent = std::string("Cygwin-Setup/") + setup_version;
 
 static HINTERNET internet_direct = 0;
 static HINTERNET internet_preconfig = 0;
 
+const std::string &
+determine_default_useragent(void)
+{
+  static std::string default_useragent;
+
+  if (!default_useragent.empty())
+    return default_useragent;
+
+  std::stringstream os;
+  os << "Windows NT " << OSMajorVersion() << "." << OSMinorVersion() << "." << OSBuildNumber();
+
+  std::string bitness = "Unknown";
+#ifdef __x86_64__
+  bitness = "Win64";
+#else
+  typedef BOOL (WINAPI *PFNISWOW64PROCESS)(HANDLE, PBOOL);
+  PFNISWOW64PROCESS pfnIsWow64Process = (PFNISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
+  if (pfnIsWow64Process) {
+    BOOL bIsWow64 = FALSE;
+    if (pfnIsWow64Process(GetCurrentProcess(), &bIsWow64))
+      bitness = bIsWow64 ? "WoW64" : "Win32";
+  }
+#endif
+  default_useragent = std::string("Cygwin-Setup/") + setup_version + " (" + os.str() + ";" + bitness + ")";
+  return default_useragent;
+}
+
 NetIO_IE5::NetIO_IE5 (char const *_url, bool direct, bool cachable):
 NetIO (_url)
 {
@@ -51,7 +78,7 @@ NetIO (_url)
     {
       InternetAttemptConnect (0);
 
-      const char *lpszAgent = default_useragent.c_str();
+      const char *lpszAgent = determine_default_useragent().c_str();
       if (UserAgent.isPresent())
         {
           const std::string &user_agent = UserAgent;
diff --git a/sha2.c b/sha2.c
index 4842e42..67251bc 100644
--- a/sha2.c
+++ b/sha2.c
@@ -195,6 +195,7 @@ static const u_int32_t K256[64] = {
 	0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
 };
 
+#if !defined(SHA2_SMALL)
 /* Initial hash value H for SHA-224: */
 static const u_int32_t sha224_initial_hash_value[8] = {
 	0xc1059ed8UL,
@@ -206,6 +207,7 @@ static const u_int32_t sha224_initial_hash_value[8] = {
 	0x64f98fa7UL,
 	0xbefa4fa4UL
 };
+#endif
 
 /* Initial hash value H for SHA-256: */
 static const u_int32_t sha256_initial_hash_value[8] = {
diff --git a/win32.h b/win32.h
index fd4c80c..c866790 100644
--- a/win32.h
+++ b/win32.h
@@ -166,6 +166,7 @@ class VersionInfo
      VersionInfo ();
      DWORD major () const { return v.dwMajorVersion; }
      DWORD minor () const { return v.dwMinorVersion; }
+     DWORD buildNumber () const { return v.dwBuildNumber; }
   private:
      OSVERSIONINFO v;
 };
@@ -174,6 +175,7 @@ VersionInfo& GetVer ();
 
 #define OSMajorVersion() (GetVer ().major ())
 #define OSMinorVersion() (GetVer ().minor ())
+#define OSBuildNumber() (GetVer ().buildNumber ())
 
 static inline void
 GetDlgItemRect (HWND h, int item, LPRECT r)


                 reply	other threads:[~2017-10-23 16:35 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=20171023163524.83433.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /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).