public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Unattended upgrade does not report errors via the exit code
       [not found] <693796192.3838665.1530640512441.ref@mail.yahoo.com>
@ 2018-07-03 17:55 ` R. Diez via cygwin
  2018-07-04 18:59   ` Ken Brown
  0 siblings, 1 reply; 5+ messages in thread
From: R. Diez via cygwin @ 2018-07-03 17:55 UTC (permalink / raw)
  To: cygwin

Hi all:

First of all, many thanks for Cygwin.

I have been trying to find out how to do an unattended update/upgrade of all packages, in order to save some mouse clicks. To do that, you start 
setup-x86_64.exe with --quiet-mode. During experimentation, I found out the following:

1) Apparently, it will close all running Cygwin software automatically as needed, in order to upgrade it. That may be a nasty surprise for the unwary.


2) If you start it from a Cygwin console, or from an unprivileged Windows console, you will not see the console messages like this:


Starting cygwin install, version 2.891
User has backup/restore rights

Current Directory: C:\CygwinInstall
Could not open service McShield for query, start and stop. McAfee may not be installed, or we don't have access.
root: C:\cygwin64 system
Selected local directory: C:\CygwinInstall
net: Direct
connection error: 12007
site: http://linux.rz.ruhr-uni-bochum.de/download/cygwin/
connection error: 12007
connection error: 12007
...

If you run it from a unprivileged console, you will not see the message either that tells you about the log file where to look for errors.


I would suggest documenting those things. I could not find mention of that anywhere in the web pages.

More seriously, the setup program does not indicate any failure (it always yields an exit code of 0). In the above example, where I disabled the network card, you get the following lines at the end:

connection error: 12007
connection error: 12007
mbox note: Unable to get setup from <http://linux.rz.ruhr-uni-bochum.de/download/cygwin/>
unattended_mode is set at mbox: returning default value
download/verify error in unattended_mode: out of retries
note: Installation incomplete.  Check C:\cygwin64\var\log\setup.log.full for details
Ending cygwin install



I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% in a Windows console, and it always showed an exit status of 0.


I did not try what happens if the selected mirror is out of date.

This is a serious drawback, because there is no way to know whether the unattended install or upgrade failed or not.

Best regards,
  rdiez

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unattended upgrade does not report errors via the exit code
  2018-07-03 17:55 ` Unattended upgrade does not report errors via the exit code R. Diez via cygwin
@ 2018-07-04 18:59   ` Ken Brown
  2018-07-04 22:25     ` David Stacey
  0 siblings, 1 reply; 5+ messages in thread
From: Ken Brown @ 2018-07-04 18:59 UTC (permalink / raw)
  To: cygwin; +Cc: R. Diez

On 7/3/2018 1:55 PM, R. Diez via cygwin wrote:
> First of all, many thanks for Cygwin.
> 
> I have been trying to find out how to do an unattended update/upgrade of all packages, in order to save some mouse clicks. To do that, you start
> setup-x86_64.exe with --quiet-mode. During experimentation, I found out the following:
> 
> 1) Apparently, it will close all running Cygwin software automatically as needed, in order to upgrade it. That may be a nasty surprise for the unwary.

One of the features of --quiet-mode is that setup doesn't bother the 
user with a lot of popup dialogs.  For the most part it simply proceeds 
with the defaults, corresponding to what would happen if the user 
pressed ENTER when running interactively.  In particular, this applies 
to the dialog that pops up when running processes need to be stopped.

> 2) If you start it from a Cygwin console, or from an unprivileged Windows console, you will not see the console messages like this:
> 
> 
> Starting cygwin install, version 2.891
> User has backup/restore rights
> 
> Current Directory: C:\CygwinInstall
> Could not open service McShield for query, start and stop. McAfee may not be installed, or we don't have access.
> root: C:\cygwin64 system
> Selected local directory: C:\CygwinInstall
> net: Direct
> connection error: 12007
> site: http://linux.rz.ruhr-uni-bochum.de/download/cygwin/
> connection error: 12007
> connection error: 12007
> ...
> 
> If you run it from a unprivileged console, you will not see the message either that tells you about the log file where to look for errors.
> 
> 
> I would suggest documenting those things. I could not find mention of that anywhere in the web pages.

The documentation could certainly use improvement.  Patches would be 
welcome.  AFAICT, the main documentation is at

   https://cygwin.com/cygwin-ug-net/setup-net.html,

the source for which is in winsup/doc/setup-net.xml in the Cygwin source 
repository.  See also winsup/doc/faq-setup.xml.  And see 
https://cygwin.com/git.html for information about getting access to the 
source repository.

> More seriously, the setup program does not indicate any failure (it always yields an exit code of 0). In the above example, where I disabled the network card, you get the following lines at the end:
> 
> connection error: 12007
> connection error: 12007
> mbox note: Unable to get setup from <http://linux.rz.ruhr-uni-bochum.de/download/cygwin/>
> unattended_mode is set at mbox: returning default value
> download/verify error in unattended_mode: out of retries
> note: Installation incomplete.  Check C:\cygwin64\var\log\setup.log.full for details
> Ending cygwin install
> 
> 
> 
> I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% in a Windows console, and it always showed an exit status of 0.

setup is a Windows program, not a Cygwin application, so I don't think 
you can expect $? to contain its exit status.  I don't know enough about 
Windows programming to know what would have to be changed in the setup 
sources to support %ERRORLEVEL%.

On the other hand, if you're running setup from a script, you could 
probably achieve what you want by grepping /var/log/setup.log.full.

There's been a proposal on the cygwin-apps list to have a Cygwin "setup" 
package, possibly including a wrapper script for setup.exe.  Maybe that 
script could be tweaked to provide a useful exit code.  See

   https://sourceware.org/ml/cygwin-apps/2018-04/msg00016.html

Ken


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unattended upgrade does not report errors via the exit code
  2018-07-04 18:59   ` Ken Brown
@ 2018-07-04 22:25     ` David Stacey
  2018-07-05  3:16       ` Ken Brown
  0 siblings, 1 reply; 5+ messages in thread
From: David Stacey @ 2018-07-04 22:25 UTC (permalink / raw)
  To: cygwin

On 04/07/18 19:59, Ken Brown wrote:
> On 7/3/2018 1:55 PM, R. Diez via cygwin wrote:
>> I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% 
>> in a Windows console, and it always showed an exit status of 0.
>
> setup is a Windows program, not a Cygwin application, so I don't think 
> you can expect $? to contain its exit status.  I don't know enough 
> about Windows programming to know what would have to be changed in the 
> setup sources to support %ERRORLEVEL%.

%ERRORLEVEL% is the return code from the last programme or script to 
execute. Provided that setup exits with zero on success and non-zero on 
an error condition, there's nothing extra to be done.

Dave.


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unattended upgrade does not report errors via the exit code
  2018-07-04 22:25     ` David Stacey
@ 2018-07-05  3:16       ` Ken Brown
  2018-07-05 11:50         ` Andrey Repin
  0 siblings, 1 reply; 5+ messages in thread
From: Ken Brown @ 2018-07-05  3:16 UTC (permalink / raw)
  To: cygwin

On 7/4/2018 6:25 PM, David Stacey wrote:
> On 04/07/18 19:59, Ken Brown wrote:
>> On 7/3/2018 1:55 PM, R. Diez via cygwin wrote:
>>> I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% 
>>> in a Windows console, and it always showed an exit status of 0.
>>
>> setup is a Windows program, not a Cygwin application, so I don't think 
>> you can expect $? to contain its exit status.  I don't know enough 
>> about Windows programming to know what would have to be changed in the 
>> setup sources to support %ERRORLEVEL%.
> 
> %ERRORLEVEL% is the return code from the last programme or script to 
> execute. Provided that setup exits with zero on success and non-zero on 
> an error condition, there's nothing extra to be done.

According to 
https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line/11476681#11476681, 
that's not true for windowed applications, but it is true if the 
application is started via 'start /wait'.  I haven't tested this.

Ken


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unattended upgrade does not report errors via the exit code
  2018-07-05  3:16       ` Ken Brown
@ 2018-07-05 11:50         ` Andrey Repin
  0 siblings, 0 replies; 5+ messages in thread
From: Andrey Repin @ 2018-07-05 11:50 UTC (permalink / raw)
  To: Ken Brown, cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1963 bytes --]

Greetings, Ken Brown!

> On 7/4/2018 6:25 PM, David Stacey wrote:
>> On 04/07/18 19:59, Ken Brown wrote:
>>> On 7/3/2018 1:55 PM, R. Diez via cygwin wrote:
>>>> I tried printing $? from a Cygwin shell afterwards, and %ERRORLEVEL% 
>>>> in a Windows console, and it always showed an exit status of 0.
>>>
>>> setup is a Windows program, not a Cygwin application, so I don't think 
>>> you can expect $? to contain its exit status.  I don't know enough 
>>> about Windows programming to know what would have to be changed in the 
>>> setup sources to support %ERRORLEVEL%.
>> 
>> %ERRORLEVEL% is the return code from the last programme or script to 
>> execute. Provided that setup exits with zero on success and non-zero on 
>> an error condition, there's nothing extra to be done.

> According to 
> https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line/11476681#11476681,
> that's not true for windowed applications,

Karmaoverflow is not the authoritative source of information.
The key word is "directly in the command line". CMD checks if application you
are starting is console or not and abandon process control for perceived GUI
apps.
But if you run application from batch file, it will treat all of them equal.

> but it is true if the
> application is started via 'start /wait'.  I haven't tested this.

Unless application explicitly detach from parent process, or parent process
explicitly exec the child with no process control, there's no difference.
exit(n) is the same function, not dependent on the type of application.


-- 
With best regards,
Andrey Repin
Thursday, July 5, 2018 14:08:05

Sorry for my terrible english...\0ТÒÐÐ¥\a&ö&ÆVÒ\a&W\x06÷'G3¢\x02\x02\x02\x02\x02\x02\x06‡GG\x03¢òö7–wv–âæ6öÒ÷\a&ö&ÆV×2æ‡FÖÀФd\x15\x13¢\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x06‡GG\x03¢òö7–wv–âæ6öÒöf\x17\x12ðФFö7VÖVçF\x17F–öã¢\x02\x02\x02\x02\x02\x02\x02\x02\x06‡GG\x03¢òö7–wv–âæ6öÒöFö72æ‡FÖÀÐ¥Vç7V'67&–&R\x06–æfó¢\x02\x02\x02\x02\x02\x06‡GG\x03¢òö7–wv–âæ6öÒöÖÂò7Vç7V'67&–&R×6–×\x06ÆPРÐ

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-05 11:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <693796192.3838665.1530640512441.ref@mail.yahoo.com>
2018-07-03 17:55 ` Unattended upgrade does not report errors via the exit code R. Diez via cygwin
2018-07-04 18:59   ` Ken Brown
2018-07-04 22:25     ` David Stacey
2018-07-05  3:16       ` Ken Brown
2018-07-05 11:50         ` Andrey Repin

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).